Go to the documentation of this file.
64 : mRadius(radius), mCenter(center) {}
81 return (s.
mCenter - mCenter).squaredLength() <=
97 return ((v - mCenter).squaredLength() <=
Math::Sqr(mRadius));
110 if (radiusDiff <= 0.0f)
121 Real t = (length + radiusDiff) / (2.0f * length);
122 mCenter = mCenter + diff * t;
123 mRadius = 0.5f * (length + mRadius + oth.
getRadius());
bool intersects(const Plane &plane) const
Returns whether or not this sphere intersects a plane.
Defines a plane in 3D space.
Real getRadius(void) const
Returns the radius of the 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.
static Real Sqrt(Real fValue)
Square root function.
bool intersects(const Vector3 &v) const
Returns whether or not this sphere intersects a point.
const Vector3 & getCenter(void) const
Returns the center point of the sphere.
A 3D box aligned with the x/y/z axes.
A sphere primitive, mostly used for bounds checking.
Real squaredLength() const
Returns the square of the length(magnitude) of the vector.
void merge(const Sphere &oth)
Merges another Sphere into the current sphere.
static std::pair< bool, Real > intersects(const Ray &ray, const Plane &plane)
Ray / plane intersection, returns boolean result and distance.
bool intersects(const AxisAlignedBox &box) const
Returns whether or not this sphere intersects a box.
float Real
Software floating point type.
Sphere()
Standard constructor - creates a unit sphere around the origin.
Standard 3-dimensional vector.
static Real Sqr(Real fValue)
Squared function.
bool intersects(const Sphere &s) const
Returns whether or not this sphere intersects another sphere.
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Tue Apr 13 2021 08:53:15