Signed distance field for a regular prism: a regular polygon of n sides, extruded between two end centers.
More...
|
|
| PolygonPrismSDF ()=default |
| | Default constructor. Constructs a hexagonal prism from (0,-0.5,0) to (0,0.5,0), of circumradius 1, with a vertex along x.
|
| |
| | PolygonPrismSDF (const Vec3T< T > &a_center1, const Vec3T< T > &a_center2, const T a_radius, const unsigned a_sides, const Vec3T< T > &a_vertexDirection) |
| | Full constructor.
|
| |
|
| PolygonPrismSDF (const PolygonPrismSDF &)=default |
| | Copy constructor.
|
| |
|
| PolygonPrismSDF (PolygonPrismSDF &&)=default |
| | Move constructor.
|
| |
| PolygonPrismSDF & | operator= (const PolygonPrismSDF &)=default |
| | Copy assignment.
|
| |
| PolygonPrismSDF & | operator= (PolygonPrismSDF &&)=default |
| | Move assignment.
|
| |
| const Vec3T< T > & | getCenter1 () const noexcept |
| | Get the center of one end.
|
| |
| const Vec3T< T > & | getCenter2 () const noexcept |
| | Get the center of the other end.
|
| |
| const T & | getRadius () const noexcept |
| | Get the circumradius.
|
| |
| unsigned | getSides () const noexcept |
| | Get the number of sides.
|
| |
| const Vec3T< T > & | getVertexDirection () const noexcept |
| | Get the unit direction from the axis toward the first vertex, across the axis.
|
| |
| T | polygonDistance (const T a_u, const T a_v) const noexcept |
| | The signed distance to the polygon in the cross-section, at coordinates a_u along the vertex direction and a_v across it.
|
| |
| T | signedDistance (const Vec3T< T > &a_point) const noexcept |
| | Signed distance function for the prism.
|
| |
| uint32_t | getNumParts () const noexcept |
| | How many parts the shape has (see hasParts): the sides and the two caps, getSides() + 2.
|
| |
| uint32_t | closestPart (const Vec3T< T > &a_point) const noexcept |
| | The part whose term decides the value at a point (see hasParts): the side k from 0 to getSides() - 1, counted from the first vertex around the axis; then getSides() for the cap at the first center and getSides() + 1 for the one at the second.
|
| |
| BoundingVolumes::AABBT< T > | computeBoundingVolume () const noexcept |
| | The shape's axis-aligned bounding box.
|
| |
|
|
Vec3T< T > | m_center1 = Vec3T<T>(T(0), T(-0.5), T(0)) |
| | Center of one end.
|
| |
|
Vec3T< T > | m_center2 = Vec3T<T>(T(0), T(0.5), T(0)) |
| | Center of the other end.
|
| |
|
Vec3T< T > | m_axis = Vec3T<T>(T(0), T(1), T(0)) |
| | Unit axis from m_center1 to m_center2.
|
| |
|
Vec3T< T > | m_vertex = Vec3T<T>(T(1), T(0), T(0)) |
| | Unit direction from the axis toward the first vertex.
|
| |
|
Vec3T< T > | m_side = Vec3T<T>(T(0), T(0), T(-1)) |
| | Unit direction across the axis and m_vertex, cross(m_axis, m_vertex).
|
| |
|
T | m_length = T(1) |
| | Distance between the end centers.
|
| |
|
T | m_radius = T(1) |
| | Circumradius.
|
| |
|
unsigned | m_sides = 6U |
| | Number of sides.
|
| |
template<class T>
class EBGeometry::PolygonPrismSDF< T >
Signed distance field for a regular prism: a regular polygon of n sides, extruded between two end centers.
The polygon's circumradius (the distance from the axis to a vertex) is the radius given, and one vertex points along the given direction, across the axis. The distance is exact: in the cross-section, the point is turned into the polygon's first sector, where the distance to the regular polygon is that to one edge (Quilez's regular polygon), and the extrusion between the end planes is exact too. Three sides make a triangular prism, four a square one, six a hexagonal rod. Round its edges with Offset of a slightly smaller prism. By default the prism is a hexagonal one from (0,-0.5,0) to (0,0.5,0), of circumradius 1, with a vertex along x.
- Template Parameters
-
| T | Floating-point precision. |