Skip to content

Commit

Permalink
Javadoc (in progress) and cleaning examples in distro
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslnrd committed May 5, 2020
1 parent ce94368 commit 95d2990
Show file tree
Hide file tree
Showing 28 changed files with 423 additions and 35 deletions.
5 changes: 5 additions & 0 deletions examples/3_Haptics/EnclosedMarbles/EnclosedMarbles.pde
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
WARNING : Haptic models haven't been ported to the new API yet
this model won't currently build
*/

/* LIB imports */
import miPhysics.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
WARNING : Haptic models haven't been ported to the new API yet
this model won't currently build
*/


/**
**********************************************************************************************************************
*/
Expand Down
6 changes: 6 additions & 0 deletions examples/3_Haptics/HapticBeam/HapticBeam.pde
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
WARNING : Haptic models haven't been ported to the new API yet
this model won't currently build
*/


/**
**********************************************************************************************************************
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
WARNING : Haptic models haven't been ported to the new API yet
this model won't currently build
*/


/**
**********************************************************************************************************************
*/
Expand Down
6 changes: 6 additions & 0 deletions examples/3_Haptics/HeavyMassChain/HeavyMassChain.pde
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
WARNING : Haptic models haven't been ported to the new API yet
this model won't currently build
*/


/**
**********************************************************************************************************************
*/
Expand Down
7 changes: 7 additions & 0 deletions examples/3_Haptics/MultipleStrings/MultipleStrings.pde
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
WARNING : Haptic models haven't been ported to the new API yet
this model won't currently build
*/



/**
**********************************************************************************************************************
*/
Expand Down
7 changes: 7 additions & 0 deletions examples/3_Haptics/PluckedString/PluckedString.pde
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
WARNING : Haptic models haven't been ported to the new API yet
this model won't currently build
*/



/**
**********************************************************************************************************************
*/
Expand Down
6 changes: 6 additions & 0 deletions examples/3_Haptics/RecoilString/RecoilString.pde
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
WARNING : Haptic models haven't been ported to the new API yet
this model won't currently build
*/


/**
**********************************************************************************************************************
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
WARNING : Haptic models haven't been ported to the new API yet
this model won't currently build
*/



/**
**********************************************************************************************************************
*/
Expand Down
7 changes: 7 additions & 0 deletions resources/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ ${line}
<path refid="classpath" />
</classpath>
<compilerarg value="-Xlint" />

