# Ogre::Sphere Class Reference

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

`#include <OgreSphere.h>`

List of all members.

## Public Member Functions

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

## Protected Attributes

Real | mRadius
Vector3 | mCenter

## Detailed Description

A sphere primitive, mostly used for bounds checking.

Remarks:
  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.

Definition at line 46 of file OgreSphere.h.

## Constructor & Destructor Documentation

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

Standard constructor - creates a unit sphere around the origin.

Definition at line 53 of file OgreSphere.h.

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

Constructor allowing arbitrary spheres.

Parameters:

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

Definition at line 58 of file OgreSphere.h.

## Member Function Documentation

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

Returns the radius of the sphere.

Definition at line 62 of file OgreSphere.h.

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

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

Sets the radius of the sphere.

Definition at line 65 of file OgreSphere.h.

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

Returns the center point of the sphere.

Definition at line 68 of file OgreSphere.h.

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

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

Sets the center point of the sphere.

Definition at line 71 of file OgreSphere.h.

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

Returns whether or not this sphere intersects another sphere.

Definition at line 74 of file OgreSphere.h.

References mCenter, mRadius, Ogre::Math::Sqr(), and Ogre::Vector3::squaredLength().

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

Returns whether or not this sphere intersects a box.

Definition at line 80 of file OgreSphere.h.

References Ogre::Math::intersects().

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

Returns whether or not this sphere intersects a plane.

Definition at line 85 of file OgreSphere.h.

References Ogre::Math::intersects().

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

Returns whether or not this sphere intersects a point.

Definition at line 90 of file OgreSphere.h.

References Ogre::Math::Sqr().

## Member Data Documentation

Real Ogre::Sphere::mRadius `[protected]`

Definition at line 49 of file OgreSphere.h.

Referenced by intersects().

Vector3 Ogre::Sphere::mCenter `[protected]`

Definition at line 50 of file OgreSphere.h.

Referenced by intersects().

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

- OgreSphere.h

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Jul 26 11:37:19 2009