NAP
Public Member Functions | Public Attributes | List of all members
Box Class Referencefinal

#include <box.h>

Public Member Functions

 Box ()=default
 
 Box (float width, float height, float depth)
 
 Box (float width, float height, float depth, const glm::vec3 &position)
 
 Box (const glm::vec2 &xCoordinates, const glm::vec2 &yCoordinates, const glm::vec2 &zCoordinates)
 
 Box (const glm::vec3 &min, const glm::vec3 &max)
 
float getWidth () const
 
float getHeight () const
 
float getDepth () const
 
bool inside (const glm::vec3 &point) const
 
const glm::vec3 & getMin () const
 
const glm::vec3 & getMax () const
 
glm::vec3 getDimensions () const
 
glm::vec3 getCenter () const
 

Public Attributes

glm::vec3 mMinCoordinates = { -0.5f, -0.5f, -0.5f }
 Box min coordinates. More...
 
glm::vec3 mMaxCoordinates = { 0.5f, 0.5f, 0.5f }
 Box max coordinates. More...
 

Description

Simple 3D box. when using the default constructor the box dimensions are 1 unit in every axis normalized around center (0,0,0).

Constructor & Destructor Documentation

◆ Box() [1/5]

Box ( )
default

◆ Box() [2/5]

Box ( float  width,
float  height,
float  depth 
)

Creates a box around the origin using provided dimensions

Parameters
widththe width of the box
heightthe height of the box
depththe depth of the box

◆ Box() [3/5]

Box ( float  width,
float  height,
float  depth,
const glm::vec3 &  position 
)

Creates a box at the given position using the provided dimensions

Parameters
widththe width of the box
heightthe height of the box
depththe depth of the box
positionof the box

◆ Box() [4/5]

Box ( const glm::vec2 &  xCoordinates,
const glm::vec2 &  yCoordinates,
const glm::vec2 &  zCoordinates 
)

Creates a box using the specified dimensions in every axis

Parameters
xCoordinatesthe min / max horizontal coordinates of the box
yCoordinatesthe min / max vertical coordinates of the box
zCoordinatesthe min / max depth coordinates of the box

◆ Box() [5/5]

Box ( const glm::vec3 &  min,
const glm::vec3 &  max 
)

Creates a box using the 2 specified min / max coordinates

Parameters
minthe min point coordinates
maxthe max point coordinates

Member Function Documentation

◆ getCenter()

glm::vec3 getCenter ( ) const
Returns
center coordinates of the box

◆ getDepth()

float getDepth ( ) const
Returns
the absolute depth (length) of the box

◆ getDimensions()

glm::vec3 getDimensions ( ) const
Returns
the absolute bounding box dimension (width, height, depth)

◆ getHeight()

float getHeight ( ) const
Returns
the absolute height of the box

◆ getMax()

const glm::vec3& getMax ( ) const
Returns
the max box coordinates

◆ getMin()

const glm::vec3& getMin ( ) const
Returns
the min box coordinates

◆ getWidth()

float getWidth ( ) const
Returns
the absolute width of the box

◆ inside()

bool inside ( const glm::vec3 &  point) const
Returns
if the point is inside the box, this excludes the edge

Member Data Documentation

◆ mMaxCoordinates

glm::vec3 mMaxCoordinates = { 0.5f, 0.5f, 0.5f }

Box max coordinates.

◆ mMinCoordinates

glm::vec3 mMinCoordinates = { -0.5f, -0.5f, -0.5f }

Box min coordinates.