EGSnrc C++ class library
Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
|
A template class for 3D polygons. More...
#include <egs_polygon.h>
Public Member Functions | |
EGS_PolygonT (vector< EGS_2DVector > &points, const T &projector, bool Open=false) | |
Construct a 3D polygon defined by the 2D points points in the plane defined by the projector projector. More... | |
~EGS_PolygonT () | |
Destructor. | |
bool | isConvex () const |
Is this polygon convex ? | |
int | getN () const |
Get the number of polygon points. | |
EGS_Vector | getPoint (int j) const |
Get the j'th point. | |
EGS_Vector | getNormal () const |
Get the normal to the polygon plane. | |
EGS_Vector | getNormal (const EGS_2DVector &x) const |
EGS_Vector | getNormal (int j) const |
Get the normal to the j'th polygon edge. | |
EGS_2DVector | getProjection (const EGS_Vector &x) const |
Get the projection of x on the polygon plane. | |
EGS_Float | distance (const EGS_Vector &x) const |
Get the distance between x and the polygon plane. | |
bool | isInside2D (const EGS_2DVector &xp) const |
Is the 2D point xp inside the polygon ? | |
bool | isInside2D (const EGS_Vector &x) const |
Is the projection of the 3D point x on the polygon plane inside the polygon ? | |
bool | isInside (const EGS_Vector &x) const |
Is the 3D point inside the polygon plane ? (i.e. on than side of the plane to which the plane normal points to) | |
EGS_Float | hownear2D (bool in, const EGS_Vector &x) const |
Get the nearest distance between the projection of x and the polygon outline. | |
EGS_Float | hownear (bool in, const EGS_Vector &x) const |
Get the nearest distance between x and any point inside the polygon. | |
bool | howfar2D (bool in, const EGS_Vector &x, const EGS_Vector &u, EGS_Float &t, EGS_2DVector *normal=0) const |
Does the projection on the polygon plane of the trajectory defined by position x and direction u intersect the polygon ? More... | |
bool | howfar (bool in, const EGS_Vector &x, const EGS_Vector &u, EGS_Float &t) const |
Will the line defined by position x and direction u intersect the polygon plane at a position inside the polygon ? More... | |
const string & | getType () const |
Get the polygon type. | |
A template class for 3D polygons.
This class is a wrap-around the EGS_2DPolygon class for conveniently modeling polygons in 3D. It consists of a projector of type T, which projects the 3D position and/or direction onto the polygon plane and then uses the EGS_2DPolygon and projector methods to implement the various geometry related functions needed in the geometry methods of prisms and pyramids. The class is implemented as a template so that a single implementation can be used for polygons in the x-, y- and z-planes (fast) and a general plane in 3D (slower due to the slower projection operation).
Definition at line 335 of file egs_polygon.h.
EGS_PolygonT< T >::EGS_PolygonT | ( | vector< EGS_2DVector > & | points, |
const T & | projector, | ||
bool | Open = false |
||
) |
Construct a 3D polygon defined by the 2D points points in the plane defined by the projector projector.
The meaning of the Open parameter is the same as in EGS_2DPolygon::EGS_2DPolygon().
Definition at line 345 of file egs_polygon.h.
EGS_Vector EGS_PolygonT< T >::getNormal | ( | const EGS_2DVector & | x | ) | const |
?
Definition at line 374 of file egs_polygon.h.
bool EGS_PolygonT< T >::howfar2D | ( | bool | in, |
const EGS_Vector & | x, | ||
const EGS_Vector & | u, | ||
EGS_Float & | t, | ||
EGS_2DVector * | normal = 0 |
||
) | const |
Does the projection on the polygon plane of the trajectory defined by position x and direction u intersect the polygon ?
Definition at line 433 of file egs_polygon.h.
References epsilon.
bool EGS_PolygonT< T >::howfar | ( | bool | in, |
const EGS_Vector & | x, | ||
const EGS_Vector & | u, | ||
EGS_Float & | t | ||
) | const |
Will the line defined by position x and direction u intersect the polygon plane at a position inside the polygon ?
The interpretation of the return value and the value of in and t is the same as in EGS_2DPolygon::howfar()
Definition at line 448 of file egs_polygon.h.
References epsilon.