![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Simulates motion and collision interactions between a BoundaryCube and multiple BoundarySpheres. More...
#include <BoundaryMotionSimulator.h>
Public Member Functions | |
BoundaryMotionSimulator (Object3D **objects, int objectCount, BoundaryCube *bC, float radius, float elasticity) | |
Constructs a BoundaryMotionSimulator. | |
void | Randomize (float range) |
Randomizes the velocities of all boundary spheres within a specified range. | |
Vector3D | RandomRatio (float range) |
Generates a randomized vector with ratios for X, Y, and Z axes. | |
void | Update (float dT, Vector3D acceleration, Quaternion rotation) |
Updates the simulation by applying physics and resolving collisions. | |
Private Attributes | |
BoundaryCube * | bC |
Pointer to the boundary cube. | |
BoundarySphere ** | bS |
Array of pointers to the boundary spheres. | |
int | sphereCount |
Number of boundary spheres. | |
float | elasticity = 0.8f |
Elasticity coefficient for collisions. | |
Simulates motion and collision interactions between a BoundaryCube and multiple BoundarySpheres.
Definition at line 25 of file BoundaryMotionSimulator.h.
BoundaryMotionSimulator | ( | Object3D ** | objects, |
int | objectCount, | ||
BoundaryCube * | bC, | ||
float | radius, | ||
float | elasticity | ||
) |
Constructs a BoundaryMotionSimulator.
objects | Array of Object3D pointers representing the objects. |
objectCount | Number of objects in the simulation. |
bC | Pointer to the boundary cube. |
radius | Radius of the boundary spheres. |
elasticity | Elasticity coefficient for collisions. |
Definition at line 3 of file BoundaryMotionSimulator.cpp.
References bC, bS, elasticity, and sphereCount.
Randomizes the velocities of all boundary spheres within a specified range.
range | Maximum velocity range (mm/s). |
Definition at line 14 of file BoundaryMotionSimulator.cpp.
References bS, sphereCount, BoundarySphere::velocity, Vector3D::X, Vector3D::Y, and Vector3D::Z.
Referenced by PhysicsSimulator::PhysicsSimulator().
Generates a randomized vector with ratios for X, Y, and Z axes.
range | Maximum range for each axis ratio. |
Definition at line 22 of file BoundaryMotionSimulator.cpp.
References Vector3D::X, Vector3D::Y, and Vector3D::Z.
Referenced by Update().
void Update | ( | float | dT, |
Vector3D | acceleration, | ||
Quaternion | rotation | ||
) |
Updates the simulation by applying physics and resolving collisions.
dT | Time step in seconds. |
acceleration | Acceleration vector applied to the spheres. |
rotation | Rotation quaternion applied to the spheres. |
Definition at line 30 of file BoundaryMotionSimulator.cpp.
References bC, bS, BoundarySphere::Collide(), BoundaryCube::CollideSphere(), elasticity, BoundarySphere::GetObject3D(), Object3D::GetTransform(), RandomRatio(), Object3D::ResetVertices(), Transform::SetPosition(), sphereCount, BoundarySphere::Update(), and BoundarySphere::velocity.
Referenced by PhysicsSimulator::Update().
|
private |
Pointer to the boundary cube.
Definition at line 27 of file BoundaryMotionSimulator.h.
Referenced by BoundaryMotionSimulator(), and Update().
|
private |
Array of pointers to the boundary spheres.
Definition at line 28 of file BoundaryMotionSimulator.h.
Referenced by BoundaryMotionSimulator(), Randomize(), and Update().
Elasticity coefficient for collisions.
Definition at line 30 of file BoundaryMotionSimulator.h.
Referenced by BoundaryMotionSimulator(), and Update().
|
private |
Number of boundary spheres.
Definition at line 29 of file BoundaryMotionSimulator.h.
Referenced by BoundaryMotionSimulator(), Randomize(), and Update().