Kaim::Box2f Class Reference

Kaim::Box2f Class Reference

#include <box2f.h>

Class Description

This class represents a two-dimensional axis-aligned bounding box whose dimensions are stored using floating-point numbers.

Constructors

 Box2f ()
 
 Box2f (const Vec2f &_min, const Vec2f &_max)
 
 Box2f (KyFloat32 min_x, KyFloat32 min_y, KyFloat32 max_x, KyFloat32 max_y)
 

Main API Functions

bool operator== (const Box2f &other) const
 
bool operator!= (const Box2f &other) const
 
void Clear ()
 
bool IsValid ()
 
void Set (const Vec2f &min_, const Vec2f &max_)
 
void Set (KyFloat32 min_x, KyFloat32 min_y, KyFloat32 max_x, KyFloat32 max_y)
 
KyFloat32 SizeX ()
 
KyFloat32 SizeY ()
 
void ExpandByVec2 (const Vec2f &pos)
 
void ExpandByVec3 (const Vec3f &pos)
 
void ExpandByBox2 (const Box2f &box)
 
void ExpandByBox3 (const Box3f &box)
 
void Enlarge (KyFloat32 enlargement)
 
bool IsPoint2DInside (const Vec2f &p) const
 
bool IsPoint3DInside (const Vec3f &p) const
 

Constructor & Destructor Documentation

Kaim::Box2f::Box2f ( )
inline

Creates a new Box2f with invalid extents: you must call Set() before using it.

Kaim::Box2f::Box2f ( const Vec2f _min,
const Vec2f _max 
)
inline

Creates a new Box2f with the provided extents.

Parameters
_minThe minima of the bounding box.
_maxThe maxima of the bounding box.
Kaim::Box2f::Box2f ( KyFloat32  min_x,
KyFloat32  min_y,
KyFloat32  max_x,
KyFloat32  max_y 
)
inline

Creates a new Box2f with the provided extents.

Parameters
min_xThe minimum position of the bounding box on the X axis.
min_yThe minimum position of the bounding box on the Y axis.
max_xThe maximum position of the bounding box on the X axis.
max_yThe maximum position of the bounding box on the Y axis.

Member Function Documentation

void Kaim::Box2f::Clear ( )
inline

Clears all information maintained by this object.

This method sets the extents of the box to invalid values; you must follow this method with a call to Set() before you can use the box.

void Kaim::Box2f::Enlarge ( KyFloat32  enlargement)
inline

Enlarges the extents of the bounding box by the specified amount in all directions.

void Kaim::Box2f::ExpandByBox2 ( const Box2f box)
inline

Enlarges the extents of the bounding box to include the area covered by the specified bounding box.

If the bounding box already encompasses the area of box, the bounding box is not modified.

void Kaim::Box2f::ExpandByBox3 ( const Box3f box)
inline

Enlarges the extents of the bounding box to include the area covered by the specified bounding box on the plane of the (X,Y) axes.

If the bounding box already encompasses the area of box, the box is not modified.

void Kaim::Box2f::ExpandByVec2 ( const Vec2f pos)
inline

Enlarges the extents of the bounding box to include the specified two-dimensional point.

If the point is already contained within the bounding box, the box is not modified.

void Kaim::Box2f::ExpandByVec3 ( const Vec3f pos)
inline

Enlarges the extents of the bounding box to include the (X,Y) coordinates of the specified three-dimensional point.

If the (X,Y) coordinates of the point are already contained within the bounding box, the box is not modified.

bool Kaim::Box2f::IsPoint2DInside ( const Vec2f p) const
inline

Indicates whether or not the specified two-dimensional point is inside the area covered by the bounding box.

bool Kaim::Box2f::IsPoint3DInside ( const Vec3f p) const
inline

Indicates whether or not the (X,Y) coordinates of the specified three-dimensional point are inside the area covered by the bounding box.

bool Kaim::Box2f::IsValid ( )
inline

Return true if m_min.x <= m_max.x && m_min.y <= m_max.y.

bool Kaim::Box2f::operator!= ( const Box2f other) const
inline

Returns true if either the minima and maxima of other is different from the minima or maxima of this object.

bool Kaim::Box2f::operator== ( const Box2f other) const
inline

Returns true if both the minima and maxima of other are the same as the minima and maxima of this object.

void Kaim::Box2f::Set ( const Vec2f min_,
const Vec2f max_ 
)
inline

Sets the extents of the bounding box to the specified values.

Parameters
min_The minima of the bounding box.
max_The maxima of the bounding box.
KyFloat32 Kaim::Box2f::SizeX ( )
inline

Retrieves the extents of the box along the X axis.

KyFloat32 Kaim::Box2f::SizeY ( )
inline

Retrieves the extents of the box along the Y axis.


The documentation for this class was generated from the following file: