ivutils
Loading...
Searching...
No Matches
Polyhedron< plane_itt > Class Template Reference

polyhedron defined as a set of planes More...

#include <region_3.h>

Inheritance diagram for Polyhedron< plane_itt >:
Collaboration diagram for Polyhedron< plane_itt >:

Public Member Functions

void init (plane_it beg, plane_it end)
 start and end iterator at plane sequence which confine the polyhedron
 
virtual bool TestPoint (const Vector_3 &p) const override
 returns true if the point is in the the region plane normals are pointing inside the region!!!!
 
vec_type MinPlaneDist (const Vector_3 &pos, plane_it *mit=NULL) const
 gets the distance between a point and the closest plane (which is the distance to the polyhedron surface for internal points)
 
template<class contour_t >
vec_type TestContour (const contour_t &cnt, VecContour<> *subcont=NULL, Vector_3 *subcenter=NULL) const
 returns the area fraction of the contour part that is inside the region and subcontour which is inside the region (if pointer is not NULL) and the center of the subcontour (if pointer is not NULL)
 
virtual int TestLine (const vector_t &p, const vector_t &dir, vec_type *frac, vector_t *surfp=NULL, vector_t *surfn=NULL, vec_type epsilon=0) const override
 Records the fractions frac1 and frac2 of the line (p,dir) corresponding to the intersections surfpi=p+fraci*dir, surfni - coords of intersection and corresponding outer normal.
 
virtual vec_type SurfProject (const vector_t &p, vector_t *surfp=NULL, vector_t *surfn=NULL) const override
 find polyhedron surface point surfp which is closest to the given point p and normal to polyhedron surfn at surfp Works correctly when p is inside polyhedron or outside and very close to its surface.
 
virtual Region_3Clone (const Vector_3 &shift=Vector_3()) const override
 cloning is not possible for arbitrary plane iterator???
 
virtual RegDumper< 3 > * CreateDumper () const override
 return pointer on object RegDumper, which has function Dump drawing the region
 
bool valid () const
 
vec_type Volume () const override
 Calculates the volume of a finite polyhedron. For void and inifinite polyhedrons returns 0.
 
size_t size () const
 
- Public Member Functions inherited from Region< N >
virtual int GetFlags () const
 Returns a set of bit flags specifying which functions are implemented for this region (see RegFlags).
 
virtual bool TestPoint (const vector_t &p) const
 Returns true if the point is in the region.
 
template<class contour_t >
vec_type TestContour (const contour_t &cnt, VecContour< N > *subcont=nullptr, vector_t *subcenter=nullptr) const
 Returns the area fraction of the contour part that is inside the region, subcontour which is inside the region (if pointer is not nullptr) and the center of the subcontour (if pointer is not nullptr)
 
virtual vec_type TestPtrContour (const PtrContour< N > &cnt, VecContour< N > *subcont=nullptr, vector_t *subcenter=nullptr) const
 virtual version of TestContour for particular PtrContour
 
virtual vector_t GetBoundingBox (vector_t *v1, vector_t *v2) const
 Returns opposite corners of the box which contains the region inside itself.
 
virtual vector_t GetCenter () const
 Returns the center of the region.
 
virtual vec_type GetInsideEdgePart (const vector_t &p1, const vector_t &p2) const
 Returns a fraction of the edge [0-1] that belongs to the region.
 
virtual vec_type TestEdge (const vector_t &p1, const vector_t &p2, vector_t *surfp=nullptr, vector_t *surfn=nullptr) const
 Returns a fraction of the edge from the first point till the intersection with the surface of the region.
 
virtual vec_type TestRay (const vector_t &p1, const vector_t &dir, vector_t *surfp=nullptr, vector_t *surfn=nullptr, vec_type epsilon=0) const
 Returns the fraction of the ray corresponding to the nearest intersection in positive direction frac<0 means no intersection in positive direction intersections with frac<=epsilon are ignored.
 
virtual size_t GetElementarySubRegions (std::vector< int > *flags=nullptr, std::vector< Region * > *regs=nullptr) const
 For composite regions returns the number of elementary subregions, otherwise returns 0.
 

Additional Inherited Members

- Public Types inherited from Region< N >
typedef unknown_cat category
 Category of the region to determine the correct template behaviour for various algorithms (see Body categories categories).
 

Detailed Description

template<class plane_itt>
class Polyhedron< plane_itt >

polyhedron defined as a set of planes

Member Function Documentation

◆ init()

template<class plane_itt >
void Polyhedron< plane_itt >::init ( plane_it  beg,
plane_it  end 
)

start and end iterator at plane sequence which confine the polyhedron

checking for coordinate planes

◆ size()

template<class plane_itt >
size_t Polyhedron< plane_itt >::size ( ) const
inline
Returns
number of planes

◆ SurfProject()

template<class plane_itt >
vec_type Polyhedron< plane_itt >::SurfProject ( const vector_t p,
vector_t surfp = NULL,
vector_t surfn = NULL 
) const
overridevirtual

find polyhedron surface point surfp which is closest to the given point p and normal to polyhedron surfn at surfp Works correctly when p is inside polyhedron or outside and very close to its surface.

Returns
distance between p and surfp

Reimplemented from Region< N >.

◆ TestContour()

template<class plane_itt >
template<class contour_t >
vec_type Polyhedron< plane_itt >::TestContour ( const contour_t &  cnt,
VecContour<> *  subcont = NULL,
Vector_3 subcenter = NULL 
) const

returns the area fraction of the contour part that is inside the region and subcontour which is inside the region (if pointer is not NULL) and the center of the subcontour (if pointer is not NULL)

testing bounding box

◆ TestLine()

template<class plane_itt >
int Polyhedron< plane_itt >::TestLine ( const vector_t p,
const vector_t dir,
vec_type *  frac,
vector_t surfp = NULL,
vector_t surfn = NULL,
vec_type  epsilon = 0 
) const
overridevirtual

Records the fractions frac1 and frac2 of the line (p,dir) corresponding to the intersections surfpi=p+fraci*dir, surfni - coords of intersection and corresponding outer normal.

Intersections with frac<=epsilon are ignored. Returns the number of intersections: 0, 1 (touching or intersection of infinite region) or 2 because region is convex.

Reimplemented from Region< N >.

◆ valid()

template<class plane_itt >
bool Polyhedron< plane_itt >::valid ( ) const
Returns
true if the Polyhedron defines nonvoid region (it may have zero volume).

The documentation for this class was generated from the following files: