24 Sphere( StkFloat radius = 1.0 ) { radius_ = radius; mass_ = 1.0; };
27 void setPosition( StkFloat x, StkFloat y, StkFloat z ) { position_.setXYZ(x, y, z); };
30 void setVelocity( StkFloat x, StkFloat y, StkFloat z ) { velocity_.setXYZ(x, y, z); };
33 void setRadius( StkFloat radius ) { radius_ = radius; };
36 void setMass( StkFloat mass ) { mass_ = mass; };
54 StkFloat
getMass(
void ) {
return mass_; };
60 void tick( StkFloat timeIncrement );
72 position_.
setX(position_.getX() + (timeIncrement * velocity_.getX()));
73 position_.setY(position_.getY() + (timeIncrement * velocity_.getY()));
74 position_.setZ(position_.getZ() + (timeIncrement * velocity_.getZ()));
StkFloat isInside(Vector3D *position)
Returns the distance from the sphere boundary to the given position (< 0 if inside).
StkFloat getRadius(void)
Get the current sphere radius.
Definition Sphere.h:51
void setMass(StkFloat mass)
Set the mass of the sphere.
Definition Sphere.h:36
void addVelocity(StkFloat x, StkFloat y, StkFloat z)
Increase the current sphere velocity by the given 3D components.
StkFloat getVelocity(Vector3D *velocity)
Set the velocity of the sphere as a 3D vector.
Sphere(StkFloat radius=1.0)
Constructor taking an initial radius value.
Definition Sphere.h:24
Vector3D * getRelativePosition(Vector3D *position)
Get the relative position of the given point to the sphere as a 3D vector.
Vector3D * getPosition(void)
Get the current position of the sphere as a 3D vector.
Definition Sphere.h:39
StkFloat getMass(void)
Get the current sphere mass.
Definition Sphere.h:54
void setRadius(StkFloat radius)
Set the radius of the sphere.
Definition Sphere.h:33
void setVelocity(StkFloat x, StkFloat y, StkFloat z)
Set the 3D velocity of the sphere.
Definition Sphere.h:30
void setPosition(StkFloat x, StkFloat y, StkFloat z)
Set the 3D center position of the sphere.
Definition Sphere.h:27
void tick(StkFloat timeIncrement)
Move the sphere for the given time increment.
Definition Sphere.h:70
Stk(void)
Default constructor.
STK 3D vector class.
Definition Vector3D.h:20
void setX(StkFloat x)
Set the X value.
Definition Vector3D.h:42
The STK namespace.
Definition ADSR.h:6