Loading...
Searching...
No Matches
Ogre::Sphere Class Reference
Core » Math

A sphere primitive, mostly used for bounds checking. More...

`#include <OgreSphere.h>`

## Public Member Functions

| Sphere ()
| Standard constructor - creates a unit sphere around the origin.
| Sphere (const Vector3 &center, Real radius)
| Constructor allowing arbitrary spheres.
const Vector3 & | getCenter (void) const
| Returns the center point of the sphere.
Real | getRadius (void) const
| Returns the radius of the sphere.
bool | intersects (const AxisAlignedBox &box) const
| Returns whether or not this sphere intersects a box.
bool | intersects (const Plane &plane) const
| Returns whether or not this sphere intersects a plane.
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.
void | merge (const Sphere &oth)
| Merges another Sphere into the current sphere.
void | setCenter (const Vector3 &center)
| Sets the center point of the sphere.
void | setRadius (Real radius)
| Sets the radius of the sphere.

## Detailed Description

A sphere primitive, mostly used for bounds checking.

A sphere in math texts is normally represented by the function x^2 + y^2 + z^2 = r^2 (for sphere's centered on the origin). Ogre stores spheres simply as a center point and a radius.

## Constructor & Destructor Documentation

## Sphere() [1/2]

Ogre::Sphere::Sphere | ( |  | ) |

inline

Standard constructor - creates a unit sphere around the origin.

Referenced by intersects(), and merge().

## Sphere() [2/2]

Ogre::Sphere::Sphere | ( | const Vector3 & | center,
|  | Real | radius )

inline

Constructor allowing arbitrary spheres.

Parameters

  center | The center point of the sphere.
  radius | The radius of the sphere.

## Member Function Documentation

## getRadius()

Real Ogre::Sphere::getRadius | ( | void |  | ) | const

inline

Returns the radius of the sphere.

Referenced by Ogre::PlaneBoundedVolume::intersects(), Ogre::Ray::intersects(), intersects(), and merge().

## setRadius()

void Ogre::Sphere::setRadius | ( | Real | radius | ) |

inline

Sets the radius of the sphere.

## getCenter()

const Vector3 & Ogre::Sphere::getCenter | ( | void |  | ) | const

inline

Returns the center point of the sphere.

Referenced by Ogre::PlaneBoundedVolume::intersects(), Ogre::Ray::intersects(), intersects(), and merge().

## setCenter()

void Ogre::Sphere::setCenter | ( | const Vector3 & | center | ) |

inline

Sets the center point of the sphere.

## intersects() [1/4]

bool Ogre::Sphere::intersects | ( | const Sphere & | s | ) | const

inline

Returns whether or not this sphere intersects another sphere.

References Sphere(), and Ogre::Math::Sqr().

Referenced by Ogre::Math::intersects().

## intersects() [2/4]

bool Ogre::Sphere::intersects | ( | const AxisAlignedBox & | box | ) | const

inline

Returns whether or not this sphere intersects a box.

References Ogre::Math::intersects().

## intersects() [3/4]

bool Ogre::Sphere::intersects | ( | const Plane & | plane | ) | const

inline

Returns whether or not this sphere intersects a plane.

References Ogre::Math::Abs(), getCenter(), Ogre::Plane::getDistance(), and getRadius().

## intersects() [4/4]

bool Ogre::Sphere::intersects | ( | const Vector3 & | v | ) | const

inline

Returns whether or not this sphere intersects a point.

References Ogre::Math::Sqr().

## merge()

void Ogre::Sphere::merge | ( | const Sphere & | oth | ) |

inline

Merges another Sphere into the current sphere.

References Sphere(), getCenter(), getRadius(), Ogre::Math::Sqr(), Ogre::Math::Sqrt(), and Ogre::Vector< dims, T >::squaredLength().

The documentation for this class was generated from the following file:

- OgreSphere.h