33 template<
typename>
struct Box;
37 template<
typename Valtype>
40 typedef Valtype value_type;
51 Sphere( const
Position<Valtype>& center, Valtype radius ) noexcept;
70 bool Includes( Valtype x, Valtype y, Valtype z ) const noexcept;
89 template<typename Valtype>
90 bool operator==( const
Sphere<Valtype> a, const
Sphere<Valtype> b ) noexcept;
91 template<typename Valtype>
92 bool operator!=( const
Sphere<Valtype> a, const
Sphere<Valtype> b ) noexcept;
97 template<typename Valtype>
98 bool Intersecting( const
Sphere<Valtype>& sphereA, const
Sphere<Valtype>& sphereB ) noexcept;
100 template<typename Valtype,typename ValtypeT>
101 bool Intersecting( const
Sphere<Valtype>& sphere, const
VectorBundle<Valtype,ValtypeT>& ray ) noexcept;
105template<typename Valtype> inline
111template<
typename Valtype>
inline
114 r =
static_cast<Valtype
>(1);
117template<
typename Valtype>
inline
122template<
typename Valtype>
inline
127template<
typename Valtype>
inline
132template<
typename Valtype>
inline
134 return (pt -
c).Length() <
r;
137template<
typename Valtype>
inline
140 c.x -
r,
c.y -
r,
c.z -
r,
141 c.x +
r,
c.y +
r,
c.z +
r );
144template<
typename Valtype>
inline
146 Valtype a =
r / std::sqrt(3);
148 c.x - a,
c.y - a,
c.z - a,
149 c.x + a,
c.y + a,
c.z + a );
152template<
typename Valtype>
inline
154 return a.Center() == b.Center() && a.Radius() == b.Radius();
157template<
typename Valtype>
inline
162template<
typename Valtype>
164 return (sphereA.Center() - sphereB.Center()).Length() < sphereA.Radius() + sphereB.Radius();
167template<
typename Valtype,
typename ValtypeT>
170 return (D - (D*ray.T) * ray.T).Length() < sphere.Radius();
The namespace provides classes and methods for spatial computations.
Definition Box.h:32
Axis aligned box.
Definition Box.h:41
Implements a 3D - position in cartesian coordinates.
Definition Position.h:46
Sphere with center and radius.
Definition Sphere.h:39
bool Includes(dim::Value< Dimension< 1, 0, 0 > > x, dim::Value< Dimension< 1, 0, 0 > > y, dim::Value< Dimension< 1, 0, 0 > > z) const noexcept
Definition Sphere.h:128
dim::Value< Dimension< 1, 0, 0 > > Radius() const noexcept
Definition Sphere.h:123
Box< dim::Value< Dimension< 1, 0, 0 > > > InBox() const noexcept
Definition Sphere.h:145
Valtype r
Radius of the sphere.
Definition Sphere.h:43
Position< Valtype > c
Center of the sphere.
Definition Sphere.h:42
Position< dim::Value< Dimension< 1, 0, 0 > > > Center() const noexcept
Definition Sphere.h:118
Box< dim::Value< Dimension< 1, 0, 0 > > > ExBox() const noexcept
Definition Sphere.h:138
void Init() noexcept
Definition Sphere.h:112
Sphere() noexcept=default
Does not initialize the members.
Implements a Vector bundle.
Definition VectorBundle.h:42
Implements a 3D - vector in cartesian coordinates.
Definition Vector.h:48