org.concord.collisions.engine
Class JRigidBox

java.lang.Object
  |
  +--org.concord.collisions.engine.JWorldElement
        |
        +--org.concord.collisions.engine.JRigidBox
All Implemented Interfaces:
CCDraggable, CCMassive, java.util.EventListener, java.beans.PropertyChangeListener, java.io.Serializable

public class JRigidBox
extends JWorldElement

one of implementation of JWorldElement abstract class

Author:
Dmitry Markman
See Also:
Serialized Form

Field Summary
static float DEFAULT_MASS
           
static float DEFAULT_THICKNESS
           
 int halfThickness
          wall's thickness/2 default value is 5
static boolean HORIZONTAL_WALL
           
 float thickness
           
static boolean VERTICAL_WALL
           
 
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
 
Method Summary
 void applyForce(CCForce force)
          JRigidBox doesn't support applying forces
static JRigidBox createRigidBox(float x0, float y0, float boxWidth, float boxHeight, float thickness)
           
 void doDrag(CCCoordinateTuner tuner, int x, int y)
           
 void down(float delta, float constrain, javax.swing.JComponent c)
          shift wall down
 void endDrag(CCCoordinateTuner tuner, int x, int y)
           
 float getCMPointX()
          calculates X coordinate of center of mass
 float getCMPointY()
          calculates Y coordinate of center of mass
 float getDownConstraint()
           
 java.lang.Object getDraggableOwner()
           
 int getDragMode()
           
static int getHalfThickness(float t)
           
 float getLeftConstraint()
           
 boolean getMoveable()
           
 float getRightConstraint()
           
 float getTemperature()
           
 float getUpConstraint()
           
 JWall[] getWalls()
           
 float getX()
           
 float getXPotentialEnergy()
           
 float getXTemperature()
           
 float getY()
           
 float getYPotentialEnergy()
           
 float getYTemperature()
           
 void initElement()
           
 boolean isPointInside(float x, float y)
           
 boolean isPointOnTheBoxesWalls(float x, float y)
           
 boolean isRigidBoxOK()
           
 void left(float delta, float constrain, javax.swing.JComponent c)
          shift wall left
 void paint(java.awt.Graphics g, java.awt.Graphics sg)
           
 void paintSelection(java.awt.Graphics g)
           
 boolean panelInfoSupport()
           
 void rememberCurrPosAsInit()
           
 void rememberCurrVelAsInit()
           
 void reverseVx()
           
 void reverseVy()
           
 void right(float delta, float constrain, javax.swing.JComponent c)
          shift wall right
 void setCMPointX(float x)
          set X coordinate of center of mass
 void setCMPointY(float y)
          set Y coordinate of center of mass
 void setConstraints(float xLeft, float yUp, float xRight, float yDown)
           
 void setControllable(boolean controllable)
           
 void setDragMode(int m)
           
 void setGeometry(float x0, float y0, float boxWidth, float boxHeight, float thickness)
           
 void setGeometry(java.lang.Object object)
           
 void setInfoDrawer(CCInfoDrawer infoDrawer)
           
 void setMass(float mass)
           
 void setMoveable(boolean moveable)
           
 void setVx(float vx)
          set element's velocity
 void setVy(float vy)
           
 void setWorldModel(JPartWorld world)
           
 void setXConstraints(float xLeft, float xRight)
          setting horizontal wall's constraints
 void setYConstraints(float yUp, float yDown)
          setting vertical wall's constraints
 void shift(float dt)
           
 void startDrag(int x, int y)
           
 void up(float delta, float constrain, javax.swing.JComponent c)
           
 
Methods inherited from class org.concord.collisions.engine.JWorldElement
addAreaListener, addAreaListener, addAreaListener, addAreaListener, addAreaToListen, addAreaToListen, addAreaToListen, addAreaToListen, addElementListener, addElemMouseListener, addNeighborX, addNeighborY, addPropertyChangeListener, assignIndNumber, clearConstraints, clearForces, clearIcon, closeEverything, createDefaultCalculator, findDraggable, getAccelerationKoeff, getCollidedParticle, getColor, getDoProjection, getFlashingColor, getFullEnergy, getFullXEnergy, getFullYEnergy, getGravityX, getGravityY, getIcon, getIconHeight, getIconWidth, getIndex, getIndNumber, getMass, getName, getNthForce, getNumbAppliedForces, getOwner, getPositionChanger, getPotentialEnergy, getQTIcon, getQTMovie, getShowAcceleration, getShowVelocity, getVelScale, getVx, getVy, getWorldModel, getX, getXacceleration, getXNeighbors, getY, getYacceleration, getYNeighbors, isCollisionSensitive, isConstraintsWasSet, isControllable, isDraggable, isEnabled, isFlashing, isMoveable, isPointInside, isPressedState, isSelected, isVisible, notifyAreaListener, notifyElementListeners, notifyMouseListeners, notifyPropertyListeners, paintSelection, propertyChange, rememberCurrAllAsInit, rememberCurrPropAsInit, rememberCurrPropAsInit, removeAreaListener, removeAreaToListen, removeAreaToListen, removeElementListener, removeElemMouseListener, removeForce, removeForce, removePositionChanger, removePropertyChangeListener, select, setAnimIcon, setCollidedParticle, setCollisionSensitive, setColor, setColor, setDoProjection, setDraggable, setEnabled, setFlashing, setForceCalculator, setIcon, setIcon, setIcon, setIconSize, setIndex, setName, setOwner, setPositionChanger, setPressedState, setProperty, setQTIcon, setQTIcon, setQTMovie, setShowAcceleration, setShowVelocity, setVisible, unselect, wasCollision
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

thickness

public float thickness

halfThickness

public int halfThickness
wall's thickness/2 default value is 5

VERTICAL_WALL

public static final boolean VERTICAL_WALL

HORIZONTAL_WALL

public static final boolean HORIZONTAL_WALL

DEFAULT_MASS

public static final float DEFAULT_MASS

DEFAULT_THICKNESS

public static final float DEFAULT_THICKNESS
Method Detail

initElement

public void initElement()
Overrides:
initElement in class JWorldElement

rememberCurrPosAsInit

public void rememberCurrPosAsInit()
Overrides:
rememberCurrPosAsInit in class JWorldElement

rememberCurrVelAsInit

public void rememberCurrVelAsInit()
Overrides:
rememberCurrVelAsInit in class JWorldElement

createRigidBox

public static JRigidBox createRigidBox(float x0,
                                       float y0,
                                       float boxWidth,
                                       float boxHeight,
                                       float thickness)

setWorldModel

public void setWorldModel(JPartWorld world)
Overrides:
setWorldModel in class JWorldElement

setGeometry

public void setGeometry(java.lang.Object object)
                 throws java.lang.Exception
Overrides:
setGeometry in class JWorldElement

getHalfThickness

public static int getHalfThickness(float t)

setGeometry

public void setGeometry(float x0,
                        float y0,
                        float boxWidth,
                        float boxHeight,
                        float thickness)
                 throws java.lang.Exception

paintSelection

public void paintSelection(java.awt.Graphics g)
Overrides:
paintSelection in class JWorldElement

paint

public void paint(java.awt.Graphics g,
                  java.awt.Graphics sg)
Overrides:
paint in class JWorldElement

isRigidBoxOK

public boolean isRigidBoxOK()

up

public void up(float delta,
               float constrain,
               javax.swing.JComponent c)

down

public void down(float delta,
                 float constrain,
                 javax.swing.JComponent c)
shift wall down
Parameters:
delta - distance to be shifted in down direction
constrain - down constrain
c - component to be upfdated. could be null

left

public void left(float delta,
                 float constrain,
                 javax.swing.JComponent c)
shift wall left
Parameters:
delta - distance to be shifted in left direction
constrain - left constrain
c - component to be upfdated. could be null

right

public void right(float delta,
                  float constrain,
                  javax.swing.JComponent c)
shift wall right
Parameters:
delta - distance to be shifted in right direction
constrain - right constrain
c - component to be upfdated. could be null

setConstraints

public void setConstraints(float xLeft,
                           float yUp,
                           float xRight,
                           float yDown)
Overrides:
setConstraints in class JWorldElement

setYConstraints

public void setYConstraints(float yUp,
                            float yDown)
setting vertical wall's constraints
Overrides:
setYConstraints in class JWorldElement
Parameters:
yUp - up constrain
yDown - bottom constrain

setXConstraints

public void setXConstraints(float xLeft,
                            float xRight)
setting horizontal wall's constraints
Overrides:
setXConstraints in class JWorldElement
Parameters:
xLeft - left constrain
xRight - right constrain

getLeftConstraint

public float getLeftConstraint()
Overrides:
getLeftConstraint in class JWorldElement
Returns:
left constrain

getUpConstraint

public float getUpConstraint()
Overrides:
getUpConstraint in class JWorldElement
Returns:
top constrain

getRightConstraint

public float getRightConstraint()
Overrides:
getRightConstraint in class JWorldElement
Returns:
right constrain

getDownConstraint

public float getDownConstraint()
Overrides:
getDownConstraint in class JWorldElement
Returns:
bottom constrain

getX

public float getX()
Overrides:
getX in class JWorldElement

getY

public float getY()
Overrides:
getY in class JWorldElement

getTemperature

public float getTemperature()
Overrides:
getTemperature in class JWorldElement

getXTemperature

public float getXTemperature()
Overrides:
getXTemperature in class JWorldElement

getYTemperature

public float getYTemperature()
Overrides:
getYTemperature in class JWorldElement

getXPotentialEnergy

public float getXPotentialEnergy()
Overrides:
getXPotentialEnergy in class JWorldElement

getYPotentialEnergy

public float getYPotentialEnergy()
Overrides:
getYPotentialEnergy in class JWorldElement

getCMPointX

public float getCMPointX()
calculates X coordinate of center of mass
Returns:
x coordinate of wall's center of mass

getCMPointY

public float getCMPointY()
calculates Y coordinate of center of mass
Returns:
y coordinate of wall's center of mass

setCMPointX

public void setCMPointX(float x)
                 throws CCUnimplOperationException
Description copied from interface: CCMassive
set X coordinate of center of mass
Following copied from interface: org.concord.collisions.engine.CCMassive
Parameters:
x - desired X coordinate of center of mass

setCMPointY

public void setCMPointY(float y)
                 throws CCUnimplOperationException
Description copied from interface: CCMassive
set Y coordinate of center of mass
Following copied from interface: org.concord.collisions.engine.CCMassive
Parameters:
y - desired Y coordinate of center of mass

setMass

public void setMass(float mass)
             throws java.beans.PropertyVetoException
Overrides:
setMass in class JWorldElement

getWalls

public JWall[] getWalls()

setVx

public void setVx(float vx)
Description copied from class: JWorldElement
set element's velocity
Overrides:
setVx in class JWorldElement

reverseVx

public void reverseVx()
Overrides:
reverseVx in class JWorldElement

setVy

public void setVy(float vy)
Overrides:
setVy in class JWorldElement

reverseVy

public void reverseVy()
Overrides:
reverseVy in class JWorldElement

shift

public void shift(float dt)

setMoveable

public void setMoveable(boolean moveable)

getMoveable

public boolean getMoveable()

setControllable

public void setControllable(boolean controllable)
Overrides:
setControllable in class JWorldElement

isPointOnTheBoxesWalls

public boolean isPointOnTheBoxesWalls(float x,
                                      float y)

isPointInside

public boolean isPointInside(float x,
                             float y)
Overrides:
isPointInside in class JWorldElement

applyForce

public void applyForce(CCForce force)
JRigidBox doesn't support applying forces
Overrides:
applyForce in class JWorldElement
Throws:
CCUnsuppOperationException -  

startDrag

public void startDrag(int x,
                      int y)

doDrag

public void doDrag(CCCoordinateTuner tuner,
                   int x,
                   int y)

endDrag

public void endDrag(CCCoordinateTuner tuner,
                    int x,
                    int y)

getDraggableOwner

public java.lang.Object getDraggableOwner()

panelInfoSupport

public boolean panelInfoSupport()

setInfoDrawer

public void setInfoDrawer(CCInfoDrawer infoDrawer)

getDragMode

public int getDragMode()

setDragMode

public void setDragMode(int m)