CSGNPolygonUnit is a CSGSurfaceEngUnit that represents a regular N-sided polygon (prismatic region) with its axis aligned with the z-axis. More...
#include <CSGNPolygonUnit.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 | |
| CSGNPolygonUnit (const std::string &name, int n_sides, Real apothem) | |
| Construct a new CSGNPolygonUnit. More... | |
| Real | evaluateSurfaceEquationAtPoint (const Point &p) const override |
| Evaluate the polygon's surface equation at the given point. More... | |
| std::unordered_map< std::string, AttributeVariant > | getAttributes () const override |
| Return the polygon attributes for this object. More... | |
| int | getNumSides () |
| Get the number of sides for the polygon. More... | |
| Real | getApothem () |
| Get the polygon apothem (center-to-flat distance) More... | |
| Real | getSideLength () |
| Get the polygon side length. More... | |
| Real | getRadius () |
| Get the the circumradius for the polygon (center-to-vertex distance) More... | |
| std::unordered_map< std::string, Real > | getCoeffs () const override |
| Always throws – coefficients are not defined for a surface engineering unit. More... | |
| const std::string & | getName () const override |
| Satisfy CSGEngUnit::getName() – resolved via CSGSurface::getName() More... | |
| bool | isEngUnit () const override |
| Engineering units report true so comparisons can skip the dynamic_cast fast path. More... | |
| bool | operator== (const CSGSurfaceEngUnit &other) const |
| Disambiguate == and != by forwarding to CSGEngUnit (name/property-based comparison) More... | |
| bool | operator== (const CSGSurface &other) const |
| Operator overload for checking if two CSGSurface objects are equal. More... | |
| bool | operator== (const CSGEngUnit &other) const |
| Operator overload for checking if two CSGEngUnit objects are equal. More... | |
| bool | operator!= (const CSGSurfaceEngUnit &other) const |
| bool | operator!= (const CSGSurface &other) const |
| Operator overload for checking if two CSGSurface objects are not equal. More... | |
| bool | operator!= (const CSGEngUnit &other) const |
| Operator overload for checking if two CSGEngUnit objects are not equal. More... | |
| const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & | getTransformations () const override |
| Delegate to CSGSurface (CSGTransformationHelper) More... | |
| std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > | getTransformationsAsStrings () const override |
| Delegate to CSGSurface (CSGTransformationHelper) More... | |
| const std::string | getSurfaceType () const |
| Get the Surface Type. 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 | getBehavior () const |
| Get the behavior of this engineering unit (surface (i.e. More... | |
| const std::string | getUnitType () const |
| Get the type name of this engineering unit. 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 | |
| std::unique_ptr< CSGSurface > | clone () const override |
| Return a deep copy of this unit. More... | |
| void | expandUnit () override |
| Create N CSGPlane surfaces in _internal_base, one per polygon side. More... | |
| CSGRegion | getExpandedRegion () const |
| Return the CSGRegion formed by the expanded CSGSurfaces. 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... | |
| CSGBase & | getBase () |
| Get the internal CSGBase owned by this engineering unit. More... | |
| std::unique_ptr< CSGBase > | releaseBase () |
| Transfer ownership of the internal CSGBase out of this unit. More... | |
| FRIEND_TEST (CSGEngUnitTest, testSurfUnit) | |
| Friends for unit testing. 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) | |
| FRIEND_TEST (CSGEngUnitTest, testEngUnitEqual) | |
Protected Attributes | |
| CSGRegion | _expanded_region |
| Stores the result of expandUnit(); EMPTY until then. More... | |
| std::string | _name |
| Name of surface. More... | |
| std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > | _transformations |
| List of transformations applied to this object. More... | |
| std::unique_ptr< CSGBase > | _internal_base |
| CSGBase populated by expandUnit(); joined into the parent CSGBase by expandEngUnit() More... | |
| MooseEnum | _behavior {"SURFACE CELL UNIVERSE"} |
| The basic CSG type this unit produces: "SURFACE", "CELL", or "UNIVERSE". More... | |
Private Member Functions | |
| FRIEND_TEST (CSGEngUnitTest, testPolygonUnitExpansion) | |
| FRIEND_TEST (CSGEngUnitTest, testPolygonUnitClone) | |
Private Attributes | |
| const int | _n_sides |
| Number of sides of the regular polygon. More... | |
| const Real | _apothem |
| Distance from the polygon center to the midpoint of each side. More... | |
| std::vector< const CSGSurface * > | _planes |
| Pointers to the expanded plane surfaces, populated during expandUnit() More... | |
CSGNPolygonUnit is a CSGSurfaceEngUnit that represents a regular N-sided polygon (prismatic region) with its axis aligned with the z-axis.
The polygon is defined by N infinite planes, one per side, each oriented so that its inward normal points toward the center. The interior of the polygon is the intersection of the N negative half-spaces of those planes.
Implements:
Definition at line 40 of file CSGNPolygonUnit.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.
Construct a new CSGNPolygonUnit.
| name | unique name of the unit |
| n_sides | number of sides of the regular polygon (must be >= 3) |
| apothem | distance from the center to the midpoint of each side |
Definition at line 17 of file CSGNPolygonUnit.C.
|
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::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 |
Return a deep copy of this unit.
Implements CSG::CSGSurfaceEngUnit.
Definition at line 109 of file CSGNPolygonUnit.h.
|
overridevirtual |
Evaluate the polygon's surface equation at the given point.
Returns the maximum signed plane-equation value over all N sides. A negative return value means the point lies inside the polygon; positive means outside; zero means on one of the sides.
This can be evaluated before expansion using the stored geometric parameters.
| p | point to evaluate |
Implements CSG::CSGSurfaceEngUnit.
Definition at line 27 of file CSGNPolygonUnit.C.
|
overrideprotectedvirtual |
Create N CSGPlane surfaces in _internal_base, one per polygon side.
Stores const pointers to the registered surfaces for use in getExpandedRegion().
Implements CSG::CSGSurfaceEngUnit.
Definition at line 57 of file CSGNPolygonUnit.C.
|
protectedinherited |
Friends for unit testing.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Friends for unit testing.
|
private |
|
protectedinherited |
|
private |
|
protectedinherited |
Friends for unit testing.
|
inline |
Get the polygon apothem (center-to-flat distance)
Definition at line 87 of file CSGNPolygonUnit.h.
|
overridevirtual |
Return the polygon attributes for this object.
Implements CSG::CSGEngUnit.
Definition at line 51 of file CSGNPolygonUnit.C.
|
inlineprotectedinherited |
Get the internal CSGBase owned by this engineering unit.
Definition at line 117 of file CSGEngUnit.h.
|
inlineinherited |
Get the behavior of this engineering unit (surface (i.e.
region), cell, or universe).
Returns "SURFACE", "CELL", or "UNIVERSE" depending on which intermediate EngUnit class the concrete type derives from. Set automatically at construction.
Definition at line 56 of file CSGEngUnit.h.
Referenced by CSG::CSGEngUnit::operator==().
|
overridevirtualinherited |
Always throws – coefficients are not defined for a surface engineering unit.
A surface engineering unit is described by its attributes (see getAttributes()), not by surface-equation coefficients, so this inherited CSGSurface method has no meaningful value on a unit. Expansion does not make it callable either: CSGBase::expandEngUnit() replaces the unit with plain CSGSurface object(s), and getCoeffs() is valid on those resulting surfaces, never on the unit itself.
The override exists only to satisfy the pure-virtual CSGSurface::getCoeffs()
Implements CSG::CSGSurface.
Definition at line 21 of file CSGSurfaceEngUnit.C.
|
protectedinherited |
Return the CSGRegion formed by the expanded CSGSurfaces.
Checks that expandUnit() has already been called (via _expanded_region) before returning the stored result. Throws if called before expansion.
Definition at line 30 of file CSGSurfaceEngUnit.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.
|
inlineoverridevirtualinherited |
Satisfy CSGEngUnit::getName() – resolved via CSGSurface::getName()
Implements CSG::CSGEngUnit.
Definition at line 81 of file CSGSurfaceEngUnit.h.
Referenced by CSG::CSGBase::expandEngUnit(), expandUnit(), CSG::CSGSurfaceEngUnit::getCoeffs(), and CSG::CSGSurfaceEngUnit::getExpandedRegion().
|
inline |
Get the number of sides for the polygon.
Definition at line 80 of file CSGNPolygonUnit.h.
|
inline |
Get the the circumradius for the polygon (center-to-vertex distance)
Definition at line 101 of file CSGNPolygonUnit.h.
|
inline |
Get the polygon side length.
Definition at line 94 of file CSGNPolygonUnit.h.
|
inlineinherited |
Get the Surface Type.
Definition at line 53 of file CSGSurface.h.
Referenced by CSG::CSGSurface::operator==().
|
inlineoverridevirtualinherited |
Delegate to CSGSurface (CSGTransformationHelper)
Implements CSG::CSGEngUnit.
Definition at line 92 of file CSGSurfaceEngUnit.h.
|
inlineoverridevirtualinherited |
Delegate to CSGSurface (CSGTransformationHelper)
Implements CSG::CSGEngUnit.
Definition at line 99 of file CSGSurfaceEngUnit.h.
|
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().
|
inlineinherited |
Get the type name of this engineering unit.
Definition at line 63 of file CSGEngUnit.h.
Referenced by CSG::CSGCellEngUnit::getExpandedCell(), CSG::CSGUniverseEngUnit::getExpandedUniverse(), and CSG::CSGEngUnit::operator==().
|
inlineoverridevirtualinherited |
Engineering units report true so comparisons can skip the dynamic_cast fast path.
Reimplemented from CSG::CSGSurface.
Definition at line 84 of file CSGSurfaceEngUnit.h.
|
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().
|
inlineinherited |
Definition at line 88 of file CSGSurfaceEngUnit.h.
|
inherited |
Operator overload for checking if two CSGEngUnit objects are not equal.
Definition at line 50 of file CSGEngUnit.C.
Referenced by CSG::CSGCellEngUnit::operator!=(), CSG::CSGUniverseEngUnit::operator!=(), and CSG::CSGSurfaceEngUnit::operator!=().
|
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 CSGEngUnit objects are equal.
Definition at line 34 of file CSGEngUnit.C.
Referenced by CSG::CSGCellEngUnit::operator==(), CSG::CSGUniverseEngUnit::operator==(), and CSG::CSGSurfaceEngUnit::operator==().
|
inlineinherited |
Disambiguate == and != by forwarding to CSGEngUnit (name/property-based comparison)
Definition at line 87 of file CSGSurfaceEngUnit.h.
|
inherited |
Operator overload for checking if two CSGSurface objects are equal.
Definition at line 45 of file CSGSurface.C.
|
protectedinherited |
Transfer ownership of the internal CSGBase out of this unit.
Called once by CSGBase::expandEngUnit() to join the internal base into the parent. After this call _internal_base is null.
Definition at line 28 of file CSGEngUnit.C.
|
inlineprotectedinherited |
Definition at line 119 of file CSGSurface.h.
|
private |
Distance from the polygon center to the midpoint of each side.
Definition at line 126 of file CSGNPolygonUnit.h.
Referenced by clone(), CSGNPolygonUnit(), evaluateSurfaceEquationAtPoint(), expandUnit(), getApothem(), getAttributes(), getRadius(), and getSideLength().
|
protectedinherited |
The basic CSG type this unit produces: "SURFACE", "CELL", or "UNIVERSE".
Definition at line 133 of file CSGEngUnit.h.
Referenced by CSG::CSGEngUnit::CSGEngUnit(), and CSG::CSGEngUnit::getBehavior().
|
protectedinherited |
Stores the result of expandUnit(); EMPTY until then.
Definition at line 129 of file CSGSurfaceEngUnit.h.
Referenced by expandUnit(), and CSG::CSGSurfaceEngUnit::getExpandedRegion().
|
protectedinherited |
CSGBase populated by expandUnit(); joined into the parent CSGBase by expandEngUnit()
Definition at line 130 of file CSGEngUnit.h.
Referenced by expandUnit(), CSG::CSGEngUnit::getBase(), CSG::CSGCellEngUnit::getExpandedCell(), CSG::CSGUniverseEngUnit::getExpandedUniverse(), and CSG::CSGEngUnit::releaseBase().
|
private |
Number of sides of the regular polygon.
Definition at line 123 of file CSGNPolygonUnit.h.
Referenced by clone(), CSGNPolygonUnit(), evaluateSurfaceEquationAtPoint(), expandUnit(), getAttributes(), getNumSides(), getRadius(), and getSideLength().
|
protectedinherited |
Name of surface.
Definition at line 122 of file CSGSurface.h.
Referenced by CSG::CSGXCylinder::clone(), CSG::CSGZCylinder::clone(), CSG::CSGYCylinder::clone(), CSG::CSGSphere::clone(), CSG::CSGPlane::clone(), clone(), CSG::CSGSurface::getHalfspaceFromPoint(), CSG::CSGSurface::getName(), and CSG::CSGSurface::setName().
|
private |
Pointers to the expanded plane surfaces, populated during expandUnit()
Definition at line 129 of file CSGNPolygonUnit.h.
|
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().
1.8.14