|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.concord.collisions.engine.JWorldElement | +--org.concord.collisions.engine.JDaemon | +--org.concord.collisions.engine.JDisplDaemon
Displacement daemon element in the world
A displacement daemon is a special daemon that affects only atoms when they collide with it.
It is displayed as an arrow. It changes the velocity of the atom (regardless of its previous velocity) to make it travel over the arrow and then stop at the end of the arrow. The speed of the atom while it is traveling over the displacement daemon depends on the speed mode of the daemon. By default, the atom will always travel through the daemon in 1 second, but the daemon can be set as make the atoms travel with a constant speed.
JDaemon
, Serialized FormField Summary | |
protected float |
arrowThickness
|
protected boolean |
showDisplNumbers
|
static int |
SPEED_MODE_CONSTANT
|
static int |
SPEED_MODE_PROPORTIONAL
|
static int |
SPEED_MODE_TIMECONSTANT
|
protected int |
speedMode
|
protected float |
speedModeConstant
|
Fields inherited from class org.concord.collisions.engine.JDaemon |
activationSteps, activeColor, collisionHistory, currentActivationStep, DEFAULT_PAINT_RADIUS, doCollisionsHistory, minDistance, timeColor |
Fields inherited from class org.concord.collisions.engine.JWorldElement |
acx, acy, areaListener, areaTables, collSensitive, controllable, DEFAULT_MAX_CONSTRAINT, DEFAULT_MIN_CONSTRAINT, doProjection, draggable, elementListeners, flashing, iconHeight, iconWidth, index, iviewer, mass, name, pressedState, propertyListeners, qtIcon, qtMovie, rectsForListener, scaleIcon, showAcceleration, showVelocity, showVelocityNumber, suggestedCollisionTime, swingIcon, vel_scale, vx, vy, wasLastStepCollision |
Constructor Summary | |
JDisplDaemon()
|
Method Summary | |
static JDisplDaemon |
createDisplDaemon(float x,
float y,
float w,
float h,
float displX,
float displY)
Creates a new displacement daemon. |
void |
doDrag(CCCoordinateTuner tuner,
int x,
int y)
|
float |
getArrowThickness()
Returns the thickness of the arrow that represents the displacement daemon |
float |
getDisplacementX()
Returns the x component of the displacement of the daemon |
float |
getDisplacementY()
Returns the y component of the displacement of the daemon |
boolean |
getShowDisplNumbers()
Returns if the daemon should display explicitly the x,y components as numbers next to the arrow |
int |
getSpeedMode()
Returns the speed mode of the daemon |
float |
getSpeedModeConstant()
Returns the constant speed the atoms will have when they collide with the daemon when it is in constant speed mode. |
float |
getXTemperature()
|
float |
getYTemperature()
|
protected boolean |
isElemInDaemon(JWorldElement el)
|
boolean |
isPointInside(float px,
float py)
Returns if a specific world coordinates point is inside the element or not |
boolean |
manageCollision(JWorldElement element)
This method is called by JPartWorld when the booster collides with an element |
boolean |
manageNoCollision(JWorldElement element)
This method is called by JPartWorld every step while the daemon is colliding with an element |
void |
paint(java.awt.Graphics g,
java.awt.Graphics sg)
|
void |
resetDefaultColors()
Reset default colors for the displacement daemon. |
void |
setArrowThickness(float v)
Sets the thickness of the arrow that represents the displacement daemon |
void |
setDisplacement(float dx,
float dy)
Sets the displacement of the daemon (x and y coordinates that determine the length and direction of the arrow) |
void |
setGeometry(java.lang.Object object)
|
void |
setShowDisplNumbers(boolean b)
Sets if the daemon should display explicitly the x,y components as numbers next to the arrow |
void |
setSpeedMode(int v)
Sets the speed mode of the daemon that will determine the actual speed of the atoms that collide with it. |
void |
setSpeedModeConstant(float v)
Sets the constant speed the atoms will have when they collide with the daemon ONLY when the daemon is set in constant speed mode. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int SPEED_MODE_TIMECONSTANT
public static final int SPEED_MODE_CONSTANT
public static final int SPEED_MODE_PROPORTIONAL
protected int speedMode
protected float speedModeConstant
protected boolean showDisplNumbers
protected float arrowThickness
Constructor Detail |
public JDisplDaemon()
Method Detail |
public static JDisplDaemon createDisplDaemon(float x, float y, float w, float h, float displX, float displY)
It is created in the given position (x,y) and with a displacement of (displX,displY). The w and h parameters are only used to give a width and height on the center of the daemon when the displacement is 0 and it needs to be dragged.
x
- daemon's x coordinatey
- daemon's y coordinatew
- daemon's graphical width (minimum 1)h
- daemon's graphical height (minimum 1)displX
- daemon's displacement in xdisplY
- daemon's displacement in ypublic void setGeometry(java.lang.Object object) throws java.lang.Exception
setGeometry
in class JWorldElement
public void setSpeedMode(int v)
v
- represents the speed the atom will have after colliding with the daemon:
public int getSpeedMode()
setSpeedMode(int)
public void setSpeedModeConstant(float v)
To use this velocity on the atoms, the speed mode of the daemon has to be set on SPEED_MODE_CONSTANT
v
- constant speed the atom will have after colliding with the daemonsetSpeedMode(int)
public float getSpeedModeConstant()
This velocity is used in atoms only if the speed mode of the daemon is SPEED_MODE_CONSTANT
setSpeedMode(int)
public void setDisplacement(float dx, float dy)
dx
- x coordinate of the displacementdy
- y coordinate of the displacementpublic float getDisplacementX()
public float getDisplacementY()
public float getArrowThickness()
public void setArrowThickness(float v)
v
- thickness of the arrow. Has to be a positive valuepublic void paint(java.awt.Graphics g, java.awt.Graphics sg)
paint
in class JWorldElement
public float getXTemperature()
getXTemperature
in class JWorldElement
public float getYTemperature()
getYTemperature
in class JWorldElement
public boolean manageCollision(JWorldElement element)
manageCollision
in class JDaemon
element
- element the booster collided withpublic boolean manageNoCollision(JWorldElement element)
manageNoCollision
in class JDaemon
element
- element the daemon is colliding withprotected boolean isElemInDaemon(JWorldElement el)
isElemInDaemon
in class JDaemon
public boolean isPointInside(float px, float py)
JDaemon
isPointInside
in class JDaemon
org.concord.collisions.engine.JDaemon
px
- world x coordinate of the pointpy
- world y coordinate of the pointJWorldElement.isPointInside(java.awt.Point)
public void resetDefaultColors()
Sets the default colors for displ daemons: blue for active and inactive
public void doDrag(CCCoordinateTuner tuner, int x, int y)
doDrag
in class JDaemon
public void setShowDisplNumbers(boolean b)
public boolean getShowDisplNumbers()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |