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 | Halfspace { Halfspace::POSITIVE, Halfspace::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. More... | |
| CSGSurface (const std::string &name, const std::string &surf_type) | |
| Construct a new CSGSurface. More... | |
| virtual | ~CSGSurface ()=default |
| Destructor. More... | |
| const std::string & | getSurfaceType () const |
| Get the Surface Type. More... | |
| virtual std::unordered_map< std::string, Real > | getCoeffs () const =0 |
| Get the coefficients that define the surface. More... | |
| virtual Real | evaluateSurfaceEquationAtPoint (const Point &p) const =0 |
| given a point, determine its evaluation based on the surface equation. More... | |
| CSGSurface::Halfspace | getHalfspaceFromPoint (const Point &p) const |
| given a point, determine if it is in the positive or negative half-space for the surface More... | |
| const std::string & | getName () const |
| Get the name of surface. More... | |
| bool | operator== (const CSGSurface &other) const |
| Operator overload for checking if two CSGSurface objects are equal. More... | |
| bool | operator!= (const CSGSurface &other) const |
| Operator overload for checking if two CSGSurface objects are not equal. More... | |
| const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & | getTransformations () const |
| Get the list of transformations. More... | |
| std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > | getTransformationsAsStrings () const |
| Get the transformations of this object with string representations for types. More... | |
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. More... | |
| static std::string | getTransformationTypeString (TransformationType type) |
| Get the string representation of the transformation type. More... | |
Protected Member Functions | |
| virtual std::unique_ptr< CSGSurface > | clone () const =0 |
| Create clone of current surface, to be implemented by derived class. More... | |
| 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. More... | |
| Point | applyReverseTransformsToPoint (Point p) const |
| update the value of point p by applying the inverse of the list of transformations to the point More... | |
| FRIEND_TEST (CSGSurfaceTest, testSetName) | |
| Friends for unit testing. More... | |
| FRIEND_TEST (CSGSurfaceTest, testSurfaceEquality) | |
| FRIEND_TEST (CSGSurfaceTest, testHalfspaceWithTransform) | |
| Friends for unit testing. More... | |
| FRIEND_TEST (CSGSurfaceTest, testHalfspaceWithNullTransform) | |
Protected Attributes | |
| std::string | _name |
| Name of surface. More... | |
| const std::string | _surface_type |
| Type of surface that is being represented string is taken directly from the surface class name. More... | |
| std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > | _transformations |
| List of transformations applied to this object. More... | |
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 |
| CSG::CSGSurface::CSGSurface | ( | const std::string & | name, |
| const std::string & | surf_type | ||
| ) |
Construct a new CSGSurface.
| name | unique name of surface |
| surf_type | surface type |
Definition at line 16 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.
|
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::CSGPlane, CSG::CSGSphere, CSG::CSGXCylinder, CSG::CSGYCylinder, and CSG::CSGZCylinder.
|
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::CSGPlane, CSG::CSGSphere, CSG::CSGXCylinder, CSG::CSGYCylinder, and CSG::CSGZCylinder.
Referenced by getHalfspaceFromPoint().
|
protectedinherited |
Friends for unit testing.
|
protectedinherited |
|
protected |
Friends for unit testing.
|
protected |
|
pure virtual |
Get the coefficients that define the surface.
Implemented in CSG::CSGPlane, CSG::CSGSphere, 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 95 of file CSGSurface.h.
Referenced by CSG::CSGSurfaceList::addSurface(), CSG::CSGBase::addTransformation(), CSG::CSGBase::checkSurfaceInBase(), CSG::CSGBase::deleteSurface(), operator==(), and CSG::CSGSurfaceList::renameSurface().
|
inline |
Get the Surface Type.
Definition at line 61 of file CSGSurface.h.
Referenced by operator==().
|
inlineinherited |
Get the list of transformations.
Definition at line 47 of file CSGTransformationHelper.h.
Referenced by getHalfspaceFromPoint(), CSG::CSGUniverse::operator==(), operator==(), CSG::CSGCell::operator==(), and CSG::CSGLattice::operator==().
|
inherited |
Get the transformations of this object with string representations for types.
Definition at line 65 of file CSGTransformationHelper.C.
|
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().
|
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 54 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 113 of file CSGSurface.h.
|
friend |
Definition at line 124 of file CSGSurface.h.
|
friend |
Definition at line 123 of file CSGSurface.h.
|
protected |
Name of surface.
Definition at line 116 of file CSGSurface.h.
Referenced by CSG::CSGXCylinder::clone(), CSG::CSGYCylinder::clone(), CSG::CSGZCylinder::clone(), CSG::CSGSphere::clone(), CSG::CSGPlane::clone(), getHalfspaceFromPoint(), getName(), and setName().
|
protected |
Type of surface that is being represented string is taken directly from the surface class name.
Definition at line 120 of file CSGSurface.h.
Referenced by getSurfaceType().
|
protectedinherited |
List of transformations applied to this object.
Definition at line 92 of file CSGTransformationHelper.h.
Referenced by CSG::CSGTransformationHelper::addTransformation(), CSG::CSGTransformationHelper::applyReverseTransformsToPoint(), CSG::CSGTransformationHelper::getTransformations(), and CSG::CSGTransformationHelper::getTransformationsAsStrings().
1.8.14