11#ifndef EBGEOMETRY_ANALYTICDISTANCEFUNCTIONS_HPP
12#define EBGEOMETRY_ANALYTICDISTANCEFUNCTIONS_HPP
44 static_assert(std::is_floating_point_v<T>,
"PlaneSDF<T>: T must be a floating-point type");
70 m_normal = a_normal / a_normal.length();
140 static_assert(std::is_floating_point_v<T>,
"SphereSDF<T>: T must be a floating-point type");
272 static_assert(std::is_floating_point_v<T>,
"BoxSDF<T>: T must be a floating-point type");
427 static_assert(std::is_floating_point_v<T>,
"TorusSDF<T>: T must be a floating-point type");
593 static_assert(std::is_floating_point_v<T>,
"CylinderSDF<T>: T must be a floating-point type");
700 T
d = std::numeric_limits<T>::infinity();
714 constexpr T
zero = T(0.0);
718 d = (std::abs(
w) < std::abs(
h)) ?
w :
h;
729 d = std::sqrt(
w *
w +
h *
h);
780 static_assert(std::is_floating_point_v<T>,
"InfiniteCylinderSDF<T>: T must be a floating-point type");
895 static_assert(std::is_floating_point_v<T>,
"CapsuleSDF<T>: T must be a floating-point type");
1021 static_assert(std::is_floating_point_v<T>,
"InfiniteConeSDF<T>: T must be a floating-point type");
1096 const T
d2 =
d1 * ((
q.x *
m_c.y -
q.y *
m_c.x < T(0.0)) ? T(-1.0) : T(1.0));
1128 static_assert(std::is_floating_point_v<T>,
"ConeSDF<T>: T must be a floating-point type");
1207 constexpr T
zero = T(0.0);
1208 constexpr T
one = T(1.0);
1215 auto sign = [](
const T& x) ->
int {
return (x >
zero) - (x <
zero); };
1219 const T
s = std::max(
k * (
w.x *
q.y -
w.y *
q.x),
k * (
w.y -
q.y));
1221 return std::sqrt(
d) *
sign(
s);
1254 static_assert(std::is_floating_point_v<T>,
"RoundedBoxSDF<T>: T must be a floating-point type");
1361 static_assert(std::is_floating_point_v<T>,
"PerlinSDF<T>: T must be a floating-point type");
1393 for (
int i = 0;
i < 256;
i++) {
1470 template <
class URNG>
1475 for (
unsigned int i = 0;
i < 256;
i++) {
1481 for (
int i = 0;
i < 256;
i++) {
1490 std::array<int, 512>&
1504 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142,
1505 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203,
1506 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165,
1507 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41,
1508 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89,
1509 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250,
1510 124, 123, 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189,
1511 28, 42, 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9,
1512 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228, 251, 34,
1513 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, 14, 239, 107, 49, 192, 214, 31,
1514 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, 93, 222, 114,
1515 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180};
1552 lerp(
const T
t,
const T
a,
const T
b)
const noexcept
1554 return a +
t * (
b -
a);
1565 return t *
t *
t * (
t * (
t * 6 - 15) + 10);
1577 grad(
const int hash,
const T x,
const T y,
const T
z)
const noexcept
1579 const int h =
hash & 15;
1580 const T
u =
h < 8 ? x : y;
1581 const T
v =
h < 4 ? y :
h == 12 ||
h == 14 ? x :
z;
1582 return ((
h & 1) == 0 ?
u : -
u) + ((
h & 2) == 0 ?
v : -
v);
1594 const int X =
static_cast<int>(std::floor(
a_point[0])) & 255;
1595 const int Y =
static_cast<int>(std::floor(
a_point[1])) & 255;
1596 const int Z =
static_cast<int>(std::floor(
a_point[2])) & 255;
1604 const T
u =
fade(x);
1605 const T
v =
fade(y);
1655 static_assert(std::is_floating_point_v<T>,
"RoundedCylinderSDF<T>: T must be a floating-point type");
1730 const auto d2 =
Vec2T<T>(std::max(
d1.x, T(0)), std::max(
d1.y, T(0)));
Declarations of bounding volume types used in bounding volume hierarchies.
Mathematical constants for EBGeometry.
Utility macros for EBGeometry.
#define EBGEOMETRY_EXPECT(cond)
Runtime precondition assertion for EBGeometry.
Definition EBGeometry_Macros.hpp:62
Abstract base class for representing a signed distance function.
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
Signed distance field for an axis-aligned box (AABB).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:271
BoxSDF & operator=(const BoxSDF &)=default
Copy assignment.
BoxSDF()=default
Default constructor. Constructs a unit cube centered at the origin: [-0.5, 0.5]^3.
~BoxSDF() override=default
Destructor.
BoxSDF(const BoxSDF &)=default
Copy constructor.
Vec3T< T > m_loCorner
Low box corner.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:405
T signedDistance(const Vec3T< T > &a_point) const noexcept override
Signed distance function for the axis-aligned box.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:377
Vec3T< T > & getHighCorner() noexcept
Get upper-right corner.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:366
Vec3T< T > & getLowCorner() noexcept
Get lower-left corner.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:346
BoxSDF & operator=(BoxSDF &&)=default
Move assignment.
const Vec3T< T > & getHighCorner() const noexcept
Get upper-right corner.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:356
const Vec3T< T > & getLowCorner() const noexcept
Get lower-left corner.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:336
Vec3T< T > m_hiCorner
High box corner.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:410
BoxSDF(BoxSDF &&)=default
Move constructor.
BoxSDF(const Vec3T< T > &a_loCorner, const Vec3T< T > &a_hiCorner) noexcept
Full constructor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:286
Signed distance field for a capsule (pill shape): a cylinder capped with hemispheres.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:894
T signedDistance(const Vec3T< T > &a_point) const noexcept override
Signed distance function for the capsule.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:970
CapsuleSDF & operator=(const CapsuleSDF &)=default
Copy assignment.
Vec3T< T > m_center2
Center of the other hemispherical cap.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:995
CapsuleSDF()=default
Default constructor. Constructs a capsule with tips at (0,-1,0) and (0,1,0), radius 0....
~CapsuleSDF() override=default
Destructor.
CapsuleSDF(const CapsuleSDF &)=default
Copy constructor.
CapsuleSDF & operator=(CapsuleSDF &&)=default
Move assignment.
T m_radius
Capsule radius.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1000
CapsuleSDF(const Vec3T< T > &a_tip1, const Vec3T< T > &a_tip2, const T &a_radius) noexcept
Full constructor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:916
CapsuleSDF(CapsuleSDF &&)=default
Move constructor.
Vec3T< T > m_center1
Center of one hemispherical cap.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:990
Signed distance field for a finite cone.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1127
ConeSDF()=default
Default constructor. Constructs a finite cone with its tip at the origin, height 1,...
Vec3T< T > m_tip
Tip position.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1228
ConeSDF & operator=(ConeSDF &&)=default
Move assignment.
ConeSDF & operator=(const ConeSDF &)=default
Copy assignment.
ConeSDF(ConeSDF &&)=default
Move constructor.
T m_height
Cone height (tip to base).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1238
ConeSDF(const Vec3T< T > &a_tip, const T &a_height, const T &a_angle) noexcept
Full constructor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1143
~ConeSDF() override=default
Destructor.
T signedDistance(const Vec3T< T > &a_point) const noexcept override
Signed distance function for the finite cone.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1195
ConeSDF(const ConeSDF &)=default
Copy constructor.
Vec2T< T > m_c
(sin, cos) of the half opening-angle. Default: 45° full angle → half-angle 22.5°.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1233
Signed distance field for a finite, flat-capped cylinder.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:592
T signedDistance(const Vec3T< T > &a_point) const noexcept override
Signed distance function for the cylinder.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:694
T m_length
Distance between the two endpoints.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:760
Vec3T< T > m_center1
One endpoint (cap center).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:740
const Vec3T< T > & getCenter2() const noexcept
Get the other endpoint.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:673
Vec3T< T > m_center2
Other endpoint (cap center).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:745
CylinderSDF(const Vec3T< T > &a_center1, const Vec3T< T > &a_center2, const T &a_radius) noexcept
Full constructor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:608
CylinderSDF()=default
Default constructor. Constructs a unit cylinder of radius 1 and height 1, centred at the origin with ...
CylinderSDF(const CylinderSDF &)=default
Copy constructor.
Vec3T< T > m_center
Midpoint of m_center1 and m_center2.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:750
const T & getRadius() const noexcept
Get radius.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:683
Vec3T< T > m_axis
Unit axis pointing from m_center1 to m_center2.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:755
const Vec3T< T > & getCenter1() const noexcept
Get one endpoint.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:663
~CylinderSDF() override=default
Destructor.
T m_radius
Cylinder radius.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:765
CylinderSDF(CylinderSDF &&)=default
Move constructor.
CylinderSDF & operator=(CylinderSDF &&)=default
Move assignment.
CylinderSDF & operator=(const CylinderSDF &)=default
Copy assignment.
Signed distance field for an infinite cone.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1020
InfiniteConeSDF(const InfiniteConeSDF &)=default
Copy constructor.
InfiniteConeSDF()=default
Default constructor. Constructs an infinite cone with tip at the origin, 45° full opening angle,...
Vec3T< T > m_tip
Tip position.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1105
Vec2T< T > m_c
(sin, cos) of the half opening-angle. Default: 45° full angle → half-angle 22.5°.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1110
InfiniteConeSDF(const Vec3T< T > &a_tip, const T &a_angle) noexcept
Full constructor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1036
InfiniteConeSDF(InfiniteConeSDF &&)=default
Move constructor.
T signedDistance(const Vec3T< T > &a_point) const noexcept override
Signed distance function for the infinite cone.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1085
~InfiniteConeSDF() override=default
Destructor.
InfiniteConeSDF & operator=(InfiniteConeSDF &&)=default
Move assignment.
InfiniteConeSDF & operator=(const InfiniteConeSDF &)=default
Copy assignment.
Signed distance field for an infinitely long cylinder.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:779
T m_radius
Cylinder radius.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:867
InfiniteCylinderSDF & operator=(const InfiniteCylinderSDF &)=default
Copy assignment.
InfiniteCylinderSDF(const Vec3T< T > &a_center, const T &a_radius, const size_t a_axis) noexcept
Full constructor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:795
InfiniteCylinderSDF(const InfiniteCylinderSDF &)=default
Copy constructor.
Vec3T< T > m_center
Center point on the cylinder axis.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:862
T signedDistance(const Vec3T< T > &a_point) const noexcept override
Signed distance function for the infinite cylinder.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:844
InfiniteCylinderSDF(InfiniteCylinderSDF &&)=default
Move constructor.
InfiniteCylinderSDF()=default
Default constructor. Constructs an infinite cylinder of radius 1 centred at the origin with its axis ...
size_t m_axis
Coordinate axis index (0 = x, 1 = y, 2 = z).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:872
~InfiniteCylinderSDF() override=default
Destructor.
InfiniteCylinderSDF & operator=(InfiniteCylinderSDF &&)=default
Move assignment.
Ken Perlin's gradient-noise implicit function.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1360
PerlinSDF(const T a_noiseAmplitude, const Vec3T< T > a_noiseFrequency, const T a_noisePersistence, const unsigned int a_noiseOctaves) noexcept
Full constructor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1377
unsigned int m_noiseOctaves
Number of noise octaves.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1542
PerlinSDF()=default
Default constructor. Constructs a single-octave Perlin noise field with unit amplitude,...
Vec3T< T > m_noiseFrequency
Spatial noise frequency along each Cartesian axis.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1520
PerlinSDF & operator=(const PerlinSDF &)=default
Copy assignment.
PerlinSDF(const PerlinSDF &)=default
Copy constructor.
std::array< int, 512 > & getPermutationTable() noexcept
Get the internal permutation table.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1491
static constexpr std::array< int, 256 > s_perlinPermutationTable
Ken Perlin's original 256-entry permutation table.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1503
T noise(const Vec3T< T > &a_point) const noexcept
Single-octave Perlin noise evaluation.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1591
T grad(const int hash, const T x, const T y, const T z) const noexcept
Ken Perlin's gradient hash function.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1577
PerlinSDF(PerlinSDF &&)=default
Move constructor.
std::array< int, 512 > m_permutationTable
Integer hash permutation table (512 entries: [0..255] mirrored).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1537
PerlinSDF & operator=(PerlinSDF &&)=default
Move assignment.
virtual T fade(const T t) const noexcept
Ken Perlin's fade (smoothstep) function: 6t^5 - 15t^4 + 10t^3.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1563
~PerlinSDF() override=default
Destructor.
T m_noiseAmplitude
Noise amplitude (output scale).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1525
T m_noisePersistence
Per-octave amplitude decay factor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1530
virtual T lerp(const T t, const T a, const T b) const noexcept
Ken Perlin's linear interpolation helper.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1552
void shuffle(URNG &g) noexcept
Shuffle the permutation table with the provided uniform random number generator.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1472
T signedDistance(const Vec3T< T > &a_point) const noexcept override
Signed distance function. Generates a noise value on [0, m_noiseAmplitude].
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1437
Signed distance function for a plane.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:43
PlaneSDF()=default
Default constructor. Constructs the y = 0 plane with outward normal (0, 1, 0).
PlaneSDF(const Vec3T< T > &a_point, const Vec3T< T > &a_normal) noexcept
Full constructor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:59
T signedDistance(const Vec3T< T > &a_point) const noexcept override
Signed distance function for the plane.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:108
~PlaneSDF() override=default
Destructor.
PlaneSDF(const PlaneSDF &)=default
Copy constructor.
PlaneSDF & operator=(PlaneSDF &&)=default
Move assignment.
PlaneSDF(PlaneSDF &&)=default
Move constructor.
Vec3T< T > m_point
Point on plane.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:122
Vec3T< T > m_normal
Plane normal vector (unit length).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:127
PlaneSDF & operator=(const PlaneSDF &)=default
Copy assignment.
Signed distance field for an axis-aligned box with rounded corners.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1253
T signedDistance(const Vec3T< T > &a_point) const noexcept override
Signed distance function for the rounded box.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1320
RoundedBoxSDF()=default
Default constructor. Constructs a rounded unit cube centered at the origin ([-0.5,...
RoundedBoxSDF(const Vec3T< T > &a_dimensions, const T a_curvature) noexcept
Full constructor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1270
RoundedBoxSDF & operator=(RoundedBoxSDF &&)=default
Move assignment.
~RoundedBoxSDF() override=default
Destructor.
RoundedBoxSDF(const RoundedBoxSDF &)=default
Copy constructor. Shares the internal sphere object.
Vec3T< T > m_dimensions
Half-extents of the inner box (= 0.5 * the user-supplied dimensions).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1338
std::shared_ptr< SphereSDF< T > > m_sphere
Sphere of radius = curvature used to round the corners.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1333
RoundedBoxSDF(RoundedBoxSDF &&)=default
Move constructor.
RoundedBoxSDF & operator=(const RoundedBoxSDF &)=default
Copy assignment. Shares the internal sphere object.
Signed distance field for a cylinder with rounded (toroidal) edges.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1654
RoundedCylinderSDF(RoundedCylinderSDF &&)=default
Move constructor.
RoundedCylinderSDF(const T a_radius, const T a_curvature, const T a_height) noexcept
Full constructor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1671
RoundedCylinderSDF & operator=(RoundedCylinderSDF &&)=default
Move assignment.
RoundedCylinderSDF(const RoundedCylinderSDF &)=default
Copy constructor.
T m_height
Inner half-height (= 0.5*height - curvature).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1749
RoundedCylinderSDF & operator=(const RoundedCylinderSDF &)=default
Copy assignment.
T signedDistance(const Vec3T< T > &a_point) const noexcept override
Signed distance function for the rounded cylinder.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1722
T m_majorRadius
Inner cylinder radius (= outer radius - curvature).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1739
T m_minorRadius
Edge rounding radius (= curvature).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1744
RoundedCylinderSDF()=default
Default constructor. Constructs a rounded cylinder centred at the origin, axis along y,...
~RoundedCylinderSDF() override=default
Destructor.
Abstract representation of a signed distance function.
Definition EBGeometry_SignedDistanceFunction.hpp:34
Signed distance field for a sphere.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:139
Vec3T< T > & getCenter() noexcept
Get sphere center (mutable).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:209
SphereSDF()=default
Default constructor. Constructs a unit sphere centered at the origin.
~SphereSDF() override=default
Destructor.
SphereSDF & operator=(SphereSDF &&)=default
Move assignment.
SphereSDF & operator=(const SphereSDF &)=default
Copy assignment.
const Vec3T< T > & getCenter() const noexcept
Get sphere center (const).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:199
Vec3T< T > m_center
Sphere center.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:253
T m_radius
Sphere radius.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:258
const T & getRadius() const noexcept
Get sphere radius (const).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:219
SphereSDF(SphereSDF &&)=default
Move constructor.
T signedDistance(const Vec3T< T > &a_point) const noexcept override
Signed distance function for the sphere.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:240
SphereSDF(const SphereSDF &)=default
Copy constructor.
T & getRadius() noexcept
Get sphere radius (mutable).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:229
SphereSDF(const Vec3T< T > &a_center, const T &a_radius) noexcept
Full constructor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:153
Signed distance field for a torus.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:426
TorusSDF & operator=(const TorusSDF &)=default
Copy assignment.
T m_minorRadius
Minor (tube) radius.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:578
Vec3T< T > & getCenter() noexcept
Get torus center.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:501
T m_majorRadius
Major (ring) radius.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:573
TorusSDF(const Vec3T< T > &a_center, const T &a_majorRadius, const T &a_minorRadius) noexcept
Full constructor.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:441
const T & getMinorRadius() const noexcept
Get minor radius.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:531
TorusSDF(TorusSDF &&)=default
Move constructor.
TorusSDF(const TorusSDF &)=default
Copy constructor.
~TorusSDF() override=default
Destructor.
const T & getMajorRadius() const noexcept
Get major radius.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:511
T & getMajorRadius() noexcept
Get major radius.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:521
Vec3T< T > m_center
Torus center.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:568
T signedDistance(const Vec3T< T > &a_point) const noexcept override
Signed distance function for the torus.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:551
TorusSDF & operator=(TorusSDF &&)=default
Move assignment.
T & getMinorRadius() noexcept
Get minor radius.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:541
TorusSDF()=default
Default constructor. Constructs a torus centered at the origin with major radius 1 and minor radius 0...
const Vec3T< T > & getCenter() const noexcept
Get torus center.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:491
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:225
constexpr T length() const noexcept
Compute vector length.
size_t maxDir(const bool a_doAbs) const noexcept
Return the direction which has the largest component (can be absolute)
static constexpr Vec3T< T > zeros() noexcept
Return a vector with x = y = z = 0.
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:31
constexpr Vec3T< T > clamp(const Vec3T< T > &v, const Vec3T< T > &lo, const Vec3T< T > &hi) noexcept
Component-wise clamp of a 3D vector.
T length(const Vec2T< T > &v) noexcept
Euclidean length of a 2D vector.
T dot(const Vec2T< T > &u, const Vec2T< T > &v) noexcept
Dot product of two 2D vectors.
Vec2T< T > max(const Vec2T< T > &u, const Vec2T< T > &v) noexcept
Component-wise maximum of two vectors.