ivutils
Loading...
Searching...
No Matches
Cylinder< base_tt > Class Template Reference

Cylinder with arbitrary 2D base of the type base_t Cylinder axis passes the point origin and directed along vector n Axes of 2D plane which contain the base are directed along vector x and y Base is specified in 2D coordinate system defined by origin, x and y Vector n is perpendicular to x and y (cylinder axis is perpendicular to the base) "Tilted" cylinder with axis not perpendicular to the base can be specified using template StretchedRegion. More...

#include <region_3.h>

Inheritance diagram for Cylinder< base_tt >:
Collaboration diagram for Cylinder< base_tt >:

Public Member Functions

Vector_2 Vector_3to2 (const Vector_3 &v3, vec_type *height=NULL) const
 project point v at base 2D coordinate system and record to height distance to this base plane
 
Vector_3 Vector_2to3 (const Vector_2 &v2, const vec_type height=0) const
 move point from 2D base coordinate system to 3D space and shift from the base plane at distance height
 
virtual int GetFlags () const
 Returns a set of bit flags specifying which functions are implemented for this region (see RegFlags).
 
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
 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 RegDumper< 3 > * CreateDumper () const
 return pointer on object RegDumper, which has function Dump drawing the region
 
- Public Member Functions inherited from Region< N >
virtual bool TestPoint (const vector_t &p) const
 Returns true if the point is in the region.
 
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 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.
 

Public Attributes

mngptr< base_t > base
 base
 

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 base_tt>
class Cylinder< base_tt >

Cylinder with arbitrary 2D base of the type base_t Cylinder axis passes the point origin and directed along vector n Axes of 2D plane which contain the base are directed along vector x and y Base is specified in 2D coordinate system defined by origin, x and y Vector n is perpendicular to x and y (cylinder axis is perpendicular to the base) "Tilted" cylinder with axis not perpendicular to the base can be specified using template StretchedRegion.

Member Function Documentation

◆ TestLine()

template<class base_tt >
int Cylinder< base_tt >::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
virtual

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 >.

Reimplemented in Cone< base_tt >.


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