</javac>
<copy todir="${project.bin.data}">
<fileset dir="${project.data}" excludes="README" />
Expand All @@ -181,6 +182,12 @@ ${line}
<exclude name="**/*README*" />
<!-- not including the ModelLoader examples for now -->
<exclude name="**/5_ModelLoader/**" />
<exclude name="**/2_Audio/control/**" />
<exclude name="**/2_Audio/BeamBender/**" />
<exclude name="**/4_TopoGenerator/**" />
<exclude name="**/TestExample/**" />
<exclude name="**/collisionEngineTester/**" />
<exclude name="**/TopoCreatorTest**/**" />
</fileset>
</copy>
<copy todir="${project.tmp}/${project.name}/src">
Expand Down
5 changes: 5 additions & 0 deletions src/miPhysics/Engine/Attractor3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
*/
public class Attractor3D extends Interaction {

/**
* Attractor module
* @param limitDist threshold distance below which the attraction force is null.
* @param attrFactor the attraction force factor.
*/
public Attractor3D(double limitDist, double attrFactor) {
super(limitDist, null, null);
m_attrFactor = attrFactor;
Expand Down
13 changes: 13 additions & 0 deletions src/miPhysics/Engine/AutoCollider.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

//TODO : If you change the underlying physical model during simulation, it will break! Make safer

/**
* Autocollision handling mechanism for a physical model
*/
public class AutoCollider {

PhyModel m_model;
Expand Down Expand Up @@ -118,6 +121,16 @@ private class Pair {
}
}

/**
* Setup an auto-collider system for a given physical model.
* @param mdl the model.
* @param size the size of individual voxels
* @param nbX voxels along X dimension
* @param nbY voxels along Y dimension
* @param nbZ voxels along Z dimension
* @param K stiffness of autocollision interactions
* @param Z damping of autocollision interactions
*/
public AutoCollider(PhyModel mdl, double size, int nbX, int nbY, int nbZ, double K, double Z){
// save the model reference
this.m_model = mdl;
Expand Down
2 changes: 0 additions & 2 deletions src/miPhysics/Engine/Bubble3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public class Bubble3D extends Interaction {
* @param distance distance (radius) between both Mats.
* @param K_param stiffness parameter.
* @param Z_param damping parameter.
* @param m1 first (enclosed) Mass module.
* @param m2 second (enclosing) Mass module.
*/
public Bubble3D(double distance, double K_param, double Z_param) {
super(distance, null, null);
Expand Down
22 changes: 22 additions & 0 deletions src/miPhysics/Engine/CollisionEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

import java.util.ArrayList;

/**
* The global collision engine for the physics context. It can handle both collisions between
* two sub-models (physical models) and auto-collision of the masses inside a physical model.
*/
public class CollisionEngine {

ArrayList<MassCollider> m_colliders = new ArrayList<>();
Expand All @@ -11,6 +15,13 @@ public CollisionEngine(){

}

/**
* Register a collision between two sub-models.
* @param m1 the first physical model.
* @param m2 the second physical model.
* @param stiffness stiffness of the collisions.
* @param damping damping of the collisions.
*/
public void addCollision(PhyModel m1, PhyModel m2, double stiffness, double damping){

recursiveColliders(m1, m2, stiffness, damping, m_colliders);
Expand All @@ -21,6 +32,14 @@ public void addCollision(PhyModel m1, PhyModel m2, double stiffness, double damp
}


/**
* Register auto-collision between the masses of a physical model.
* @param mdl the physical model.
* @param size size of the auto-collision voxels.
* @param dim gid size (number of voxels).
* @param stiffness stiffness of collisions.
* @param damping damping of collisions.
*/
public void addAutoCollision(PhyModel mdl, double size, int dim, double stiffness, double damping){
m_autoColliders.add(new AutoCollider(mdl, size, dim, dim, dim, stiffness, damping));
}
Expand All @@ -42,6 +61,9 @@ private void recursiveColliders(PhyModel m1, PhyModel m2, double K, double Z, A
}
}

/**
* Compute all collusions and auto-collisions.
*/
public void runCollisions(){
for(MassCollider mc : m_colliders){
mc.detectCollisions();
Expand Down
8 changes: 3 additions & 5 deletions src/miPhysics/Engine/Contact3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ public class Contact3D extends Interaction {

private double interSize;
/**
* @param distance
* @param K_param
* @param Z_param
* @param m1
* @param m2
* A conctact interaction defined between two points
* @param K_param the stiffness of the collision interaction.
* @param Z_param the damping of the collision interaction.
*/
public Contact3D(double K_param, double Z_param) {
super(0, null, null);
Expand Down
21 changes: 18 additions & 3 deletions src/miPhysics/Engine/Driver3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

public class Driver3D extends InOut {

/**
* Create the driver and attach it to a mass module
* @param m the to drive.
*/
public Driver3D(Mass m) {
super(m);
setType(inOutType.DRIVER3D);
Expand All @@ -30,7 +34,7 @@ public void compute() {
}

/**
* Apply position to connected Mass element
* Apply an input position to the mass element controlled by the driver.
* @param pos the position to apply
*/
public void applyPos(Vect3D pos){
Expand All @@ -43,7 +47,7 @@ public void applyPos(double x, double y, double z){
}

/**
* Apply force to connected Mass module
* Apply an input force to the mass controlled by the driver.
* @param frc the Vec3D containing the force to apply
*/
public void applyFrc(Vect3D frc){
Expand All @@ -64,7 +68,13 @@ public void moveDriver(Mass m){
}



/**
* Trigger a force ramp applied to the controlled mass.
* @param x force amount along X.
* @param y force amount along Y.
* @param z force amount along Z.
* @param timeSteps steps in samples over which the force ramp is applied.
*/
public void triggerForceRamp(double x, double y, double z, int timeSteps){
m_rampSteps = timeSteps;
m_targetForce.x = x;
Expand All @@ -75,6 +85,11 @@ public void triggerForceRamp(double x, double y, double z, int timeSteps){
m_rampActive = true;
}

/**
* Trigger a force ramp applied to the controlled mass.
* @param frc 3D vector containing the force to apply.
* @param timeSteps steps in samples over which the force ramp is applied.
*/
public void triggerForceRamp(Vect3D frc, int timeSteps){
this.triggerForceRamp(frc.x, frc.y, frc.z, timeSteps);
}
Expand Down
7 changes: 7 additions & 0 deletions src/miPhysics/Engine/Ground1D.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
package miPhysics.Engine;

/**
* One dimensional fixed point module.
*/
public class Ground1D extends Mass {

/**
* @param size radius of the module.
* @param initPos initial position.
*/
public Ground1D(double size, Vect3D initPos) {
super(1., size, initPos, initPos); // the mass parameter is unused.
setType(massType.GROUND1D);
Expand Down
7 changes: 6 additions & 1 deletion src/miPhysics/Engine/Ground3D.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package miPhysics.Engine;

/**
* Fixed point Mass module.
* 3D Fixed point Mass module.
* @author James Leonard / [email protected]
*
*/
public class Ground3D extends Mass {

/**
* @param size radius of the module.
* @param initPos initial position.
*/
public Ground3D(double size, Vect3D initPos) {
super(1., size, initPos, initPos); // the mass parameter is unused.
setType(massType.GROUND3D);
Expand Down
10 changes: 4 additions & 6 deletions src/miPhysics/Engine/InOut.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,23 @@
public abstract class InOut extends Module {

/**
* Constructor method.
* @param distance resting distance of the Interaction.
* @param m1 connected Mass at one end.
* @param m2 connected Mass at other end.
* Generic in/out module constructor
* @param m
*/
public InOut(Mass m) {
m_mat = m;
m_type = inOutType.UNDEFINED;
}

/**
* Compute behavior of the Interaction (depends on the concrete implementation of concerned module).
* Compute behavior of the In/Out (depends on the concrete implementation of concerned module).
*
*/
public abstract void compute();

/**
* Connect the InOut module to one Mass module.
* @param m connected Mass.
* @param m1 connected Mass.
*/
public void connect (Mass m1) {
m_mat = m1;
Expand Down
1 change: 1 addition & 0 deletions src/miPhysics/Engine/Mass.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public abstract class Mass extends PhyObject {
* Constructor method.
*
* @param M mass value.
* @param size radius of the mass.
* @param initPos initial position.
* @param initPosR delayed initial position.
*/
Expand Down
3 changes: 3 additions & 0 deletions src/miPhysics/Engine/MassCollider.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import miPhysics.Utility.SpacePrint;
import java.util.ArrayList;

/**
* Collider class handling collision between two physical models.
*/
public class MassCollider {

private Pair<PhyModel, PhyModel> m_colMdls;
Expand Down
2 changes: 1 addition & 1 deletion src/miPhysics/Engine/Module.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package miPhysics.Engine;

/**
* Abstract class defining modules
* Abstract class defining modules (any type of physical element).
*
* @author James Leonard / [email protected]
*
Expand Down
6 changes: 5 additions & 1 deletion src/miPhysics/Engine/Observer3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

public class Observer3D extends InOut {


/**
* Create an observer
* @param f a possible filter type on the observed output.
* @param m the mass to observe.
*/
public Observer3D(filterType f, Mass m) {
super(m);
setType(inOutType.OBSERVER3D);
Expand Down
Loading

0 comments on commit 95d2990

Please sign in to comment.