|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimulation.engine.Spring
public final class Spring
A spring that connects to objects.
| Constructor Summary | |
|---|---|
Spring(double str,
Body b1,
Body b2,
Vector connect1,
Vector connect2)
Create a spring with the given properties. |
|
Spring(double len,
double str,
Body b1,
Body b2,
Vector connect1,
Vector connect2)
Create a spring with the given properties. |
|
| Method Summary | |
|---|---|
Body |
connectedBody1()
Get the first body the spring is connected to. |
Body |
connectedBody2()
Get the second body the spring is connected to. |
void |
draw(java.awt.Graphics g)
Draw the spring on a graphics object. |
double |
naturalLength()
Get the natural length of the spring. |
void |
step(double amount)
Have the spring apply force to its connections a certain amount. |
double |
strength()
Get the spring's strength. |
Vector |
vertex1()
Get the point where the spring is connected to the first body. |
Vector |
vertex2()
Get the point where the spring is connected to the second body. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Spring(double len,
double str,
Body b1,
Body b2,
Vector connect1,
Vector connect2)
len - the natural lengthstr - the strength (k value)b1 - the first bodyb2 - the second bodyconnect1 - where it connects with the first bodyconnect2 - where it connects with the second body
public Spring(double str,
Body b1,
Body b2,
Vector connect1,
Vector connect2)
str - the strength (k value)b1 - the first bodyb2 - the second bodyconnect1 - where it connects with the first bodyconnect2 - where it connects with the second body| Method Detail |
|---|
public double naturalLength()
public double strength()
public Body connectedBody1()
public Body connectedBody2()
public Vector vertex1()
public Vector vertex2()
public void step(double amount)
amount - the number of time units that have passedpublic void draw(java.awt.Graphics g)
g - graphics object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||