|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Signed distance field for a solid angle: the part of a ball inside a cone from its center, around +y. More...
#include <EBGeometry_AnalyticDistanceFunctions.hpp>
Public Member Functions | |
| SolidAngleSDF ()=default | |
| Default constructor. Constructs a solid angle at the origin, with radius 1 and an opening of 60 degrees. | |
| SolidAngleSDF (const Vec3T< T > &a_center, const T a_radius, const T a_angle) | |
| Full constructor. | |
| SolidAngleSDF (const SolidAngleSDF &)=default | |
| Copy constructor. | |
| SolidAngleSDF (SolidAngleSDF &&)=default | |
| Move constructor. | |
| SolidAngleSDF & | operator= (const SolidAngleSDF &)=default |
| Copy assignment. | |
| SolidAngleSDF & | operator= (SolidAngleSDF &&)=default |
| Move assignment. | |
| const Vec3T< T > & | getCenter () const noexcept |
| Get the center. | |
| const T & | getRadius () const noexcept |
| Get the radius. | |
| const T & | getAngle () const noexcept |
| Get the full opening angle, in degrees. | |
| T | signedDistance (const Vec3T< T > &a_point) const noexcept |
| Signed distance function for the solid angle. | |
| uint32_t | getNumParts () const noexcept |
| How many parts the shape has (see hasParts): 2, the spherical cap (0) and the cone's side (1). | |
| uint32_t | closestPart (const Vec3T< T > &a_point) const noexcept |
| The part whose term decides the value at a point (see hasParts): 0 the cap, 1 the cone's side. | |
| BoundingVolumes::AABBT< T > | computeBoundingVolume () const noexcept |
| The shape's axis-aligned bounding box: that of the ball. | |
Static Public Attributes | |
| static constexpr DistanceQuality | distanceQuality = DistanceQuality::Exact |
| How far signedDistance() can be trusted as a distance: the Euclidean distance to the surface. | |
Protected Member Functions | |
| void | terms (const Vec3T< T > &a_point, T &a_sphere, T &a_side) const noexcept |
| The two terms of the distance: to the sphere, and the signed distance to the cone's side segment. | |
Protected Attributes | |
| Vec3T< T > | m_center = Vec3T<T>::zeros() |
| Center. | |
| T | m_radius = T(1) |
| Radius. | |
| T | m_angle = T(60) |
| Full opening angle, in degrees. | |
| T | m_sin = T(0.5) |
| Sine of half the opening angle. | |
| T | m_cos = T(0.86602540378443865) |
| Cosine of half the opening angle. | |
Signed distance field for a solid angle: the part of a ball inside a cone from its center, around +y.
The cone has its tip at the ball's center and opens toward +y with the given full angle; above 180 degrees the solid is the ball less a cone opening toward -y. The distance is exact (Quilez's solid angle): in the cross-section through the axis, that to the arc or to the cone's side line. Turn it with Rotate. By default the solid angle is centered at the origin, with radius 1 and an opening of 60 degrees.
| T | Floating-point precision. |
|
inline |
Full constructor.
| [in] | a_center | The center of the ball, the cone's tip. |
| [in] | a_radius | The radius, finite and positive. |
| [in] | a_angle | The cone's full opening angle, in degrees, in (0, 360). |
|
inlinenoexcept |
The part whose term decides the value at a point (see hasParts): 0 the cap, 1 the cone's side.
| [in] | a_point | Position. |
|
inlinenoexcept |
The shape's axis-aligned bounding box: that of the ball.
|
inlinenoexcept |
Get the full opening angle, in degrees.
|
inlinenoexcept |
Get the center.
|
inlinenoexcept |
How many parts the shape has (see hasParts): 2, the spherical cap (0) and the cone's side (1).
|
inlinenoexcept |
Get the radius.
|
default |
Copy assignment.
|
default |
Move assignment.
|
inlinenoexcept |
Signed distance function for the solid angle.
| [in] | a_point | Position. |
|
inlineprotectednoexcept |
The two terms of the distance: to the sphere, and the signed distance to the cone's side segment.
| [in] | a_point | Position. |
| [out] | a_sphere | The signed distance to the sphere. |
| [out] | a_side | The distance to the side segment, from the center to the rim, negative inside the cone. |