9 for (
int i = 0; i < objectCount; i++) {
16 bS[i]->
velocity.
X = ((float)random(0, 999) / 1000.0f) * range - range / 2.0f;
17 bS[i]->
velocity.
Y = ((float)random(0, 999) / 1000.0f) * range - range / 2.0f;
18 bS[i]->
velocity.
Z = ((float)random(0, 999) / 1000.0f) * range - range / 2.0f;
24 vRand.
X = 1.0f + ((float)random(0, 999) / 1000.0f) * range;
25 vRand.
Y = 1.0f + ((float)random(0, 999) / 1000.0f) * range;
26 vRand.
Z = 1.0f + ((float)random(0, 999) / 1000.0f) * range;
Defines the BoundaryMotionSimulator class for simulating motion and collisions of boundary objects.
Represents an axis-aligned bounding cube for collision detection and physics.
void CollideSphere(float elasticity, BoundarySphere *bO)
Handles collision with a BoundarySphere.
void Randomize(float range)
Randomizes the velocities of all boundary spheres within a specified range.
void Update(float dT, Vector3D acceleration, Quaternion rotation)
Updates the simulation by applying physics and resolving collisions.
int sphereCount
Number of boundary spheres.
BoundaryMotionSimulator(Object3D **objects, int objectCount, BoundaryCube *bC, float radius, float elasticity)
Constructs a BoundaryMotionSimulator.
float elasticity
Elasticity coefficient for collisions.
Vector3D RandomRatio(float range)
Generates a randomized vector with ratios for X, Y, and Z axes.
BoundarySphere ** bS
Array of pointers to the boundary spheres.
BoundaryCube * bC
Pointer to the boundary cube.
Represents a spherical boundary object for motion and collision simulations.
void Update(float dT, Vector3D acceleration, Quaternion rotation)
Updates the sphere's position and velocity based on acceleration and rotation.
Vector3D velocity
Velocity vector of the sphere.
void Collide(float elasticity, BoundarySphere *bO)
Resolves collision between this sphere and another BoundarySphere.
Object3D * GetObject3D()
Gets the associated Object3D of the sphere.
Represents a 3D object with geometry, material, and transformation data.
void ResetVertices()
Resets the object's vertices to their original positions.
Transform * GetTransform()
Retrieves the object's transformation data.
A mathematical construct representing a rotation in 3D space.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
float Z
The Z-component of the 3D vector.
float X
The X-component of the 3D vector.
float Y
The Y-component of the 3D vector.