geomc 1.0
A c++ linear algebra template library
|
An N-dimensional circle, sphere, or hypersphere with a filled interior. More...
#include <geomc/shape/Sphere.h>
Public Types | |
using | elem_t |
The coordinate type of this object. | |
using | point_t |
The type of a point in this object's space. | |
Public Member Functions | |
constexpr | Sphere () |
constexpr | Sphere (const point_t &c, T r) |
constexpr | Sphere (T r) |
Rect< T, N > | bounds () const |
Vec< T, N > | clip (Vec< T, N > p) const |
Nearest point on the interior of the shape. | |
bool | contains (point_t p) const |
Shape-point intersection test. | |
point_t | convex_support (point_t d) const |
Rect< T, 1 > | intersect (const Ray< T, N > &ray) const |
Shape-ray intersection test. | |
bool | intersects (const Convex< T, N, Shape > &other) const |
Convex shape overlap test. | |
bool | intersects (const Rect< T, N > &rect) const |
bool | intersects (Sphere s) const |
T | measure_boundary () const |
Measure the boundary of the shape. | |
T | measure_interior () const |
Measure the interior (volume) of the shape. | |
point_t | normal (point_t p) const |
Outward-facing direction. | |
bool | operator== (const Sphere &other) const |
point_t | project (point_t p) const |
T | sdf (point_t p) const |
Signed distance function. | |
Static Public Member Functions | |
static constexpr bool | admits_cusps () |
Public Attributes | |
point_t | center |
Center of the sphere. | |
T | r |
Radius of the sphere. | |
Static Public Attributes | |
static constexpr index_t | N |
The dimension of this object. | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename T> | |
using | Circle = Sphere<T,2> |
A 2D circle. | |
An N-dimensional circle, sphere, or hypersphere with a filled interior.
|
inherited |
The type of a point in this object's space.
An N-vector of T if N > 1, otherwise a T.
|
inlineconstexpr |
Construct a sphere at the origin with radius 1.
|
inlineconstexpr |
Construct a sphere with center at the origin, having radius r
.
r | Radius of spehre. |
Construct a sphere with center at the point c
, having radius r
.
c | Center of sphere. |
r | Radius of spehre. |
Nearest point on the interior of the shape.
If p
is on the interior of the shape, return p
unaltered; otherwise orthogonally project p
to the shape's surface.
Convex shape overlap test.
other
; false otherwise. Sphere-sphere intersection test.
s | Another sphere. |
true
if s
overlaps with this sphere's volume, false otherwise.
|
inline |
Measure the boundary of the shape.
If the sphere is 2D (a circle), this is the circumference of the circle. If the sphere is 3D (a sphere), this is the surface area of the sphere. In higher dimensions, this is the volume or hypervolume of the boundary.
|
inline |
Measure the interior (volume) of the shape.
If the sphere is 2D (a disk), this is the area of the disk. If the sphere is 3D (a ball), this is the volume of the ball. In higher dimensions, this is the hypervolume.
Return the point p
orthogonally projected onto the surface of the shape.