Celeritas 0.6.0-67+develop.47f47c88
|
A convex/concave polygon extruded along a polyline, with scaling. More...
#include <StackedExtrudedPolygon.hh>
Public Types | |
Type aliases | |
using | SPConstObject = std::shared_ptr< ObjectInterface const > |
using | VecReal = std::vector< real_type > |
using | VecReal2 = std::vector< Real2 > |
using | VecReal3 = std::vector< Real3 > |
![]() | |
using | SPConstObject = std::shared_ptr< ObjectInterface const > |
using | VolumeBuilder = detail::VolumeBuilder |
Public Member Functions | |
StackedExtrudedPolygon (std::string &&label, VecReal2 &&polygon, VecReal3 &&polyline, VecReal &&scaling) | |
Construct from a polygon, polyline, and scaling factors. | |
std::string_view | label () const final |
Get the user-provided label. | |
NodeId | build (VolumeBuilder &) const final |
Construct a volume from this object. | |
void | output (JsonPimpl *) const final |
Write the shape to JSON. | |
VecReal2 const & | polygon () const |
Get the polygon. | |
VecReal3 const & | polyline () const |
Get the polyline. | |
VecReal const & | scaling () const |
Get the scaling factors. | |
![]() | |
virtual | ~ObjectInterface ()=0 |
Anchored default destructor. | |
Static Public Member Functions | |
static SPConstObject | or_solid (std::string &&label, VecReal2 &&polygon, VecReal3 &&polyline, VecReal &&scaling) |
Construct, or return an ExtrudedPolygon shape if possible. | |
Additional Inherited Members | |
![]() | |
CELER_DEFAULT_COPY_MOVE (ObjectInterface) | |
A convex/concave polygon extruded along a polyline, with scaling.
The polygon must be specified in clockwise order. The polyline must be strictly monotonically increasing in z. Scaling factors can be any positive value. Scaling is assumed to occur with respect to the polygon's original coordinate system.
Construction is performed using a convex decomposition approach (tor-convexdecomp-1984). The convex hull of the polygon is first found, then extruded along the polyline (with scaling) form a stack of ExtrudedPolygon shapes. Regions that constitute the difference between the polygon and its convex hull are then subtracted. Each of these regions is created recursively in the same fashion, i.e. finding the convex hull and creating a stack.
Because this method creates many regions, these are kept track of using three indices for debugging purposes: level, stack, and segment. The level index denotes the current recursion depth. The stack index denotes the convex region which is extruded into a stack on a given level. The segment index denotes the z segment within the stack. An example of these indices is shown below. Consider the following polygon, extruded along a single-segment polyline:
__________ | | ___| | | | | | | | | __| | | |___________|
The convex hull of this polygon is used to create the first region:
__________ / | / | | level 0 | | stack 0 | | segment 0 | | | | / |___________/
Recursing one level deeper, we create two additional regions:
........... /| level 1, stack 0, segment 0 /__| . . . . . . . . ___. . | / level 1, stack 1, segment 0 ...........|/
and subtract their union from the first region.
When labeing nodes in the CSG output, the following shorthand format is used: label@level.stack.segment
. For example, the final region in the example above might be named my_shape@1.1.0
. For each level, additional nodes are created in the form: label@level.suffix
where suffixes have the following meanings: 1) .cu : the union of all convex regions on this level, 2) .ncu : the negation of the union of all convex regions on this level, 3) .d : the difference between this level's convex hull and the convex regions on this level.
|
finalvirtual |
Construct a volume from this object.
Construct a volume from this shape.
Implements celeritas::orangeinp::ObjectInterface.
|
inlinefinalvirtual |
Get the user-provided label.
Implements celeritas::orangeinp::ObjectInterface.
|
static |
Construct, or return an ExtrudedPolygon shape if possible.
Construct, or return an ExtrudedPolygon if possible.
Write the shape to JSON.
Implements celeritas::orangeinp::ObjectInterface.