#include "smlbound.h"
SMLBound is an abstract class representing a generic 3D 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. Specific implementations of bound object include SMLBoxBound and SMLSphereBound.
|
|
Default SMLbound object constructor. It constructs an empty bound centered at the origin.
No.
[top]
SMLLIBENTRY SMLBound(const SMLVec3f& smlvec);
SMLBound object constructor. It constructs an empty bound centered at the smlvec.
smlvec - reference to SMLVec3f constant object
[top]
SMLLIBENTRY virtual ~SMLBound();
SMLBound object destructor.
No.
[top]
virtual SMLBound* Clone() = 0;
virtual const SMLBound* Clone() const = 0;
Pure virtual method to clone the current object.
No.
Returns pointer or const pointer to copy of this object.
[top]
SMLLIBENTRY void SetCenter(float x, float y, float z);
Sets center of this to x, y, z.
x, y, z - coordinates of new center.
[top]
SMLLIBENTRY void SetCenter(const SMLVec3f& smlvec);
Sets center of this to smlvec.
smlvec - reference to a constant object of SMLVec3f-type.
[top]
SMLLIBENTRY const SMLVec3f& GetCenter() const;
Returns center of the bound.
No.
Returns reference to a SMLVec3f-type constant object.
[top]
virtual bool Cull(const SMLPlane* planes, int numPlane) const = 0;
Pure virtual method to check if the bound lies within frustum created by specified planes.
planes - pointer to a constant object of SMLPlane type.
numPlane - number of planes.
Returns true if bound is culled, false otherwise.
[top]
virtual void around(const SMLVec3f* points, int npoints) = 0;
Pure virtual method. Current bound is set to include specified points.
pts - pointer to a constant object of SMLVec3f type.
npoints - number of points.
[top]
virtual void around(const SMLSphereBound** spheres, int nspheres) = 0;
Pure virtual method. Current bound is set to include specified spheres.
spheres - pointer to a pointer to a constant object of SMLSphereBound type
nspheres - number of spheres.
[top]
virtual void around(const SMLBoxBound** boxes, int nboxes) = 0;
Pure virtual method. Current bound is set to include specified boxes.
boxes - pointer to a pointer to a constant object of SMLSphereBound type
nboxes - number of boxes.
[top]
virtual void around(const SMLSphereBound* sphere) = 0;
Pure virtual method. Current bound is set to include sphere.
sphere - pointer to a constant object of SMLSphereBound type
[top]
virtual void around(const SMLBoxBound* box) = 0;
Pure virtual method. Current bound is set to include box.
box - pointer to a constant object of SMLBoxBound type
[top]
virtual void around(const SMLBound* bound) = 0;
Pure virtual method. Current bound is set to include bound.
bound - pointer to a constant object of SMLBound type
[top]
virtual void around(const SMLBound** bounds, int nbounds) = 0;
Pure virtual method. Current bound is set to include specified bounds.
bounds - pointer to a pointer to a constant object of SMLBound type
nbounds - number of bounds
[top]
virtual void extendBy(const SMLVec3f& point) = 0;
Pure virtual method. Current bound is extended to include point.
point - reference to a constant object of SMLVec3f type.
[top]
virtual void extendBy(const SMLBoxBound* box) = 0;
Pure virtual method. Current bound is extended to include box.
box - pointer to a constant object of SMLBoxBound type
[top]
virtual void extendBy(const SMLSphereBound* sphere) = 0;
Pure virtual method. Current bound is extended to include sphere.
sphere - pointer to a constant object of SMLSphereBound type
[top]
virtual void extendBy(const SMLBound* bound);
Pure virtual method. Current bound is extended to include bound.
bound - pointer to a constant object of SMLBound type.
[top]
virtual bool contains(const SMLVec3f& point) const = 0;
Pure virtual method to check whether bound contains point.
point - reference to a constant object of SMLVec3f type.
Returns true if point contains in this bound, false otherwise.
[top]
virtual bool contains(const SMLBoxBound* box) const = 0;
Pure virtual method to check whether bound contains box.
box - pointer to a constant object of SMLBoxBound type
Returns true if box contains in this bound, false otherwise.
[top]
virtual bool contains(const SMLSphereBound* sphere) const = 0;
Pure virtual method to check whether bound contains sphere.
sphere - pointer to a constant object of SMLSphereBound type
Returns true if sphere contains in this bound, false otherwise.
[top]
virtual bool contains(const SMLBound* bound) = 0;
Pure virtual method to check whether bound contains bound.
bound - pointer to a constant object of SMLBound type.
Returns true if bound contains in this bound, false otherwise.
[top]
virtual void Transform(const SMLBound* bound, const SMLMatrix4f& matrix) = 0;
Pure virtual method to transform the bound bound by the matrix which may include translation, rotation, and scale.
bound - pointer to a constant object of SMLBound type.
matrix - reference to a constant object of SMLMatrix4f type.
[top]
virtual bool probe(const SMLVec3f& p1, const SMLVec3f& p2, float* closeDist, float* farDist) const = 0;
Pure virtual method to check if the bound is intersected by the vector from p1 to p2.
p1 - start of the vector.
p2 - end of the vector.
closeDist - minimum distance from the vector to the bound.
farDist - maximum distance from the vector to the bound.
Returns true if intersection is detected.
[top]
virtual void Save(SMLStream& stream);
Virtual method to save current bound in the stream.
stream - reference to object of SMLStream type.
[top]
virtual void Load(SMLStream& stream);
Virtual method to load current bound from the stream.
stream - reference to object of SMLStream type
[top]
virtual void copyFrom(const SMLBound& smlbound) = 0;
Virtual method to copy data from smlbound.
smlbound - reference to object of SMLBound type.
[top]
virtual void copySame(SMLSphereBound* sphere) = 0;
Virtual method to copy data from sphere.
sphere - pointer to object of SMLSphereBound type.
[top]
virtual void copySame(SMLBoxBound* box) = 0;
Virtual method to copy data from box.
box - pointer to object of SMLBoxBound type.
[top]