igeo
Class IWall

java.lang.Object
  extended by igeo.IObject
      extended by igeo.IAgent
          extended by igeo.IWall
All Implemented Interfaces:
IDynamics, ISubobject
Direct Known Subclasses:
ITriangleWall

public class IWall
extends IAgent

Infinite plane wall to bounce particle

Author:
Satoru Sugihara

Field Summary
 double elasticity
          coefficent for bouncing.
 double friction
          coefficent for tangent part of bouncing.
 IVecI planeDir
           
 IVec planeDirCache
           
 IVecI planePt
           
 java.util.ArrayList<java.lang.Class<? extends IParticleI>> targetClasses
           
 
Fields inherited from class igeo.IAgent
alive, duration, interactOverridden, localDynamics, parent, targets, time
 
Fields inherited from class igeo.IObject
attribute, dynamics, graphics, parameter, server, userData
 
Constructor Summary
IWall(IVecI planeDir, IVecI planePt)
           
IWall(IWall wall)
           
 
Method Summary
 void bounce(IParticleI particle, java.util.ArrayList<IDynamics> agents)
          Calculate bouncing behavior of particle.
 IVec closerIntersection(IVec pt1, IVec pt2, java.util.ArrayList<IDynamics> agents)
           
 double distToCrossing(IParticleI particle)
          in case somebody needs to measure distance to the wall.
 double elast()
           
 IWall elast(double el)
           
 double elasticity()
           
 IWall elasticity(double el)
           
 double fric()
           
 IWall fric(double fric)
           
 double friction()
           
 IWall friction(double fric)
           
 IWall hide()
           
 IVec intersect(IVec pt1, IVec pt2)
           
 boolean isCrossing(IParticleI particle)
           
 boolean isCrossing(IVec pt1, IVec pt2)
           
 boolean isTargetClass(java.lang.Object obj)
           
 IWall layer(ILayer l)
          Set layer by ILayer object
 IWall name(java.lang.String nm)
          methods of IObject
 void postinteract(java.util.ArrayList<IDynamics> agents)
          executed after interact(ArrayList).
 IWall show()
           
 IWall targetClass(java.lang.Class<? extends IParticleI>... targets)
           
 IWall targetClass(java.lang.Class<? extends IParticleI> targetClass)
           
 
Methods inherited from class igeo.IAgent
addDynamics, alive, clr, clr, clr, clr, clr, clr, clr, clr, clr, clr, clr, clr, clr, clr, clr, clr, del, del, deletDynamics, deleteDynamics, deleteDynamics, duration, duration, dynamicsNum, getDynamics, hsb, hsb, hsb, hsb, initAgent, interact, interact, localDynamics, parent, parent, postupdate, preinteract, preupdate, removeTarget, removeTarget, setColor, setColor, setColor, setColor, setColor, setColor, setColor, setColor, setColor, setColor, setColor, setColor, setColor, setColor, setColor, setColor, setHSBColor, setHSBColor, setHSBColor, setHSBColor, target, target, targetNum, targets, time, time, update, updateGraphic, updateTarget, weight, weight
 
Methods inherited from class igeo.IObject
addUserData, addUserData, alpha, alphaInt, attr, attr, attr, awtColor, blue, blueInt, castStringHashMap, clearDynamics, clearGraphics, clr, clr, clr, clr, clr, cp, createGraphic, defaultAttribute, deleteGraphic, dup, getAWTColor, getColor, getGraphic, getGraphic, getParameter, graphicsNum, gray, grayInt, green, greenInt, greyInt, initGraphic, initObject, isValid, isVisible, layer, layer, name, red, redInt, resetGraphic, server, setColor, setColor, setColor, setColor, setParameter, syncColor, syncGraphic, syncVisibility, syncWeight, userData, userData, userData, userDataNum, visible, weight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targetClasses

public java.util.ArrayList<java.lang.Class<? extends IParticleI>> targetClasses

planeDir

public IVecI planeDir

planePt

public IVecI planePt

planeDirCache

public IVec planeDirCache

elasticity

public double elasticity
coefficent for bouncing. when elasticity = 1.0, it bounce back with same velocity and when elasticity = 0.0, it doesn't bounce but just stop at the wall


friction

public double friction
coefficent for tangent part of bouncing. when friction is zero, the tangent part of bounced velocity doesn't change. if friction is 1.0, the tangent part of bounced velocity becomes zero

Constructor Detail

IWall

public IWall(IVecI planeDir,
             IVecI planePt)

IWall

public IWall(IWall wall)
Method Detail

targetClass

public IWall targetClass(java.lang.Class<? extends IParticleI> targetClass)

targetClass

public IWall targetClass(java.lang.Class<? extends IParticleI>... targets)

isTargetClass

public boolean isTargetClass(java.lang.Object obj)

fric

public IWall fric(double fric)

fric

public double fric()

friction

public IWall friction(double fric)

friction

public double friction()

elast

public IWall elast(double el)

elast

public double elast()

elasticity

public IWall elasticity(double el)

elasticity

public double elasticity()

distToCrossing

public double distToCrossing(IParticleI particle)
in case somebody needs to measure distance to the wall.


intersect

public IVec intersect(IVec pt1,
                      IVec pt2)

isCrossing

public boolean isCrossing(IParticleI particle)

isCrossing

public boolean isCrossing(IVec pt1,
                          IVec pt2)

postinteract

public void postinteract(java.util.ArrayList<IDynamics> agents)
Description copied from interface: IDynamics
executed after interact(ArrayList). behavior can be changed by IConfig.enablePostinteract and IConfig.loopPostinteract. If IConfig.loopPostinteract is false, preupdate is executed before post interact (updated 2012/08/26).

Specified by:
postinteract in interface IDynamics
Overrides:
postinteract in class IAgent

closerIntersection

public IVec closerIntersection(IVec pt1,
                               IVec pt2,
                               java.util.ArrayList<IDynamics> agents)

bounce

public void bounce(IParticleI particle,
                   java.util.ArrayList<IDynamics> agents)
Calculate bouncing behavior of particle. With IConfig.checkAdjacentWalls=true, it checks other walls if the particle could collide into others within the same time frame and find which one to collide first. When bouncing, a particle doesn't necesarily stop at the intersection point on the wall because within one time frame, the particle moves distance of particle.vel() * IConfig.updateRate and IWall move the corresponding distance after bouncing. So if a particle is fast, user might not see the moment the particle is touching the wall. Instead, if the particle inherets ITrajectoryI, IWall inserts an intersection point into the trajectory curve.


name

public IWall name(java.lang.String nm)
methods of IObject

Overrides:
name in class IAgent

layer

public IWall layer(ILayer l)
Description copied from class: IObject
Set layer by ILayer object

Overrides:
layer in class IAgent

hide

public IWall hide()
Overrides:
hide in class IAgent

show

public IWall show()
Overrides:
show in class IAgent