81 return (
s.mCenter - mCenter).squaredLength() <=
82 Math::Sqr(
s.mRadius + mRadius);
87 return Math::intersects(*
this,
box);
92 return Math::intersects(*
this, plane);
97 return ((v - mCenter).squaredLength() <= Math::Sqr(mRadius));
114 mCenter =
oth.getCenter();
115 mRadius =
oth.getRadius();
122 mCenter = mCenter +
diff *
t;
123 mRadius = 0.5f * (length + mRadius +
oth.getRadius());
A 3D box aligned with the x/y/z axes.
Defines a plane in 3D space.
Reference-counted shared pointer, used for objects where implicit destruction is required.
A sphere primitive, mostly used for bounds checking.
bool intersects(const Sphere &s) const
Returns whether or not this sphere intersects another sphere.
bool intersects(const Vector3 &v) const
Returns whether or not this sphere intersects a point.
Real getRadius(void) const
Returns the radius of the sphere.
bool intersects(const Plane &plane) const
Returns whether or not this sphere intersects a plane.
bool intersects(const AxisAlignedBox &box) const
Returns whether or not this sphere intersects a box.
Sphere()
Standard constructor - creates a unit sphere around the origin.
void merge(const Sphere &oth)
Merges another Sphere into the current sphere.
void setRadius(Real radius)
Sets the radius of the sphere.
Sphere(const Vector3 ¢er, Real radius)
Constructor allowing arbitrary spheres.
void setCenter(const Vector3 ¢er)
Sets the center point of the sphere.
const Vector3 & getCenter(void) const
Returns the center point of the sphere.
Standard 3-dimensional vector.