ivutils
Loading...
Searching...
No Matches
Region< N > Class Template Reference

N-dimensional body. More...

#include <region_2.h>

Inheritance diagram for Region< N >:

Public Types

typedef unknown_cat category
 Category of the region to determine the correct template behaviour for various algorithms (see Body categories categories).
 

Public Member Functions

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.
 
virtual int TestLine (const vector_t &p, const vector_t &dir, vec_type *frac, vector_t *surfp=nullptr, vector_t *surfn=nullptr, vec_type epsilon=0) const
 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=nullptr, vector_t *surfn=nullptr) const
 finds the point on the region surface closest to the given one p returns distance to this point (positive is P outside and negative is P inside region), surfp – projection, surfn – norm vector at surfp

 
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 Volume () const
 Returns volume of the region. '-1' means that function is not implemented.
 
virtual RegDumper< N > * CreateDumper () const
 return pointer on object RegDumper, which has function Dump drawing 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.
 

Detailed Description

template<int N>
class Region< N >

N-dimensional body.

May have infinite extension in some directions. By default (if RegFlags::NOT_CONVEX is not specified), the region is convex.

Member Typedef Documentation

◆ category

template<int N>
typedef unknown_cat Region< N >::category

Category of the region to determine the correct template behaviour for various algorithms (see Body categories categories).


Member Function Documentation

◆ GetElementarySubRegions()

template<int N>
virtual size_t Region< N >::GetElementarySubRegions ( std::vector< int > *  flags = nullptr,
std::vector< Region< N > * > *  regs = nullptr 
) const
inlinevirtual

For composite regions returns the number of elementary subregions, otherwise returns 0.

Optionally fills subregion flags and pointers to all subregions found. Should be recursively called for composite regions with arbitrary components.

Reimplemented in CompositeRegion< N >.

◆ GetFlags()

template<int N>
virtual int Region< N >::GetFlags ( ) const
inlinevirtual

Returns a set of bit flags specifying which functions are implemented for this region (see RegFlags).

Returns
HAS_TESTPOINT|HAS_CLONE

Reimplemented in Cylinder< base_tt >, Cylinder< Circle >, ConfinedRegion< reg_tt >, Inverse< reg_tt >, Box_N< N >, Box_N< 3 >, Sphere_N< N >, Sphere_N< 2 >, Sphere_N< 3 >, StretchedRegion< reg_tt >, CompositeRegion< N >, and Box.

◆ TestEdge()

template<int N>
virtual vec_type Region< N >::TestEdge ( const vector_t p1,
const vector_t p2,
vector_t surfp = nullptr,
vector_t surfn = nullptr 
) const
inlinevirtual

Returns a fraction of the edge from the first point till the intersection with the surface of the region.

The intersection point may be calculated as pi=p1+frac*(p2-p1) frac ==-2 means that the function is not implemented frac ==-1 means no intersection fills pointers (if nonzero): surfp – intersection point on the surface, surfn – norm vector at surfp

◆ TestLine()

template<int N>
virtual int Region< N >::TestLine ( const vector_t p,
const vector_t dir,
vec_type *  frac,
vector_t surfp = nullptr,
vector_t surfn = nullptr,
vec_type  epsilon = 0 
) const
inlinevirtual

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 in Cylinder< base_tt >, Cylinder< Circle >, Cone< base_tt >, ConfinedRegion< reg_tt >, Box, Polyhedron< plane_itt >, Polyhedron< Plane_3 * >, Sphere_N< N >, Sphere_N< 2 >, Sphere_N< 3 >, and CompositeRegion< N >.

◆ TestRay()

template<int N>
virtual vec_type Region< N >::TestRay ( const vector_t p1,
const vector_t dir,
vector_t surfp = nullptr,
vector_t surfn = nullptr,
vec_type  epsilon = 0 
) const
inlinevirtual

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.

Fills pointers (if nonzero): surfp -- intersection point on the surface, surfn -- norm vector at surfp .

Returns
fraction>=0. or -1. if there is no intersection in positive direction, return values less than -1
may be treated as implementation dependent error codes.

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