ivutils
Loading...
Searching...
No Matches
Polyhedron_3 Class Reference

polyhedron as array of planes More...

#include <region_3.h>

Inheritance diagram for Polyhedron_3:
Collaboration diagram for Polyhedron_3:

Public Member Functions

void init (Plane_3 *beg, Plane_3 *end, bool managed=true)
 the pointers must be valid for the whole lifetime of the class beg and end start and end pointers at array of planes managed: false if this array is not managed, true if this array will be delete if not used anymore
 
template<class plane_itt >
void init (plane_itt beg, plane_itt end, bool managed)
 this constructor copies the planes to the current class the managed flag is ignored (as if were always true)
 
template<class plane_itt >
 Polyhedron_3 (plane_itt beg, plane_itt end, bool managed)
 this constructor copies the planes to the current class the managed flag is ignored (as if were always true)
 
Polyhedron_3 operator& (const Polyhedron_3 &other) const
 Intersection of two polyhedra.
 
virtual Region_3Clone (const Vector_3 &shift=Vector_3()) const
 
void shift (const Vector_3 &shift)
 Shifts each plane by specified vector. Caution, in managed descendants, the function changes original planes!
 
void expand (vec_type dr)
 Each plane of the polyhedron is shifted by -dr in the direction of the normal, which effectively expands the region. Negative dr shrinks the region.
 
void Refine ()
 Deletes redundant planes from the polyhedron.
 
size_t size () const
 
template<class iT >
Plane_3operator[] (const iT &it)
 
template<class iT >
const Plane_3operator[] (const iT &it) const
 
- Public Member Functions inherited from Polyhedron< Plane_3 * >
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)
 
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 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.
 
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

polyhedron as array of planes

Member Function Documentation

◆ Clone()

virtual Region_3 * Polyhedron_3::Clone ( const Vector_3 shift = Vector_3()) const
inlinevirtual
Returns
a copy of itself optionally shifted in space with the shift vector

Reimplemented from Polyhedron< Plane_3 * >.

◆ operator[]() [1/2]

template<class iT >
Plane_3 & Polyhedron_3::operator[] ( const iT &  it)
inline
Returns
given plane by index Change of plane will change all copies of the polyhedron, use with care!

◆ operator[]() [2/2]

template<class iT >
const Plane_3 & Polyhedron_3::operator[] ( const iT &  it) const
inline
Returns
given plane by index, const version

◆ size()

size_t Polyhedron_3::size ( ) const
inline
Returns
number of planes

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