mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
Version 4.2.0
This commit is contained in:
committed by
Stephen Sinclair
parent
cf06b7598b
commit
a6381b9d38
@@ -5,66 +5,67 @@
|
||||
This class implements a spherical ball with
|
||||
radius, mass, position, and velocity parameters.
|
||||
|
||||
by Perry R. Cook, 1995 - 2002.
|
||||
by Perry R. Cook, 1995 - 2004.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#if !defined(__SPHERE_H)
|
||||
#define __SPHERE_H
|
||||
#ifndef STK_SPHERE_H
|
||||
#define STK_SPHERE_H
|
||||
|
||||
#include "Stk.h"
|
||||
#include "Vector3D.h"
|
||||
|
||||
class Sphere
|
||||
class Sphere : public Stk
|
||||
{
|
||||
public:
|
||||
//! Constructor taking an initial radius value.
|
||||
Sphere(double initRadius);
|
||||
Sphere(StkFloat radius = 1.0 );
|
||||
|
||||
//! Class destructor.
|
||||
~Sphere();
|
||||
|
||||
//! Set the 3D center position of the sphere.
|
||||
void setPosition(double anX, double aY, double aZ);
|
||||
void setPosition(StkFloat x, StkFloat y, StkFloat z);
|
||||
|
||||
//! Set the 3D velocity of the sphere.
|
||||
void setVelocity(double anX, double aY, double aZ);
|
||||
void setVelocity(StkFloat x, StkFloat y, StkFloat z);
|
||||
|
||||
//! Set the radius of the sphere.
|
||||
void setRadius(double aRadius);
|
||||
void setRadius(StkFloat radius);
|
||||
|
||||
//! Set the mass of the sphere.
|
||||
void setMass(double aMass);
|
||||
void setMass(StkFloat mass);
|
||||
|
||||
//! Get the current position of the sphere as a 3D vector.
|
||||
Vector3D* getPosition();
|
||||
|
||||
//! Get the relative position of the given point to the sphere as a 3D vector.
|
||||
Vector3D* getRelativePosition(Vector3D *aPosition);
|
||||
Vector3D* getRelativePosition(Vector3D *position);
|
||||
|
||||
//! Set the velcoity of the sphere as a 3D vector.
|
||||
double getVelocity(Vector3D* aVelocity);
|
||||
StkFloat getVelocity(Vector3D* velocity);
|
||||
|
||||
//! Returns the distance from the sphere boundary to the given position (< 0 if inside).
|
||||
double isInside(Vector3D *aPosition);
|
||||
StkFloat isInside(Vector3D *position);
|
||||
|
||||
//! Get the current sphere radius.
|
||||
double getRadius();
|
||||
StkFloat getRadius();
|
||||
|
||||
//! Get the current sphere mass.
|
||||
double getMass();
|
||||
StkFloat getMass();
|
||||
|
||||
//! Increase the current sphere velocity by the given 3D components.
|
||||
void addVelocity(double anX, double aY, double aZ);
|
||||
void addVelocity(StkFloat x, StkFloat y, StkFloat z);
|
||||
|
||||
//! Move the sphere for the given time increment.
|
||||
void tick(double timeIncrement);
|
||||
void tick(StkFloat timeIncrement);
|
||||
|
||||
private:
|
||||
Vector3D *myPosition;
|
||||
Vector3D *myVelocity;
|
||||
Vector3D workingVector;
|
||||
double myRadius;
|
||||
double myMass;
|
||||
Vector3D position_;
|
||||
Vector3D velocity_;
|
||||
Vector3D workingVector_;
|
||||
StkFloat radius_;
|
||||
StkFloat mass_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user