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());
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.
static Real Sqr(Real fValue)
Squared function.
static Real Sqrt(Real fValue)
Square root function.
Defines a plane in 3D space.
A sphere primitive, mostly used for bounds checking.
bool intersects(const Sphere &s) const
Returns whether or not this sphere intersects another sphere.
const Vector3 & getCenter(void) const
Returns the center point of the 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.
Standard 3-dimensional vector.
Real squaredLength() const
Returns the square of the length(magnitude) of the vector.
float Real
Software floating point type.