12 #ifndef __ICEBOUNDINGSPHERE_H__ 13 #define __ICEBOUNDINGSPHERE_H__ 39 bool FastCompute(
udword nb_verts,
const Point* verts);
61 return mCenter.SquareDistance(p) <= mRadius*mRadius;
74 if(mRadius < sphere.
mRadius)
return false;
76 float r = mRadius - sphere.
mRadius;
77 return mCenter.SquareDistance(sphere.
mCenter) <= r*r;
91 float R2 = mRadius * mRadius;
93 const Point& Max = ((ShadowAABB&)&aabb).mMax;
94 const Point& Min = ((ShadowAABB&)&aabb).mMin;
100 p.
x=Max.
x; p.
y=Max.
y; p.
z=Max.
z;
if(mCenter.SquareDistance(p)>=R2)
return FALSE;
101 p.
x=Min.
x;
if(mCenter.SquareDistance(p)>=R2)
return FALSE;
102 p.
x=Max.
x; p.
y=Min.
y;
if(mCenter.SquareDistance(p)>=R2)
return FALSE;
103 p.
x=Min.
x;
if(mCenter.SquareDistance(p)>=R2)
return FALSE;
104 p.
x=Max.
x; p.
y=Max.
y; p.
z=Min.
z;
if(mCenter.SquareDistance(p)>=R2)
return FALSE;
105 p.
x=Min.
x;
if(mCenter.SquareDistance(p)>=R2)
return FALSE;
106 p.
x=Max.
x; p.
y=Min.
y;
if(mCenter.SquareDistance(p)>=R2)
return FALSE;
107 p.
x=Min.
x;
if(mCenter.SquareDistance(p)>=R2)
return FALSE;
121 float r = mRadius + sphere.
mRadius;
122 return mCenter.SquareDistance(sphere.
mCenter) <= r*r;
134 if(mRadius < 0.0
f)
return FALSE;
142 #endif // __ICEBOUNDINGSPHERE_H__
inline_ ~Sphere()
Destructor.
inline_ void GetMin(Point &min) const
Get min point of the box.
inline_ const Point & Center() const
inline_ Sphere & SetRadius(float radius)
inline_ Sphere & SetCenter(const Point ¢er)
inline_ Sphere()
Constructor.
int BOOL
Another boolean type.
unsigned int udword
sizeof(udword) must be 4
inline_ float Radius() const
inline_ Sphere(const Point ¢er, float radius)
Constructor.
inline_ float GetRadius() const
inline_ const Point & GetCenter() const
float mRadius
Sphere radius.
Point mCenter
Sphere center.
inline_ Sphere & Set(const Point ¢er, float radius)
inline_ Sphere(const Sphere &sphere)
Copy constructor.
inline_ BOOL Intersect(const AABB &a, const SAP_Box &b)
inline_ void GetMax(Point &max) const
Get max point of the box.