public class PhyModel extends PhyObject
Constructor and Description |
---|
PhyModel(java.lang.String name,
Medium med)
Create a physical model with a given name and a specific medium.
|
Modifier and Type | Method and Description |
---|---|
<T extends InOut> |
addInOut(java.lang.String name,
T mod,
Mass m)
Add an InOut to the model.
|
<T extends InOut> |
addInOut(java.lang.String name,
T mod,
java.lang.String m_id)
Add an InOut to the model.
|
<T extends Interaction> |
addInteraction(java.lang.String name,
T inter,
Mass m1)
Add an interaction (special case for interactions with only one mass (Plane Contact).
|
<T extends Interaction> |
addInteraction(java.lang.String name,
T inter,
Mass m1,
Mass m2)
Add an interaction to the model.
|
<T extends Interaction> |
addInteraction(java.lang.String name,
T inter,
java.lang.String m_id1)
Add an interaction (special case for interactions with only one mass (Plane Contact).
|
<T extends Interaction> |
addInteraction(java.lang.String name,
T inter,
java.lang.String m_id1,
java.lang.String m_id2)
Add an interaction to the model.
|
<T extends Mass> |
addMass(java.lang.String name,
T m)
Add a mass to the model.
|
<T extends Mass> |
addMass(java.lang.String name,
T m,
Medium med)
Add a mass to the model, specifying the medium.
|
void |
addPhyModel(PhyModel mac)
Add a sub-model to this physical model
|
void |
calcSpacePrint()
Calculate the space print of all masses in the model (used for collisions)
|
void |
changeToFixedPoint(Mass m)
Change a mass to a fixed point.
|
void |
changeToFixedPoint(java.lang.String masName)
Change a mass to a fixed point (by name).
|
void |
clear()
Clear the physical model (remove all elements).
|
void |
compute()
Compute the phyiscal model.
|
java.util.ArrayList<Driver3D> |
getDrivers()
Get a list of all the drivers in this physical model.
|
Mass |
getFirstMass()
Get the first mass in the model (in order of creation).
|
Interaction |
getInteraction(java.lang.String name)
Access an interaction in the model, defined by name.
|
java.util.ArrayList<Interaction> |
getInteractionList()
Get a list of all interactions (excluding sub-models) inside this model.
|
Mass |
getLastMass()
Get the last mass in the model (in order of creation).
|
java.util.concurrent.locks.Lock |
getLock() |
Mass |
getMass(java.lang.String name)
Access a mass in the model, defined by name.
|
java.util.ArrayList<Mass> |
getMassList()
Get the list of all masses (excluding sub-models) inside this model.
|
int |
getNumberOfInteractions()
Get number of interactions (excluding sub-models)
|
int |
getNumberOfMasses()
Get number of masses (excluding sub-models)
|
java.util.ArrayList<Observer3D> |
getObservers()
Get a list of all the observers in this physical model.
|
double |
getParam(param p) |
PhyModel |
getPhyModel(java.lang.String name)
Find a sub-model in this model by name.
|
SpacePrint |
getSpacePrint()
Get the space print for this model.
|
java.util.ArrayList<PhyModel> |
getSubModels()
Get all sub-models inside this model.
|
massType |
getType() |
void |
init()
Initialise the model by calculating initial delayed distances for interactions.
|
boolean |
massExists(java.lang.String name)
Check if a mass exists in the model.
|
int |
numberOfInterTypes()
Get the number of interaction-type module in this model and all sub-models.
|
int |
numberOfMassTypes()
Get the number of mass-type module in this model and all sub-models.
|
int |
removeInteraction(Interaction l)
Remove an interaction from the model.
|
int |
removeInteraction(java.lang.String name)
Remove an interaction from the model (by name).
|
int |
removeMassAndConnectedInteractions(Mass m)
Remove a mass and connected interactions from the model.
|
int |
removeMassAndConnectedInteractions(java.lang.String mName)
Remove a mass and connected interactions from the model (by name).
|
void |
rotate(float x,
float y,
float z)
Rotate the entire model.
|
int |
setParam(param p,
double val) |
void |
setSimRate(int SR)
Set the simulation rate for this model.
|
void |
translate(float tx,
float ty,
float tz)
Translate the entire model.
|
void |
translateAndRotate(float tx,
float ty,
float tz,
float x_angle,
float y_angle,
float z_angle)
Translate and rotate the entire model.
|
public PhyModel(java.lang.String name, Medium med)
name
- name of the model.med
- physical medium (defining gravity and air friction).public void init()
public void clear()
public Mass getMass(java.lang.String name)
name
- the name of the mass module.public Interaction getInteraction(java.lang.String name)
name
- the name of the interaction module.public PhyModel getPhyModel(java.lang.String name)
name
- name of the sub-model.public void addPhyModel(PhyModel mac)
mac
- the sub-model to add.public <T extends Mass> T addMass(java.lang.String name, T m)
T
- template type for mass.name
- name of the mass.m
- the mass object.public <T extends Mass> T addMass(java.lang.String name, T m, Medium med)
T
- template type for mass.name
- mass name.m
- the mass object.med
- the medium.public <T extends Interaction> T addInteraction(java.lang.String name, T inter, Mass m1)
T
- template type for interaction.name
- name of the interaction.inter
- the interaction object.m1
- connected mass.public <T extends Interaction> T addInteraction(java.lang.String name, T inter, java.lang.String m_id1)
T
- template type for interaction.name
- name of the interaction.inter
- the interaction object.m_id1
- name of the connected mass.public <T extends Interaction> T addInteraction(java.lang.String name, T inter, Mass m1, Mass m2)
T
- template type for interaction.name
- name of the interaction.inter
- the interaction object.m1
- connected mass 1.m2
- connected mass 2.public <T extends Interaction> T addInteraction(java.lang.String name, T inter, java.lang.String m_id1, java.lang.String m_id2)
T
- template type for interaction.name
- name of the interaction.inter
- the interaction object.m_id1
- name of connected mass 1.m_id2
- name of connected mass 2.public <T extends InOut> T addInOut(java.lang.String name, T mod, Mass m)
T
- template type for InOut module.name
- name of the in/out module.mod
- the module.m
- the mass that this module is connected to.public <T extends InOut> T addInOut(java.lang.String name, T mod, java.lang.String m_id)
T
- template type for InOut module.name
- name of the in/out module.mod
- the module.m_id
- name of the mass that this module is connected to.public java.util.ArrayList<PhyModel> getSubModels()
public java.util.ArrayList<Mass> getMassList()
public java.util.ArrayList<Interaction> getInteractionList()
public int numberOfMassTypes()
public int numberOfInterTypes()
public int getNumberOfMasses()
public int getNumberOfInteractions()
public java.util.ArrayList<Observer3D> getObservers()
public java.util.ArrayList<Driver3D> getDrivers()
public boolean massExists(java.lang.String name)
name
- the name of the mass.public void setSimRate(int SR)
SR
- the simulation rate (in Hz).public int removeInteraction(Interaction l)
l
- interaction to remove.public int removeInteraction(java.lang.String name)
name
- name of the interaction to remove.public int removeMassAndConnectedInteractions(Mass m)
m
- mass to remove.public int removeMassAndConnectedInteractions(java.lang.String mName)
mName
- mass to remove.public void changeToFixedPoint(java.lang.String masName)
masName
- name of mass to change.public void changeToFixedPoint(Mass m)
m
- mass to change.public Mass getFirstMass()
public Mass getLastMass()
public void calcSpacePrint()
public SpacePrint getSpacePrint()
public void translate(float tx, float ty, float tz)
tx
- translation along x.ty
- translation along y.tz
- translation along z.public void rotate(float x, float y, float z)
x
- rotation along x.y
- rotation along y.z
- rotation along z.public void translateAndRotate(float tx, float ty, float tz, float x_angle, float y_angle, float z_angle)
tx
- translation along x.ty
- translation along y.tz
- translation along z.x_angle
- rotation along x.y_angle
- rotation along y.z_angle
- rotation along z.public java.util.concurrent.locks.Lock getLock()
Processing Library miPhysics by James Leonard. (c) 2019