[SML Overview]

class SMLBound

#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.


Public Interface

constructors

destructor

Clone

Cull

GetCenter

Load

Save

SetCenter

Transform

around

contains

extendBy

probe

 

 


SMLLIBENTRY SMLBound();

Discussion

Default SMLbound object constructor. It constructs an empty bound centered at the origin.

Parameters

No.

[top]


SMLLIBENTRY SMLBound(const SMLVec3f& smlvec);

Discussion

SMLBound object constructor. It constructs an empty bound centered at the smlvec.

Parameters

smlvec - reference to SMLVec3f constant object

[top]


SMLLIBENTRY virtual ~SMLBound();

Discussion

SMLBound object destructor.

Parameters

No.

[top]


virtual SMLBound* Clone() = 0;

virtual const SMLBound* Clone() const = 0;

Discussion

Pure virtual method to clone the current object.

Parameters

No.

Return Value

Returns pointer or const pointer to copy of this object.

[top]


SMLLIBENTRY void SetCenter(float x, float y, float z);

Discussion

Sets center of this to x, y, z.

Parameters

x, y, z - coordinates of new center.

[top]


SMLLIBENTRY void SetCenter(const SMLVec3f& smlvec);

Discussion

Sets center of this to smlvec.

Parameters

smlvec - reference to a constant object of SMLVec3f-type.

[top]


SMLLIBENTRY const SMLVec3f& GetCenter() const;

Discussion

Returns center of the bound.

Parameters

No.

Return Value

Returns reference to a SMLVec3f-type constant object.

[top]


virtual bool Cull(const SMLPlane* planes, int numPlane) const = 0;

Discussion

Pure virtual method to check if the bound lies within frustum created by specified planes.

Parameters

planes - pointer to a constant object of SMLPlane type.

numPlane - number of planes.

Return Value

Returns true if bound is culled, false otherwise.

[top]


virtual void around(const SMLVec3f* points, int npoints) = 0;

Discussion

Pure virtual method. Current bound is set to include specified points.

Parameters

pts - pointer to a constant object of SMLVec3f type.

npoints - number of points.

[top]


virtual void around(const SMLSphereBound** spheres, int nspheres) = 0;

Discussion

Pure virtual method. Current bound is set to include specified spheres.

Parameters

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;

Discussion

Pure virtual method. Current bound is set to include specified boxes.

Parameters

boxes - pointer to a pointer to a constant object of SMLSphereBound type

nboxes - number of boxes.

[top]


virtual void around(const SMLSphereBound* sphere) = 0;

Discussion

Pure virtual method. Current bound is set to include sphere.

Parameters

sphere - pointer to a constant object of SMLSphereBound type

[top]


virtual void around(const SMLBoxBound* box) = 0;

Discussion

Pure virtual method. Current bound is set to include box.

Parameters

box - pointer to a constant object of SMLBoxBound type

[top]


virtual void around(const SMLBound* bound) = 0;

Discussion

Pure virtual method. Current bound is set to include bound.

Parameters

bound - pointer to a constant object of SMLBound type

[top]


virtual void around(const SMLBound** bounds, int nbounds) = 0;

Discussion

Pure virtual method. Current bound is set to include specified bounds.

Parameters

bounds - pointer to a pointer to a constant object of SMLBound type

nbounds - number of bounds

[top]


virtual void extendBy(const SMLVec3f& point) = 0;

Discussion

Pure virtual method. Current bound is extended to include point.

Parameters

point - reference to a constant object of SMLVec3f type.

[top]


virtual void extendBy(const SMLBoxBound* box) = 0;

Discussion

Pure virtual method. Current bound is extended to include box.

Parameters

box - pointer to a constant object of SMLBoxBound type

[top]


virtual void extendBy(const SMLSphereBound* sphere) = 0;

Discussion

Pure virtual method. Current bound is extended to include sphere.

Parameters

sphere - pointer to a constant object of SMLSphereBound type

[top]


virtual void extendBy(const SMLBound* bound);

Discussion

Pure virtual method. Current bound is extended to include bound.

Parameters

bound - pointer to a constant object of SMLBound type.

[top]


virtual bool contains(const SMLVec3f& point) const = 0;

Discussion

Pure virtual method to check whether bound contains point.

Parameters

point - reference to a constant object of SMLVec3f type.

Return Value

Returns true if point contains in this bound, false otherwise.

[top]


virtual bool contains(const SMLBoxBound* box) const = 0;

Discussion

Pure virtual method to check whether bound contains box.

Parameters

box - pointer to a constant object of SMLBoxBound type

Return Value

Returns true if box contains in this bound, false otherwise.

[top]


virtual bool contains(const SMLSphereBound* sphere) const = 0;

Discussion

Pure virtual method to check whether bound contains sphere.

Parameters

sphere - pointer to a constant object of SMLSphereBound type

Return Value

Returns true if sphere contains in this bound, false otherwise.

[top]


virtual bool contains(const SMLBound* bound) = 0;

Discussion

Pure virtual method to check whether bound contains bound.

Parameters

bound - pointer to a constant object of SMLBound type.

Return Value

Returns true if bound contains in this bound, false otherwise.

[top]


virtual void Transform(const SMLBound* bound, const SMLMatrix4f& matrix) = 0;

Discussion

Pure virtual method to transform the bound bound by the matrix which may include translation, rotation, and scale.

Parameters

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;

Discussion

Pure virtual method to check if the bound is intersected by the vector from p1 to p2.

Parameters

p1 - start of the vector.

p2 - end of the vector.

Output Parameters

closeDist - minimum distance from the vector to the bound.

farDist - maximum distance from the vector to the bound.

Return Value

Returns true if intersection is detected.

[top]


virtual void Save(SMLStream& stream);

Discussion

Virtual method to save current bound in the stream.

Parameters

stream - reference to object of SMLStream type.

[top]


virtual void Load(SMLStream& stream);

Discussion

Virtual method to load current bound from the stream.

Parameters

stream - reference to object of SMLStream type

[top]


virtual void copyFrom(const SMLBound& smlbound) = 0;

Discussion

Virtual method to copy data from smlbound.

Parameters

smlbound - reference to object of SMLBound type.

[top]


virtual void copySame(SMLSphereBound* sphere) = 0;

Discussion

Virtual method to copy data from sphere.

Parameters

sphere - pointer to object of SMLSphereBound type.

[top]


virtual void copySame(SMLBoxBound* box) = 0;

Discussion

Virtual method to copy data from box.

Parameters

box - pointer to object of SMLBoxBound type.

[top]