![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Represents an axis-aligned bounding cube for collision detection and physics. More...
#include <BoundaryCube.h>

Public Member Functions | |
| BoundaryCube (Object3D *object) | |
| Constructs a BoundaryCube object based on the given 3D object. | |
| BoundaryCube (Vector3D centerPosition, Vector3D objectSize) | |
| Constructs a BoundaryCube object with a specified center and size. | |
| Vector3D | GetPosition () |
| Retrieves the current position of the cube. | |
| Vector3D | GetSize () |
| Retrieves the size of the cube. | |
| Vector3D | GetMaximum () |
| Retrieves the maximum coordinates of the cube. | |
| Vector3D | GetMinimum () |
| Retrieves the minimum coordinates of the cube. | |
| void | Update (float dT, Vector3D acceleration, Quaternion rotation) |
| Updates the cube's state based on time, acceleration, and rotation. | |
| Vector3D | IsIntersecting (BoundaryCube *bO) |
| Checks for intersection with another BoundaryCube. | |
| Vector3D | IsIntersecting (BoundarySphere *bO) |
| Checks for intersection with a BoundarySphere. | |
| void | CollideSphere (float elasticity, BoundarySphere *bO) |
| Handles collision with a BoundarySphere. | |
Public Attributes | |
| Vector3D | velocity = Vector3D(0, 0, 0) |
| Velocity of the cube. | |
| Vector3D | position = Vector3D(0, 0, 0) |
| Current position of the cube. | |
Private Attributes | |
| Quaternion | previousRotation |
| Previous rotation of the object. | |
| Vector3D | centerPosition |
| Center position of the bounding cube. | |
| Vector3D | maximum |
| Maximum coordinates of the bounding cube. | |
| Vector3D | minimum |
| Minimum coordinates of the bounding cube. | |
Represents an axis-aligned bounding cube for collision detection and physics.
Definition at line 24 of file BoundaryCube.h.
| BoundaryCube | ( | Object3D * | object | ) |
Constructs a BoundaryCube object based on the given 3D object.
| object | Pointer to an Object3D instance to initialize the boundary cube. |
Definition at line 3 of file BoundaryCube.cpp.
References centerPosition, maximum, and minimum.
| BoundaryCube | ( | Vector3D | centerPosition, |
| Vector3D | objectSize | ||
| ) |
Constructs a BoundaryCube object with a specified center and size.
| centerPosition | Center position of the cube. |
| objectSize | Size of the cube. |
Definition at line 8 of file BoundaryCube.cpp.
References centerPosition, maximum, and minimum.
| void CollideSphere | ( | float | elasticity, |
| BoundarySphere * | bO | ||
| ) |
Handles collision with a BoundarySphere.
| elasticity | Elasticity coefficient for the collision. |
| bO | Pointer to the BoundarySphere. |
Definition at line 66 of file BoundaryCube.cpp.
References Mathematics::Constrain(), BoundarySphere::GetRadius(), IsIntersecting(), maximum, minimum, BoundarySphere::position, BoundarySphere::velocity, Vector3D::X, Vector3D::Y, and Vector3D::Z.
Referenced by BoundaryMotionSimulator::Update().
| Vector3D GetMaximum | ( | ) |
Retrieves the maximum coordinates of the cube.
Definition at line 22 of file BoundaryCube.cpp.
References maximum.
Referenced by IsIntersecting().
| Vector3D GetMinimum | ( | ) |
Retrieves the minimum coordinates of the cube.
Definition at line 26 of file BoundaryCube.cpp.
References minimum.
Referenced by IsIntersecting().
| Vector3D GetPosition | ( | ) |
Retrieves the current position of the cube.
Definition at line 14 of file BoundaryCube.cpp.
References centerPosition.
| Vector3D GetSize | ( | ) |
Retrieves the size of the cube.
Definition at line 18 of file BoundaryCube.cpp.
| Vector3D IsIntersecting | ( | BoundaryCube * | bO | ) |
Checks for intersection with another BoundaryCube.
| bO | Pointer to the other BoundaryCube. |
Definition at line 38 of file BoundaryCube.cpp.
References GetMaximum(), GetMinimum(), maximum, minimum, Vector3D::X, Vector3D::Y, and Vector3D::Z.
Referenced by CollideSphere().
| Vector3D IsIntersecting | ( | BoundarySphere * | bO | ) |
Checks for intersection with a BoundarySphere.
| bO | Pointer to the BoundarySphere. |
Definition at line 51 of file BoundaryCube.cpp.
References BoundarySphere::GetRadius(), maximum, minimum, BoundarySphere::position, Vector3D::X, Vector3D::Y, and Vector3D::Z.
| void Update | ( | float | dT, |
| Vector3D | acceleration, | ||
| Quaternion | rotation | ||
| ) |
Updates the cube's state based on time, acceleration, and rotation.
| dT | Time step in seconds. |
| acceleration | Acceleration vector applied to the cube. |
| rotation | Rotation quaternion applied to the cube. |
Definition at line 30 of file BoundaryCube.cpp.
References Quaternion::MultiplicativeInverse(), Quaternion::Multiply(), position, previousRotation, Quaternion::RotateVector(), and velocity.
|
private |
Center position of the bounding cube.
Definition at line 27 of file BoundaryCube.h.
Referenced by BoundaryCube(), BoundaryCube(), and GetPosition().
|
private |
Maximum coordinates of the bounding cube.
Definition at line 28 of file BoundaryCube.h.
Referenced by BoundaryCube(), BoundaryCube(), CollideSphere(), GetMaximum(), GetSize(), IsIntersecting(), and IsIntersecting().
|
private |
Minimum coordinates of the bounding cube.
Definition at line 29 of file BoundaryCube.h.
Referenced by BoundaryCube(), BoundaryCube(), CollideSphere(), GetMinimum(), GetSize(), IsIntersecting(), and IsIntersecting().
|
private |
Previous rotation of the object.
Definition at line 26 of file BoundaryCube.h.
Referenced by Update().