CSGPlane creates an internal representation of a Constructive Solid Geometry (CSG) plane, represented in the form aX + bY + cZ = d. More...
#include <CSGPlane.h>
Public Types | |
| enum class | Halfspace { POSITIVE , NEGATIVE } |
| Enum for the sign of the half-space being represented by a point and surface. More... | |
Public Member Functions | |
| CSGPlane (const std::string &name, const Point &p1, const Point &p2, const Point &p3) | |
| Construct a new CSGPlane surface from three non co-linear points. | |
| CSGPlane (const std::string &name, const Real a, const Real b, const Real c, const Real d) | |
| Construct a new CSGPlane surface from coefficients (a, b, c, d) for the equation of a plane: aX + bY + cZ = d. | |
| virtual | ~CSGPlane ()=default |
| Destructor. | |
| virtual std::unordered_map< std::string, Real > | getCoeffs () const override |
| get coefficients (a, b, c, d) of the Plane aX + bY + cZ = d | |
| virtual Real | evaluateSurfaceEquationAtPoint (const Point &p) const override |
| given a point, determine its evaluation based on the equation of the plane | |
| const std::string | getSurfaceType () const |
| Get the Surface Type. | |
| CSGSurface::Halfspace | getHalfspaceFromPoint (const Point &p) const |
| given a point, determine if it is in the positive or negative half-space for the surface | |
| const std::string & | getName () const |
| Get the name of surface. | |
| virtual bool | isEngUnit () const |
| Whether this surface is an engineering unit. | |
| bool | operator== (const CSGSurface &other) const |
| Operator overload for checking if two CSGSurface objects are equal. | |
| bool | operator!= (const CSGSurface &other) const |
| Operator overload for checking if two CSGSurface objects are not equal. | |
| const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & | getTransformations () const |
| Get the list of transformations. | |
| std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > | getTransformationsAsStrings () const |
| Get the transformations of this object with string representations for types. | |
Static Public Member Functions | |
| static bool | isValidTransformationValue (TransformationType type, const std::tuple< Real, Real, Real > &values) |
| Check if the transformation value is valid for the given type. | |
| static std::string | getTransformationTypeString (TransformationType type) |
| Get the string representation of the transformation type. | |
Protected Member Functions | |
| virtual std::unique_ptr< CSGSurface > | clone () const override |
| create clone of CSGPlane object | |
| void | coeffsFromPoints (const Point &p1, const Point &p2, const Point &p3) |
| void | normalizePlaneCoefficients () |
| Normalize plane coefficients so that a^2 + b^2 + c^2 = 1. | |
| void | setName (const std::string &name) |
| void | addTransformation (TransformationType type, const std::tuple< Real, Real, Real > &values) |
| Add a transformation to the list of transformations. | |
| Point | applyReverseTransformsToPoint (Point p) const |
| update the value of point p by applying the inverse of the list of transformations to the point | |
| FRIEND_TEST (CSGSurfaceTest, testSetName) | |
| Friends for unit testing. | |
| FRIEND_TEST (CSGSurfaceTest, testSurfaceEquality) | |
| FRIEND_TEST (CSGSurfaceTest, testHalfspaceWithTransform) | |
| Friends for unit testing. | |
| FRIEND_TEST (CSGSurfaceTest, testHalfspaceWithNullTransform) | |
| FRIEND_TEST (CSGEngUnitTest, testEngUnitEqual) | |
Protected Attributes | |
| Real | _a |
| Value of a in equation of plane. | |
| Real | _b |
| Value of b in equation of plane. | |
| Real | _c |
| Value of c in equation of plane. | |
| Real | _d |
| Value of d in equation of plane. | |
| std::string | _name |
| Name of surface. | |
| std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > | _transformations |
| List of transformations applied to this object. | |
CSGPlane creates an internal representation of a Constructive Solid Geometry (CSG) plane, represented in the form aX + bY + cZ = d.
Definition at line 23 of file CSGPlane.h.
|
stronginherited |
Enum for the sign of the half-space being represented by a point and surface.
| Enumerator | |
|---|---|
| POSITIVE | |
| NEGATIVE | |
Definition at line 30 of file CSGSurface.h.
| CSG::CSGPlane::CSGPlane | ( | const std::string & | name, |
| const Point & | p1, | ||
| const Point & | p2, | ||
| const Point & | p3 | ||
| ) |
Construct a new CSGPlane surface from three non co-linear points.
| name | unique name of plane |
| p1 | point 1 |
| p2 | point 2 |
| p3 | point 3 |
Definition at line 15 of file CSGPlane.C.
| CSG::CSGPlane::CSGPlane | ( | const std::string & | name, |
| const Real | a, | ||
| const Real | b, | ||
| const Real | c, | ||
| const Real | d | ||
| ) |
Construct a new CSGPlane surface from coefficients (a, b, c, d) for the equation of a plane: aX + bY + cZ = d.
| name | unique name of plane |
| a | coefficient a |
| b | coefficient b |
| c | coefficient c |
| d | coefficient d |
Definition at line 22 of file CSGPlane.C.
|
virtualdefault |
Destructor.
|
protectedinherited |
Add a transformation to the list of transformations.
| type | The type of transformation |
| values | The values for the transformation |
Definition at line 16 of file CSGTransformationHelper.C.
Referenced by CSG::CSGBase::addTransformation(), CSG::CSGBase::expandEngUnit(), CSG::CSGBase::expandEngUnit(), and CSG::CSGBase::expandEngUnit().
|
protectedinherited |
update the value of point p by applying the inverse of the list of transformations to the point
| p | point to transform |
Definition at line 74 of file CSGTransformationHelper.C.
Referenced by CSG::CSGSurface::getHalfspaceFromPoint().
|
inlineoverrideprotectedvirtual |
create clone of CSGPlane object
Implements CSG::CSGSurface.
Definition at line 75 of file CSGPlane.h.
|
protected |
Definition at line 36 of file CSGPlane.C.
Referenced by CSGPlane().
|
overridevirtual |
given a point, determine its evaluation based on the equation of the plane
| p | point |
Implements CSG::CSGSurface.
Definition at line 65 of file CSGPlane.C.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Friends for unit testing.
|
protectedinherited |
Friends for unit testing.
|
protectedinherited |
|
overridevirtual |
get coefficients (a, b, c, d) of the Plane aX + bY + cZ = d
Implements CSG::CSGSurface.
Definition at line 29 of file CSGPlane.C.
|
inherited |
given a point, determine if it is in the positive or negative half-space for the surface
| p | point |
Definition at line 23 of file CSGSurface.C.
|
inlineinherited |
Get the name of surface.
Definition at line 90 of file CSGSurface.h.
Referenced by CSG::CSGSurfaceList::addSurface(), CSG::CSGBase::addTransformation(), CSG::CSGBase::checkSurfaceInBase(), CSG::CSGBase::deleteSurface(), CSG::CSGSurfaceEngUnit::getName(), CSG::CSGSurface::operator==(), CSG::CSGBase::prepareSurfaceDeletion(), CSG::CSGBase::renameSurface(), and CSG::CSGSurfaceList::renameSurface().
|
inlineinherited |
Get the Surface Type.
Definition at line 53 of file CSGSurface.h.
Referenced by CSG::CSGSurface::operator==().
|
inlineinherited |
Get the list of transformations.
Definition at line 51 of file CSGTransformationHelper.h.
Referenced by CSG::CSGSurface::getHalfspaceFromPoint(), CSG::CSGCellEngUnit::getTransformations(), CSG::CSGSurfaceEngUnit::getTransformations(), CSG::CSGUniverseEngUnit::getTransformations(), CSG::CSGCell::operator==(), CSG::CSGLattice::operator==(), CSG::CSGSurface::operator==(), and CSG::CSGUniverse::operator==().
|
inherited |
Get the transformations of this object with string representations for types.
Definition at line 65 of file CSGTransformationHelper.C.
Referenced by CSG::CSGCellEngUnit::getTransformationsAsStrings(), CSG::CSGSurfaceEngUnit::getTransformationsAsStrings(), and CSG::CSGUniverseEngUnit::getTransformationsAsStrings().
|
staticinherited |
Get the string representation of the transformation type.
| type | The transformation type |
Definition at line 56 of file CSGTransformationHelper.C.
Referenced by CSG::CSGTransformationHelper::addTransformation(), and CSG::CSGTransformationHelper::getTransformationsAsStrings().
|
inlinevirtualinherited |
Whether this surface is an engineering unit.
Returns false for a plain CSGSurface; overridden to return true by the engineering unit types. Used to avoid a dynamic_cast on the common plain-surface comparison path (see operator==).
Reimplemented in CSG::CSGSurfaceEngUnit.
Definition at line 101 of file CSGSurface.h.
Referenced by CSG::CSGSurface::operator==().
|
staticinherited |
Check if the transformation value is valid for the given type.
| type | The type of transformation |
| values | The values for the transformation |
Definition at line 26 of file CSGTransformationHelper.C.
Referenced by CSG::CSGTransformationHelper::addTransformation().
|
protected |
Normalize plane coefficients so that a^2 + b^2 + c^2 = 1.
Definition at line 55 of file CSGPlane.C.
Referenced by CSGPlane(), and CSGPlane().
|
inherited |
Operator overload for checking if two CSGSurface objects are not equal.
Definition at line 65 of file CSGSurface.C.
|
inherited |
Operator overload for checking if two CSGSurface objects are equal.
Definition at line 45 of file CSGSurface.C.
|
inlineprotectedinherited |
Definition at line 119 of file CSGSurface.h.
|
protected |
Value of a in equation of plane.
Definition at line 87 of file CSGPlane.h.
Referenced by clone(), coeffsFromPoints(), evaluateSurfaceEquationAtPoint(), getCoeffs(), and normalizePlaneCoefficients().
|
protected |
Value of b in equation of plane.
Definition at line 90 of file CSGPlane.h.
Referenced by clone(), coeffsFromPoints(), evaluateSurfaceEquationAtPoint(), getCoeffs(), and normalizePlaneCoefficients().
|
protected |
Value of c in equation of plane.
Definition at line 93 of file CSGPlane.h.
Referenced by clone(), coeffsFromPoints(), evaluateSurfaceEquationAtPoint(), getCoeffs(), and normalizePlaneCoefficients().
|
protected |
Value of d in equation of plane.
Definition at line 96 of file CSGPlane.h.
Referenced by clone(), coeffsFromPoints(), evaluateSurfaceEquationAtPoint(), getCoeffs(), and normalizePlaneCoefficients().
|
protectedinherited |
Name of surface.
Definition at line 122 of file CSGSurface.h.
Referenced by CSG::CSGNPolygonUnit::clone(), clone(), CSG::CSGSphere::clone(), CSG::CSGXCylinder::clone(), CSG::CSGYCylinder::clone(), CSG::CSGZCylinder::clone(), CSG::CSGSurface::getHalfspaceFromPoint(), CSG::CSGSurface::getName(), and CSG::CSGSurface::setName().
|
protectedinherited |
List of transformations applied to this object.
Definition at line 96 of file CSGTransformationHelper.h.
Referenced by CSG::CSGTransformationHelper::addTransformation(), CSG::CSGTransformationHelper::applyReverseTransformsToPoint(), CSG::CSGTransformationHelper::getTransformations(), and CSG::CSGTransformationHelper::getTransformationsAsStrings().