[SML Overview]

class SMLBoxBound: public SMLBound

#include "smlbound.h"

SMLBoxBound is a derivative class, inherits SMLBound class. The SMLBoxBound class represents an axis aligned bounding box 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.


Public Interface

constructors

Clone

ComputeMinMax

Cull

operator=

around

extendBy

contains

Transform

SetSide

GetSide

copyFrom

copySame

 

 


Public Data

SMLVec3f side;

Box side.

SMLVec3f min;

Corner of box with minimum values of x, y, z.

SMLVec3f max;

Corner of box with maximum values of x, y, z.

SMLVec3f corners[8];

8 corners of this box.

min, max and corners are computed by function ComputeMinMax.

[top]


SMLLIBENTRY SMLBoxBound(const SMLVec3f& center, const SMLVec3f& side);

Discussion

SMLBoxBound object constructor. This constructor sets component data of the class center and side equal to input objects data center and side correspondingly.

Parameters

center - reference to SMLVec3f constant object

side - reference to SMLVec3f constant object

[top]


SMLLIBENTRY SMLBoxBound (const SMLBoxBound& bound);

Discussion

SMLBoxBound object copy-constructor. Makes copy of the object bound of the same class.

Parameters

bound - reference to SMLBoxBound constant object.

[top]


SMLLIBENTRY SMLBoxBound();

Discussion

Default SMLBoxBound object constructor. This constructor sets parameters center and side of the class equal to zero.

Parameters

No.

[top]


SMLLIBENTRY virtual SMLBound* Clone();

SMLLIBENTRY virtual const SMLBound* Clone() const;

Discussion

These two virtual methods create the copy of the SMLBoxBound-type object for which they are called.

Parameters

No.

Return Value

Methods return SMLBound-type pointer or const SMLBound-type pointer to new created object.

[top]


SMLLIBENTRY void ComputeMinMax();

Discussion

Method defines variables min, max, and coordinates of corners of parallelepiped, i.e. defines component array corners. Sides of the parallelepiped are equal to 2*side.x, 2*side.y, and 2*side.z.

Parameters

No.

[top]


SMLLIBENTRY virtual bool Cull(const SMLPlane* planes, int nplane) const;

Discussion

Method checks if the bound lies within frustum created by specified planes.

Parameters

planes - defines array of planes used for culling of current box (frustum). Box is culled if it is not intersected with intersection of all positive half-spaces defined by planes.

numPlane - number of planes.

Return Value

Returns true if box is culled, false otherwise.

[top]


SMLLIBENTRY const SMLBoxBound& operator=(const SMLBoxBound& bound);

Discussion

Method is an overloaded operator-function. It sets parameters of this box to be equal to those of object bound.

Parameters

bound - object of SMLBoxBound type.

Return Value

Returns reference to the SMLBoxBound-type object to which it nominates new box center coordinates and side.

[top]


SMLLIBENTRY virtual void around(const SMLVec3f* pts, int npoints);

Discussion

Method sets parameters (center coordinates and side) of this parallelepiped to contain all the points defined by parameter pts. Minimum object with such properties is created by the method.

Parameters

pts - pointer to array of constant objects of SMLVes3f type.

npoints - number of points. Variable should be a positive value.

[top]


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

Discussion

Method sets parameters of this parallelepiped to include all spheres specified by parameter spheres. Minimum object with such properties is created by the method.

Parameters

spheres - pointer to array of constant objects of SMLSphereBound type.

nspheres - number of spheres. Variable should be a positive value or zero.

[top]


SMLLIBENTRY virtual void around(const SMLBoxBound** boxes, int nboxes);

Discussion

Method sets parameters of this parallelepiped to include all the parallelepipeds specified by parameter boxes. Minimum object with such properties is created by the method.

Parameters

boxes - pointer to array of constant objects of SMLSphereBound type.

nboxes - number of boxes. Variable should be a positive value or zero.

[top]


SMLLIBENTRY virtual void around(const SMLSphereBound* sphere);

Discussion

Method sets parameters of this parallelepiped to include sphere. Minimum object with such properties is created by the method.

