|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.blogspot.applications4android.comicreader.zoom.FrictionSpringDynamix
public class FrictionSpringDynamix
Uses friction and spring physics in order to provide a more realistic UI. Logic is that when inside the bounds, we'll use friction factor. But as soon as we go out of bounds, we'll apply spring physics.
Constructor Summary | |
---|---|
FrictionSpringDynamix()
|
Method Summary | |
---|---|
float |
getPosition()
Get current position |
float |
getVelocity()
Get current velocity |
boolean |
isUnderRest(float vel_tol,
float pos_tol)
Finds out whether the object is at rest and is inside the bounds. |
void |
setMinMax(float min,
float max)
Set bounds for this object. |
void |
setParameters(float fric,
float stiff,
float damp)
Set the parameters for this object |
void |
setState(float vel,
float pos)
Set the current state of this object. |
void |
setState(float vel,
float pos,
long time)
Set the current state of this object. |
void |
update()
Interface function responsible for evaluation of the current velocity and position. |
void |
update(long time)
Interface function responsible for evaluation of the current velocity and position. |
protected void |
updateState(long delta)
The base function responsible for actual evaluation of velocity and position for the current time step. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FrictionSpringDynamix()
Method Detail |
---|
public void setState(float vel, float pos, long time)
vel
- current velocitypos
- current positiontime
- current timepublic void setState(float vel, float pos)
vel
- current velocitypos
- current positionpublic void setMinMax(float min, float max)
min
- the minimum possible value for position.max
- the maximum possible value for position.public float getVelocity()
public float getPosition()
public boolean isUnderRest(float vel_tol, float pos_tol)
vel_tol
- velocity tolerance. If current velocity is less than this tolerance,
then it is considered to be at rest.pos_tol
- position tolerance. tolerance to be added to the bounds to check for limits.public void update(long time)
time
- current time.public void update()
public void setParameters(float fric, float stiff, float damp)
fric
- friction co-efficientstiff
- stiffness of the stringdamping
- ratioprotected void updateState(long delta)
delta
- the delta time elapsed from the last update.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |