public class PhysicsContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
VERSION |
Constructor and Description |
---|
PhysicsContext(int sRate)
Constructor without specifying the sketch display rate (defaults to 30 FPS),
or the parameter system (defaults to algo parameters)
|
PhysicsContext(int sRate,
int displayRate)
Constructor without specifying the parameter system (defaults to algo
parameters)
|
PhysicsContext(int sRate,
int displayRate,
paramSystem sys) |
PhysicsContext(int sRate,
paramSystem sys)
Constructor without specifying the sketch display rate (defaults to 30 FPS).
|
Modifier and Type | Method and Description |
---|---|
int |
addInteractionToSubset(Interaction l,
java.lang.String subsetName) |
int |
addMassToSubset(Mass m,
java.lang.String subsetName)
Add a Mass module to a given subset.
|
void |
addParamController(java.lang.String name,
java.lang.String subsetName,
java.lang.String paramName,
float rampTime) |
void |
clearModel()
Delete all modules in the model and start from scratch.
|
CollisionEngine |
colEngine()
Get the collision engine.
|
void |
computeNSteps(int N)
Explicitly compute N steps of the physical simulation.
|
void |
computeScene()
Run the physics simulation (call once every draw method).
|
void |
computeSingleStep()
Compute a single step of the physical simulation.
|
int |
createInteractionSubset(java.lang.String name)
Create an empty Interaction module subset item.
|
int |
createMassSubset(java.lang.String name)
Create an empty Mass module subset item.
|
int |
getErrorCode() |
double |
getGlobalFriction() |
Vect3D |
getGlobalGravity() |
Medium |
getGlobalMedium() |
java.util.concurrent.locks.Lock |
getLock() |
ParamController |
getParamController(java.lang.String name) |
int |
getSimRate()
Get the simulation's sample rate.
|
void |
init()
Initialise the physical model once all the modules have been created.
|
PhyModel |
mdl()
Get the top level physical model of the physics context.
|
void |
setGlobalFriction(double d) |
void |
setGlobalGravity(double gx,
double gy,
double gz) |
void |
setGlobalGravity(Vect3D g) |
int |
setParamForInteractionSubset(java.lang.String subsetName,
param p,
double value) |
int |
setParamForMassSubset(java.lang.String subsetName,
param p,
double value) |
void |
setSimRate(int rate)
Set the simulation's sample rate.
|
void |
setVelUnit(velUnit v) |
static java.lang.String |
version()
return the version of the Library.
|
void |
welcome() |
public static final java.lang.String VERSION
public PhysicsContext(int sRate, int displayRate, paramSystem sys)
public PhysicsContext(int sRate, int displayRate)
sRate
- the physics sample ratepublic PhysicsContext(int sRate)
sRate
- the physics sample ratepublic PhysicsContext(int sRate, paramSystem sys)
sRate
- the physics sample ratepublic void clearModel()
public int getSimRate()
public void setSimRate(int rate)
rate
- the rate to set the simulation to (physics frame-per-second).public void setVelUnit(velUnit v)
public int getErrorCode()
public PhyModel mdl()
public CollisionEngine colEngine()
public void computeScene()
public void computeNSteps(int N)
N
- number of steps to compute.public void computeSingleStep()
public java.util.concurrent.locks.Lock getLock()
public Medium getGlobalMedium()
public void setGlobalFriction(double d)
public void setGlobalGravity(Vect3D g)
public void setGlobalGravity(double gx, double gy, double gz)
public double getGlobalFriction()
public Vect3D getGlobalGravity()
public void init()
public void addParamController(java.lang.String name, java.lang.String subsetName, java.lang.String paramName, float rampTime)
public ParamController getParamController(java.lang.String name)
public int createMassSubset(java.lang.String name)
name
- the identifier for this subset.public int addMassToSubset(Mass m, java.lang.String subsetName)
m
- the mass module to reference.subsetName
- the subset to add the module to.public int createInteractionSubset(java.lang.String name)
name
- the identifier for this subset.public int addInteractionToSubset(Interaction l, java.lang.String subsetName)
public int setParamForMassSubset(java.lang.String subsetName, param p, double value)
public int setParamForInteractionSubset(java.lang.String subsetName, param p, double value)
public void welcome()
public static java.lang.String version()
Processing Library miPhysics by James Leonard. (c) 2019