#include "smlbound.h"
SMLSphereBound is a derivative class, inherits SMLBound class. SMLSphereBound class represents a spherical bounding region enclosing a set of other bounds or points. This object can be extended, transformed, checked to see if a point is inside, checked to see if a vector intersects it, and checked to see if it is outside or inside a set of culling planes.
|
|
float r;
Radius of this sphere.
[top]
SMLLIBENTRY SMLSphereBound(const SMLVec3f& smlvec, float initr);
SMLSphereBound object constructor.
smlvec - reference to SMLVec3f constant object.
initr - radius of sphere
[top]
SMLLIBENTRY SMLSphereBound(const SMLSphereBound& smlbound)
SMLSphereBound object copy-constructor.
smlbound - reference to SMLSphereBound constant object which copy to create.
[top]
SMLLIBENTRY SMLSphereBound();
Default SMLSphereBound object constructor.
No.
[top]
SMLLIBENTRY virtual SMLBound* Clone();
SMLLIBENTRY virtual const SMLBound* Clone() const;
These two virtual methods create the copy of the SMLSphereBound-type object for which they are called.
No.
Methods return SMLBound-type pointer or const SMLBound-type pointer to new object.
[top]
SMLLIBENTRY virtual bool Cull(const SMLPlane* planes, int numPlane) const ;
Method checks if this bound lies within frustum created by specified planes. Method checks the distance between the center of sphere and the planes given in array planes.
planes - defines array of planes used for culling of current sphere (frustum).
numPlane - number of planes.
Returns true if this sphere is culled. Otherwise, returns false.
[top]
SMLLIBENTRY const SMLSphereBound& operator =(const SMLSphereBound& s);
Method is an overloaded operator-function. It nominates new coordinates of center of this sphere, changes its radius and makes these parameters equal to those of object s.
s - object of SMLSphereBound type.
Returns reference to the SMLSphereBound-type object to which it nominates new sphere center coordinates and radius.
[top]
SMLLIBENTRY virtual void around(const SMLSphereBound** spheres, int nspheres);
Method creates new sphere, which surrounds all the spheres from array spheres.
spheres - represents array of pointers to constant objects of SMLSphereBound type
nspheres - number of spheres.
[top]
SMLLIBENTRY virtual void around(const SMLVec3f* pts, int npoints);
Method creates new sphere, which surrounds all the points from SMLVec3f-type array.
pts - array of pointers to constant objects of SMLVec3f type.
npoints - number of points.
[top]
SMLLIBENTRY virtual void around(const SMLBoxBound** boxes, int nboxes);
Method creates new sphere that surrounds all the boxes from SMLBoxBound-type array.
boxes - array of pointers to constant objects of SMLBoxBound type
nboxes - number of boxes.
[top]
SMLLIBENTRY virtual void around(const SMLSphereBound* sphere);
Method creates new sphere that coincides with the given sphere.
sphere - pointer to a constant object of SMLSphereBound type
[top]
SMLLIBENTRY virtual void around(const SMLBoxBound* box);
Method creates a new sphere which surrounds given box.
sphere - pointer to a constant object of SMLSphereBound type
[top]
SMLLIBENTRY virtual void around(const SMLBound* bound);
Method creates a new sphere, which surrounds an object of SMLBound type, i.e. box or sphere.
bound - pointer to a constant object of SMLBound type
[top]
SMLLIBENTRY virtual void around(const SMLBound** bounds, int nbounds);
Method creates a new sphere, which surrounds all the objects of SMLBound type, i.e. boxes or spheres.
bound - specifies array of bounds
[top]
SMLLIBENTRY virtual void extendBy(const SMLVec3f& point);
Method extends a spherical bound (changes its center coordinates and radius) to include given point.
point - reference to constant object of SMLVec3f type.
[top]
SMLLIBENTRY virtual void extendBy(const SMLBoxBound* box);
Method extends a spherical bound to include given box.
box - pointer to a constant object of SMLBoxBound type.
[top]
SMLLIBENTRY virtual void extendBy(const SMLSphereBound* sphere);
Method extends a spherical bound to include given sphere.
sphere - pointer to a constant object of SMLSphereBound type.
[top]
SMLLIBENTRY virtual void extendBy(const SMLBound* bound);
Method extends a spherical bound. If bound is a pointer to an object of SMLSphereBound type the method extends this spherical bound to include the sphere. If bound is a pointer to an object of SMLBoxBound type the method extends this spherical bound for to include given box.
bound - pointer to constant object of SMLBound type.
[top]
SMLLIBENTRY virtual bool contains(const SMLVec3f& point) const;
Method checks if the point is inside this spherical bound.
point - reference to a constant object of SMLVec3f type.
Returns true if the point is inside this sphere. Otherwise, returns false.
[top]
SMLLIBENTRY virtual bool contains(const SMLBoxBound* box) const;
Method checks if a box is inside the shperical bound.
box - pointer to a constant object of SMLBox Bound type.
Returns true if the given box is inside this spherical bound. Otherwise, returns false.
[top]
SMLLIBENTRY virtual bool contains(const SMLSphereBound* sphere) const;
Method checks if a sphere is inside this spherical bound.
sphere - pointer to a constant object of SMLSphereBound type.
Returns true if the given sphere is inside this spherical bound. Otherwise, returns false.
[top]
SMLLIBENTRY virtual bool contains(const SMLBound* bound) const;
Method checks if an object of SMLBound type (sphere or box) is inside this spherical bound.
bound - pointer to a constant object of SMLBound type.
Returns true if the given sphere or box are inside this spherical bound. Otherwise, returns false.
[top]
SMLLIBENTRY virtual void Transform(const SMLBound* bound, const SMLMatrix4f& matrix);
Method transforms the object bound. If bound is a sphere, the method transforms the coordinates of its center and radius in accordance with transformation matrix. If bound is a box, the method creates a new sphere, which surrounds this box and then transforms this sphere in accordance with matrix.
bound - pointer to a constant object of SMLBound type.
matrix - transformation matrix.
[top]
SMLLIBENTRY virtual bool probe(const SMLVec3f& p1, const SMLVec3f& p2, float* closeDist, float* farDist);
Method checks if segment, defined with its start p1 and end p2, crosses this sphere.
p1 - reference to the start of the segment ( a constant object of SMLVec3f type).
p2 - reference to the end of the segment ( a constant object of SMLVec3f type).
OutputcloseDist - pointer to the close cross point.
farDist - pointer to the far cross point.
Returns true if the segment crosses given sphere. Otherwise, returns false.
[top]
SMLLIBENTRY virtual bool probe(const SMLRay& ray, float* closeDist, float* farDist);
Method checks if ray crosses this sphere.
ray - reference to a constant object of SMLRay type.
OutputcloseDist - pointer to the close cross point.
farDist - pointer to the far cross point.
Computation of these distances is not realized.
Returns true if the ray crosses given sphere. Otherwise, returns false.
[top]
SMLLIBENTRY virtual void Transform(const SMLSphereBound* src, const SMLMatrix4f& matrix);
Method transforms a sphere. The method transforms the coordinates of its center and radius in accordance with object matrix.
src - pointer to a constant object of SMLSphereBound type.
matrix - transformation matrix.
[top]
SMLLIBENTRY void SetRadius(float radius);
Method sets new radius of this sphere.
radius - new radius of this sphere.
[top]
SMLLIBENTRY void GetRadius();
Method gets radius of this sphere.
No.
Returns value of current radius of this sphere.
[top]
virtual void copyFrom(const SMLBound& bound);
Method sets new radius and coordinates of center of this sphere equal to those of object bound.
bound - reference to object of SMLBound type.
[top]
virtual void copySame(const SMLSphereBound* bound);
Method creates new sphere with radius and coordinates of center equal to those of spherical bound.
bound - poiner to object of SMLSphereBound type.
[top]
SMLLIBENTRY virtual bool containsRelativeCoordinates(float px, float py, float pz) const;
Method checks if the point defined by px, py, pz is inside this sphere.
px, py, pz - coordinates of the point.
Returns true if the point is inside this sphere. Otherwise, returns false.
[top]