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());
Sphere(const Vector3 ¢er, Real radius)
Constructor allowing arbitrary spheres.
const Vector3 & getCenter(void) const
Returns the center point of the sphere.
float Real
Software floating point type.
void merge(const Sphere &oth)
Merges another Sphere into the current sphere.
Defines a plane in 3D space.
Sphere()
Standard constructor - creates a unit sphere around the origin.
A 3D box aligned with the x/y/z axes.
static std::pair< bool, Real > intersects(const Ray &ray, const Plane &plane)
Ray / plane intersection, returns boolean result and distance.
bool intersects(const Plane &plane) const
Returns whether or not this sphere intersects a plane.
void setCenter(const Vector3 ¢er)
Sets the center point of the sphere.
static Real Sqrt(Real fValue)
Square root function.
A sphere primitive, mostly used for bounds checking.
static Real Sqr(Real fValue)
Squared function.
Real getRadius(void) const
Returns the radius of the sphere.
Real squaredLength() const
Returns the square of the length(magnitude) of the vector.
Standard 3-dimensional vector.
void setRadius(Real radius)
Sets the radius of the sphere.
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.
bool intersects(const AxisAlignedBox &box) const
Returns whether or not this sphere intersects a box.