CSGSurface creates an internal representation of a Constructive Solid Geometry (CSG) surface, represented as some polynomial in x, y, and z. More...
#include <CSGSurface.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 | |
| CSGSurface (const std::string &name) | |
| Default constructor. | |
| virtual | ~CSGSurface ()=default |
| Destructor. | |
| const std::string | getSurfaceType () const |
| Get the Surface Type. | |
| virtual std::unordered_map< std::string, Real > | getCoeffs () const =0 |
| Get the coefficients that define the surface. | |
| virtual Real | evaluateSurfaceEquationAtPoint (const Point &p) const =0 |
| given a point, determine its evaluation based on the surface equation. | |
| 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 =0 |
| Create clone of current surface, to be implemented by derived class. | |
| 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 | |
| std::string | _name |
| Name of surface. | |
| std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > | _transformations |
| List of transformations applied to this object. | |
Friends | |
| class | CSGSurfaceList |
| class | CSGBase |
CSGSurface creates an internal representation of a Constructive Solid Geometry (CSG) surface, represented as some polynomial in x, y, and z.
Definition at line 26 of file CSGSurface.h.
|
strong |
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::CSGSurface::CSGSurface | ( | const std::string & | name | ) |
Default constructor.
| name | unique name of surface |
Definition at line 17 of file CSGSurface.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 getHalfspaceFromPoint().
|
protectedpure virtual |
Create clone of current surface, to be implemented by derived class.
Implemented in CSG::CSGNPolygonUnit, CSG::CSGPlane, CSG::CSGSphere, CSG::CSGXCylinder, CSG::CSGYCylinder, CSG::CSGZCylinder, and CSG::CSGSurfaceEngUnit.
|
pure virtual |
given a point, determine its evaluation based on the surface equation.
A positive value indicates a point that lies in the positive half-space with regards to the surface, a negative value indicates a point that lies in the negative side of the surface, and a value of 0 indicates that the point lies on the surface.
| p | point |
Implemented in CSG::CSGNPolygonUnit, CSG::CSGPlane, CSG::CSGSphere, CSG::CSGXCylinder, CSG::CSGYCylinder, CSG::CSGZCylinder, and CSG::CSGSurfaceEngUnit.
Referenced by getHalfspaceFromPoint().
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Friends for unit testing.
|
protected |
Friends for unit testing.
|
protected |
|
pure virtual |
Get the coefficients that define the surface.
Implemented in CSG::CSGPlane, CSG::CSGSphere, CSG::CSGSurfaceEngUnit, CSG::CSGXCylinder, CSG::CSGYCylinder, and CSG::CSGZCylinder.
Referenced by operator==().
| CSGSurface::Halfspace CSG::CSGSurface::getHalfspaceFromPoint | ( | const Point & | p | ) | const |
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.
|
inline |
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(), operator==(), CSG::CSGBase::prepareSurfaceDeletion(), CSG::CSGBase::renameSurface(), and CSG::CSGSurfaceList::renameSurface().
|
inline |
Get the Surface Type.
Definition at line 53 of file CSGSurface.h.
Referenced by operator==().
|
inlineinherited |
Get the list of transformations.
Definition at line 51 of file CSGTransformationHelper.h.
Referenced by getHalfspaceFromPoint(), CSG::CSGCellEngUnit::getTransformations(), CSG::CSGSurfaceEngUnit::getTransformations(), CSG::CSGUniverseEngUnit::getTransformations(), CSG::CSGCell::operator==(), CSG::CSGLattice::operator==(), 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().
|
inlinevirtual |
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 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().
| bool CSG::CSGSurface::operator!= | ( | const CSGSurface & | other | ) | const |
Operator overload for checking if two CSGSurface objects are not equal.
Definition at line 65 of file CSGSurface.C.
| bool CSG::CSGSurface::operator== | ( | const CSGSurface & | other | ) | const |
Operator overload for checking if two CSGSurface objects are equal.
Definition at line 45 of file CSGSurface.C.
|
inlineprotected |
Definition at line 119 of file CSGSurface.h.
|
friend |
Definition at line 126 of file CSGSurface.h.
|
friend |
Definition at line 125 of file CSGSurface.h.
|
protected |
Name of surface.
Definition at line 122 of file CSGSurface.h.
Referenced by CSG::CSGNPolygonUnit::clone(), CSG::CSGPlane::clone(), CSG::CSGSphere::clone(), CSG::CSGXCylinder::clone(), CSG::CSGYCylinder::clone(), CSG::CSGZCylinder::clone(), getHalfspaceFromPoint(), getName(), and 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().