|
Nebula
|
#include <sphere.h>
A 3-dimensional sphere.
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 | intersects_ray (const line &l) const |
| check if sphere intersects ray | |
| 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 mat4 &modelView, const mat4 &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 | |
Static Public Member Functions | |
| static vec3 | random_point_on_unit_sphere () |
| generate a random point on a unit sphere | |
Public Attributes | |
| point | p |
| scalar | r |
|
inline |
default constructor
|
inline |
copy constructor
|
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.
|
inline |
return true if box is completely inside sphere
Return true if the bounding box is inside the sphere.
| 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
| 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 |
| 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
|
inline |
check if 2 spheres overlap
| bool Math::sphere::intersects_ray | ( | const line & | l | ) | const |
check if sphere intersects ray
| rectangle< scalar > Math::sphere::project_screen_rh | ( | const mat4 & | view, |
| const mat4 & | 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.
|
static |
generate a random point on a unit sphere
| point Math::sphere::p |
| scalar Math::sphere::r |