43#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_AABB_3D_SPHERE_3D_H
44#define LASS_GUARDIAN_OF_INCLUSION_PRIM_AABB_3D_SPHERE_3D_H
61 const typename Sphere3D<T>::TPoint& c = sphere.center();
62 const typename Sphere3D<T>::TValue r = sphere.radius();
72template <
typename T,
typename MMP>
76 const typename Aabb3D<T, MMP>::TValue radius = box.
size().
norm() / 2;
85template <
typename T,
typename MMP>
88 typedef typename Sphere3D<T>::TVector TVector;
89 const TVector dist = pointwiseMax(aabb.min() - sphere.center(), sphere.center() - aabb.max());
90 return pointwiseMax(dist, TVector()).squaredNorm() <=
num::sqr(sphere.radius());
98template <
typename T,
typename MMP>
109template <
typename T,
typename MMP>
112 typedef typename Sphere3D<T>::TVector TVector;
113 const TVector dist = pointwiseMax(aabb.min() - sphere.center(), sphere.center() - aabb.max());
114 return pointwiseMax(dist, TVector()).squaredNorm() <
num::sqr(sphere.radius());
122template <
typename T,
typename MMP>
your momma's axis aligned bounding box.
const TVector size() const
Return size of bounding box per axis, max - min.
bool collides(const Aabb3D< T, MMP > &aabb, const Sphere3D< T > &sphere)
const TPointH center() const
bool intersects(const Aabb3D< T, MMP > &aabb, const Sphere3D< T > &sphere)
Sphere3D< T > boundingSphere(const Aabb3D< T, MMP > &box)
bool intersects(const Sphere3D< T > &sphere, const Aabb3D< T, MMP > &aabb)
Aabb3D< T > aabb(const Sphere3D< T > &sphere)
bool collides(const Sphere3D< T > &sphere, const Aabb3D< T, MMP > &aabb)
T sqr(const T &x)
return x * x
set of geometrical primitives
Library for Assembled Shared Sources.
const TPoint affine() const
Return rescaled version of point with weight = 1.
const TValue norm() const
Return norm of vector.