Parameters

sphere - pointer to constant object of SMLSphereBound type.

[top]


SMLLIBENTRY virtual void around(const SMLBoxBound* box);

Discussion

Method sets parameters of this parallelepiped to be equal to parameters of box.

Parameters

box - pointer to constant object of SMLBoxBound type.

[top]


SMLLIBENTRY virtual void around(const SMLBound* bound);

Discussion

Method sets parameters of this parallelepiped to include object bound.

Parameters

bound - pointer to constant object of SMLBound type.

[top]


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

Discussion

Method sets parameters of this parallelepiped to include all objects defined by bounds.

Parameters

bounds - pointer to an array of constant objects of SMLBound type.

nbounds - number of bounds. Variable should be a positive value.

[top]


SMLLIBENTRY virtual void extendBy(const SMLVec3f& point);

Discussion

Method extends parallelepiped (changes its center coordinates and side) to include given point.

Parameters

point - reference to constant object of SMLVec3f type.

[top]


SMLLIBENTRY virtual void extendBy(const SMLBoxBound* box);

Discussion

Method extends parallelepiped to include given box.

Parameters

box - pointer to a constant object of SMLBoxBound type.

[top]


SMLLIBENTRY virtual void extendBy(const SMLSphereBound* sphere);

Discussion

Method extends parallelepiped to include given sphere.

Parameters

sphere - pointer to a constant object of SMLSphereBound type.

[top]


SMLLIBENTRY virtual void extendBy(const SMLBound* bound);

Discussion

Method extends parallelepiped to include given bound.

Parameters

bound - pointer to constant object of SMLBound type.

[top]


SMLLIBENTRY virtual bool contains(const SMLVec3f& point) const;

Discussion

Method checks if the point is inside this parallelepiped.

Parameters

point - reference to a constant object of SMLVec3f type.

Return Value

Returns true if the point is inside the parallelepiped. Otherwise, returns false.

[top]


SMLLIBENTRY virtual bool contains(const SMLBoxBound* box) const;

Discussion

Method checks if specified box is inside this parallelepiped.

Parameters

box - pointer to a constant object of SMLBox Bound type.

Return Value

Returns true if box is inside this parallelepiped. Otherwise, returns false.

[top]


SMLLIBENTRY virtual bool contains(const SMLSphereBound* sphere) const;

Discussion

Method checks if specified sphere is inside this parallelepiped.

Parameters

sphere - pointer to a constant object of SMLSphereBound type.

Return Value

Returns true if the given sphere is inside this parallelepiped. Otherwise, returns false.

[top]


SMLLIBENTRY virtual bool contains(const SMLBound* bound) const;

Discussion

Method checks if specified bound is inside this parallelepiped.

Parameters

bound - pointer to a constant object of SMLBound type.

Return Value

Returns true if bound is inside this parallelepiped. Otherwise, returns false.

[top]


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

Discussion

Method transforms the object bound in accordance with transformation matrix and writes it into this.

Parameters

bound - pointer to a constant object of SMLBound type.

matrix - transformation matrix.

[top]


SMLLIBENTRY virtual void Transform(const SMLBoxBound* src, const SMLMatrix4f& matrix)

Discussion

Method transforms box in accordance with transformation matrix.

Parameters

src - pointer to a constant object of SMLBoxBound type.

matrix - transformation matrix.

[top]


SMLLIBENTRY void SetSide(const SMLVec3f& vector);

Discussion

Method sets side of this box to be equal to vector.

Parameters

vector - new side of this box.

[top]


SMLLIBENTRY const SMLVec3f& GetSide() const;

Discussion

Method returns side of this box.

Parameters

No.

Return Value

Returns reference to current side of this box.

[top]


virtual void copyFrom(const SMLBound& bound);

Discussion

Method sets new side and coordinates of center of this box equal to those of object bound.

Parameters

bound - reference to object of SMLBound type.

[top]


virtual void copySame(const SMLBoxBound* bound);

Discussion

Method creates new box with side and coordinates of center equal to those of box bound.

Parameters

bound - poiner to object of SMLBoxBound type.

[top]