48 return this->
m_data[index];
53 return this->
m_data[index];
58 template<
typename T,
typename S>
68 void set(T xmin, T xmax, T ymin, T ymax)
91 this->
m_data[0] = min.data()[0];
92 this->
m_data[2] = min.data()[1];
102 this->
m_data[1] = max.data()[0];
103 this->
m_data[3] = max.data()[1];
108 return (this->
min() + this->
max()) / 2.0f;
113 return this->
max() - this->
min();
122 Box2i(
int xmin,
int xmax,
int ymin,
int ymax);
131 Box2f(
float xmin,
float xmax,
float ymin,
float ymax);
137 template<
typename T,
typename S>
147 void set(T xmin, T xmax, T ymin, T ymax, T zmin, T zmax)
174 this->
m_data[0] = min.data()[0];
175 this->
m_data[2] = min.data()[1];
176 this->
m_data[4] = min.data()[2];
186 this->
m_data[1] = max.data()[0];
187 this->
m_data[3] = max.data()[1];
188 this->
m_data[5] = max.data()[2];
193 return (this->
min() + this->
max()) / 2.0f;
198 return this->
max() - this->
min();
207 Box3i(
int xmin,
int xmax,
int ymin,
int ymax,
int zmin,
int zmax);
217 Box3f(
float xmin,
float xmax,
float ymin,
float ymax,
float zmin,
float zmax);
228 BoundingBox(
float xmin,
float xmax,
float ymin,
float ymax,
float zmin,
float zmax);
The BoundingBox class inherits from Box3, specilizing the template parameters to float for element ty...
Definition box.h:224
void addPoints(const Float32Array &points)
bool isValid() const
Check if the bounding box is valid, which means that the minimum extents should be less than or equal...
BoundingBox & operator+=(Vector3f value)
Expands the current bounding box to encompass the minimum and maximum points of the other bounding bo...
bool inRange(Vector3f value) const
Check if a vector3f (a 3D point) is within this boundingbox.
BoundingBox(const Vector3f &min, const Vector3f &max)
void addPoint(const Vector3f &point)
BoundingBox()
Constructs a bounding box object, and initializes it.
BoundingBox(const BoundingBox &other)
BoundingBox(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
Constructs a bounding box object with the specified minimum and maximum extents.
BoundingBox & operator+=(const BoundingBox &other)
void addPoint(float x, float y, float z)
The Box2 is a templated class inheriting from the Box class, which represents a rectangular zone.
Definition box.h:60
void set(T xmin, T xmax, T ymin, T ymax)
Sets the four elements of the Box2 object with the four input arguments.
Definition box.h:68
S extent() const
Gets the extent of the Box2 object, which means the length and width of the rectangular zone.
Definition box.h:111
S max() const
Gets the maximum values, namely xmax and ymax, of the Box2 object.
Definition box.h:95
void set(const S &min, const S &max)
Sets the minimum and maximum values of the box.
Definition box.h:78
void setMin(const S &min)
Sets the minimum values, namely xmin and ymin, for the Box2 object.
Definition box.h:89
void setMax(const S &max)
Sets the maximum values, namely xmax and ymax, for the Box2 object.
Definition box.h:100
S center() const
Gets the center of the Box2 object, which means the center of the rectangular zone.
Definition box.h:106
S min() const
Gets the minimum values, namely xmin and ymin, of the Box2 object.
Definition box.h:84
Box2()
Contructs a Box2 object, a specialization of Box for storing 4 elements.
Definition box.h:63
The Box2f class inherits from Box2, specilizing the template parameters to float for element type and...
Definition box.h:128
Box2f()
Constructs a Box2f object, and sets its minimum and maximum extent to(0.0f, 0.0f) and(1....
Box2f(const Vector2f &min, const Vector2f &max)
Box2f(const Box2f &other)
Box2f(float xmin, float xmax, float ymin, float ymax)
The Box2i class inherits from Box2, specilizing the template parameters to int for element type and V...
Definition box.h:119
Box2i(const Box2i &other)
Box2i(const Vector2i &min, const Vector2i &max)
Box2i()
Constructs a Box2i object, and sets its minimum and maximum extent to(0, 0) and(1,...
Box2i(int xmin, int xmax, int ymin, int ymax)
The Box3 is a templated class inheriting from the Box class, which represents a cubic zone.
Definition box.h:139
void setMax(const S &max)
Sets the maximum values, namely xmax, ymax and zmax, for the Box3 object.
Definition box.h:184
void set(const S &min, const S &max)
Sets the minimum and maximum values of the box.
Definition box.h:160
void set(T xmin, T xmax, T ymin, T ymax, T zmin, T zmax)
Sets the six elements of the Box3 object with the six input arguments.
Definition box.h:147
S center() const
Gets the center of the Box3 object, which means the center of the cubic zone.
Definition box.h:191
S max() const
Gets the maximum values, namely xmax, ymax and zmax, of the Box3 object.
Definition box.h:179
S min() const
Gets the minimum values, namely xmin, ymin and zmin, for the Box3 object.
Definition box.h:166
Box3()
Contructs a Box3 object, a specialization of Box for storing 6 elements.
Definition box.h:142
S extent() const
Gets the extent of the Box3 object, which means the length, width and height of the cubic zone.
Definition box.h:196
void setMin(const S &min)
Sets the minimum values, namely xmin, ymin and zmin, for the Box3 object.
Definition box.h:172
The Box3f class inherits from Box3, specilizing the template parameters to float for element type and...
Definition box.h:214
Box3f(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
Box3f(const Vector3f &min, const Vector3f &max)
Box3f()
Constructs a Box3f object, and sets its minimum and maximum extent to(0.0f, 0.0f, 0....
Box3f(const Box3f &other)
The Box3i class inherits from Box3, specilizing the template parameters to int for element type and V...
Definition box.h:204
Box3i()
Constructs a Box3i object, and sets its minimum and maximum extent to(0, 0, 0) and(1,...
Box3i(const Box3i &other)
Box3i(int xmin, int xmax, int ymin, int ymax, int zmin, int zmax)
Box3i(const Vector3i &min, const Vector3i &max)
The Box is a templated class inheriting from the Tuple class,from which we can derive box2 and box3 c...
Definition box.h:38
T & operator[](int index)
Provides a read-write access to the element at a specific index(position) within the Box object.
Definition box.h:51
const T & operator[](int index) const
Provides a read-only access to the element at a specific index(position) within the Box object.
Definition box.h:46
Box(int size)
Constructs a box object.
Definition box.h:41
Definition typedarray.h:157
The Tuple is a templated class inheriting from the most basic class Variant.
Definition tuple.h:27
T * m_data
The data array of the Tuple.
Definition tuple.h:35
int size() const
Gets the number of elements of the Tuple.
Definition tuple.h:54
The class Vector2f inherits from the templated class of Vector2, and the template parameters are spec...
Definition vector.h:268
The class Vector2i inherits from the templated class of Vector2, and the template parameters are spec...
Definition vector.h:255
The class Vector3f inherits from the templated class of Vector3, and the template parameters are spec...
Definition vector.h:322
The class Vector3i inherits from the templated class of Vector3, and the template parameters are spec...
Definition vector.h:312