The Nebula Device 3: Math::sphere Class Reference

The Nebula Device 3

Math::sphere Class Reference

#include <sphere_.h>


Detailed Description

A 3-dimensional sphere.

(C) 2004 RadonLabs GmbH

Public Member Functions

 sphere ()
 default constructor
 sphere (const point &_p, scalar _r)
 pos/radius constructor
 sphere (scalar _x, scalar _y, scalar _z, scalar _r)
 x,y,z,r constructor
 sphere (const sphere &rhs)
 copy constructor
void set (const point &_p, scalar _r)
 set position and radius
void set (scalar _x, scalar _y, scalar _z, scalar _r)
 set x,y,z, radius
bool inside (const bbox &box) const
 return true if box is completely inside sphere
bool intersects (const sphere &s) const
 check if 2 spheres overlap
bool intersects (const bbox &box) const
 check if sphere intersects box
bool intersect_sweep (const vector &va, const sphere &sb, const vector &vb, scalar &u0, scalar &u1) const
 check if 2 moving sphere have contact
rectangle< scalar > project_screen_rh (const matrix44 &modelView, const matrix44 &projection, scalar nearZ) const
 project sphere to screen rectangle (right handed coordinate system)
ClipStatus::Type clipstatus (const bbox &box) const
 get clip status of box against sphere

Member Function Documentation

bool Math::sphere::inside ( const bbox box  )  const [inline]

return true if box is completely inside sphere

Return true if the bounding box is inside the sphere.

bool Math::sphere::intersects ( const bbox box  )  const

check if sphere intersects box

Check if sphere intersects with box. Taken from "Simple Intersection Tests For Games", Gamasutra, Oct 18 1999

bool Math::sphere::intersect_sweep ( const vector va,
const sphere sb,
const vector vb,
scalar &  u0,
scalar &  u1 
) const

check if 2 moving sphere have contact

Check if 2 moving spheres have contact. Taken from "Simple Intersection Tests For Games" article in Gamasutra, Oct 18 1999

Parameters:
va [in] distance travelled by 'this'
sb [in] the other sphere
vb [in] distance travelled by sb
u0 [out] normalized intro contact
u1 [out] normalized outro contact

rectangle< scalar > Math::sphere::project_screen_rh ( const matrix44 view,
const matrix44 projection,
scalar  nearZ 
) const

project sphere to screen rectangle (right handed coordinate system)

Project the sphere (defined in global space) to a screen space rectangle, given the current View and Projection matrices. The method assumes that the sphere is at least partially visible.

ClipStatus::Type Math::sphere::clipstatus ( const bbox box  )  const [inline]

get clip status of box against sphere

Get the clip status of a box against this sphere. Inside means: the box is completely inside the sphere.