78 return distSqr > 0._f;
91 if (!vertexInsideSphere(box.
lower())) {
103 if (!vertexInsideSphere(box.
upper())) {
#define SPH_ASSERT(x,...)
Object representing a three-dimensional axis-aligned box.
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
constexpr INLINE T max(const T &f1, const T &f2)
constexpr INLINE T sqr(const T &f) noexcept
Return a squared value.
constexpr INLINE Float sphereVolume(const Float radius)
Computes a volume of a sphere given its radius.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
@ INTERESECTION
Sphere intersects the box.
@ BOX_INSIDE_SPHERE
Sphere contains the whole box.
@ BOX_OUTSIDE_SPHERE
Sphere has no intersection with the box.
INLINE Float getSqrLength(const Vector &v)
BasicVector< Float > Vector
Helper object defining three-dimensional interval (box).
INLINE const Vector & lower() const
Returns lower bounds of the box.
INLINE const Vector & upper() const
Returns upper bounds of the box.
INLINE Vector size() const
Returns box dimensions.
static Box EMPTY()
Syntactic sugar, returns a default-constructed (empty) box.
INLINE Box getBBox() const
INLINE bool overlaps(const Box &box) const
Checks whether the sphere partially or fully overlaps given box.
INLINE IntersectResult intersectsBox(const Box &box) const
Checks the intersection of the sphere with a box.
INLINE Vector center() const
INLINE bool contains(const Vector &v) const
Sphere()=default
Creates an uninitialized sphere.
INLINE Float radius() const
INLINE Float volume() const
Sphere(const Vector ¢er, const Float radius)
Creates a sphere given its center and radius.
INLINE bool intersects(const Sphere &other) const
Checks if the sphere intersects another sphere.