ivutils
Loading...
Searching...
No Matches
contour.h File Reference

Some useful iterators (iterator at points, edges, planes) and classes for 2D and 3D contours. More...

#include <iterator>
#include <vector>
#include "vector_3.h"
#include "plane_3.h"
#include "refobj.h"
Include dependency graph for contour.h:
This graph shows which files directly or indirectly include this file:

Classes

class  edge_t< point_it >
 stores two vertices of the edge More...
 
class  generic_edge_it< point_it >
 contour edges iterator, based on contour start and end vertices iterators More...
 
class  normplanes_it< edge_it >
 iterator at planes normal to the contour plane and passing through edges of the contour Used in ProjectSimplex only. More...
 
class  range_store_t< point_it >
 Storage class used as template parameter in Contour. More...
 
class  Contour< point_it, store_t, edge_it, edge_t >
 Basic contour interface. More...
 
class  Contour_N< point_it, Vector_2, store_t, edge_it, edge_t >
 Contour_N specialization for 2D. More...
 
class  Contour_N< point_it, Vector_3, store_t, edge_it, edge_t >
 Contour_N specialization for 3D. More...
 
class  PtrContour< N >
 Contour based on dynamic Vector_Nt array. More...
 
struct  array_store_t< T, num >
 Storage class for array storage. More...
 
class  ArrayContour< N, num >
 Contour based on Vector_Nt array. More...
 
struct  vec_store_t< T >
 Storage class for vector storage. More...
 
class  VecContour< N >
 Contour based on Vector_Nt vector. More...
 
class  contour_projection_it< point_it >
 2D points iterator as a projection of given 3D points iterator on 2D coordinate system defined by its origin, and axes x, y
More...
 
class  Contour_3to2< contour_t >
 2D contour as a projection of given 3D contour on 2D coordinate system defined by its origin, and axes x, y
More...
 

Functions

template<class point_it , int N>
Vector_Nt< vec_type, N > GetBoundingBox (point_it it, point_it end, Vector_Nt< vec_type, N > *cube1, Vector_Nt< vec_type, N > *cube2)
 records opposite coordinates of maximal rectangular parallelepiped which contains some points defined by point iterators it and end returns average of selected points

 
Vector_2 Vector_3to2 (const Vector_3 &v3, const Vector_3 &origin, const Vector_3 &x, const Vector_3 &y)
 projects Vector_3 on 2D coordinate system defined by its origin and axes x, y
 
Vector_3 Vector_2to3 (const Vector_2 &v2, const Vector_3 &origin, const Vector_3 &x, const Vector_3 &y)
 opposite to Vector_3to2
 
template<class plane_it , class contour_t >
int ProjectSimplex (const Plane_3 &plane0, plane_it beg, plane_it end, contour_t &cnt, int nplanes=-1)
 record to the contour cnt section of the plane plane0 by polyhedron, formed by planes iterated from iterator beg till end
 
template<class out_cont_t , class plane_it >
int GetFaces (out_cont_t &cont, plane_it beg, plane_it end, const std::vector< int > *redundant_planes=nullptr, std::vector< int > *valid_planes=nullptr)
 gets all faces of the polyhedral region defined by planes from [beg, end) of type plane_it puts the faces as planar contours into container cont using push_back(...) Parameter redundant_planes specifies the order number of planes that can not form faces.
 
template<class contour_t >
int GetPlaneSection (const contour_t &cnt, const Plane_3 &plane, contour_t *cnt_in=nullptr, contour_t *cnt_out=nullptr)
 Tests whether the contour crosses the plane and optionally outputs inside (side of plane distance >0) and outside subcontours.
 

Detailed Description

Some useful iterators (iterator at points, edges, planes) and classes for 2D and 3D contours.

We have different contour implementations that can be used for different purposes

Function Documentation

◆ GetFaces()

template<class out_cont_t , class plane_it >
int GetFaces ( out_cont_t &  cont,
plane_it  beg,
plane_it  end,
const std::vector< int > *  redundant_planes = nullptr,
std::vector< int > *  valid_planes = nullptr 
)

gets all faces of the polyhedral region defined by planes from [beg, end) of type plane_it puts the faces as planar contours into container cont using push_back(...) Parameter redundant_planes specifies the order number of planes that can not form faces.

The order number of planes that actually form faces are placed in output parameter valid_planes, if specified.

Returns
the number of faces

◆ GetPlaneSection()

template<class contour_t >
int GetPlaneSection ( const contour_t &  cnt,
const Plane_3 plane,
contour_t *  cnt_in = nullptr,
contour_t *  cnt_out = nullptr 
)

Tests whether the contour crosses the plane and optionally outputs inside (side of plane distance >0) and outside subcontours.

Returns
0, if there is a crossing
1, if the contour is fully inside plane
-1, if the contour is fully outside plane