igeo

## Class ITriangleWall

- java.lang.Object
- - igeo.IObject
  - - igeo.IAgent
    - - igeo.IWall
      - - igeo.ITriangleWall

- All Implemented Interfaces:
    IDynamics, ISubobject

      public class ITriangleWall
      extends IWall

  Infinite plane wall to bounce particle
  Author:
    Satoru Sugihara

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `IVec` | `dir1`
    `IVec` | `dir2`
    `IVecI[]` | `pts`

    - ### Fields inherited from class igeo.IWall

      `elasticity, forceToMoveToFront, friction, planeDir, planeDirCache, planePt, 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

    Constructors
    Constructor and Description
    `ITriangleWall(ITriangleWall wall)`
    `ITriangleWall(IVecI[] pts)`
    `ITriangleWall(IVecI pt1, IVecI pt2, IVecI pt3)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `ITriangleWall` | `elast(double el)`
    `ITriangleWall` | `elasticity(double el)`
    `ITriangleWall` | `fric(double fric)`
    `ITriangleWall` | `friction(double fric)`
    `IVec` | `intersect(IParticleI particle)`
    `IVec` | `intersect(IVec pt1, IVec pt2)`
    `boolean` | `isCrossing(IParticleI particle)`
    `boolean` | `isCrossing(IVec pt1, IVec pt2)`
    `boolean` | `isInside(IVec pt)` check if the point is inside the triangle
    `boolean` | `isInsideLocal(IVec pt)` check if the point is inside the triangle ralatively from planePt
    `void` | `postinteract(java.util.ArrayList<IDynamics> agents)` executed after interact(ArrayList<IDynamics>).

    - ### Methods inherited from class igeo.IWall

      `elast, elasticity, forceToMoveToFront, fric, friction, hide, isTargetClass, layer, name, show, targetClass, 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, 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, brightness, castStringHashMap, clearDynamics, clearGraphics, clr, clr, clr, clr, clr, cp, createGraphic, defaultAttribute, deleteGraphic, dup, getAWTColor, getColor, getGraphic, getGraphic, getParameter, graphicsNum, gray, grayInt, green, greenInt, grey, greyInt, hue, initGraphic, initObject, isValid, isVisible, layer, layer, name, red, redInt, resetGraphic, saturation, server, setColor, setColor, setColor, setColor, setParameter, setTexture, syncColor, syncGraphic, syncVisibility, syncWeight, texture, 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

    - #### pts

          public IVecI[] pts

    - #### dir1

          public IVec dir1

    - #### dir2

          public IVec dir2

  - ### Constructor Detail

    - #### ITriangleWall

          public ITriangleWall(IVecI pt1,
                               IVecI pt2,
                               IVecI pt3)

    - #### ITriangleWall

          public ITriangleWall(IVecI[] pts)

    - #### ITriangleWall

          public ITriangleWall(ITriangleWall wall)

  - ### Method Detail

    - #### fric

          public ITriangleWall fric(double fric)

      Overrides:
        `fric` in class `IWall`

    - #### friction

          public ITriangleWall friction(double fric)

      Overrides:
        `friction` in class `IWall`

    - #### elast

          public ITriangleWall elast(double el)

      Overrides:
        `elast` in class `IWall`

    - #### elasticity

          public ITriangleWall elasticity(double el)

      Overrides:
        `elasticity` in class `IWall`

    - #### distToCrossing

          public double distToCrossing(IParticleI particle)

      in case somebody needs to measure distance to the wall. if it misses to intersect, it returns -1.
      Overrides:
        `distToCrossing` in class `IWall`

    - #### intersect

          public IVec intersect(IParticleI particle)

    - #### intersect

          public IVec intersect(IVec pt1,
                                IVec pt2)

      Overrides:
        `intersect` in class `IWall`

    - #### isInside

          public boolean isInside(IVec pt)

      check if the point is inside the triangle

    - #### isInsideLocal

          public boolean isInsideLocal(IVec pt)

      check if the point is inside the triangle ralatively from planePt

    - #### isCrossing

          public boolean isCrossing(IParticleI particle)

      Overrides:
        `isCrossing` in class `IWall`

    - #### isCrossing

          public boolean isCrossing(IVec pt1,
                                    IVec pt2)

      Overrides:
        `isCrossing` in class `IWall`

    - #### closerIntersection

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

      Overrides:
        `closerIntersection` in class `IWall`

    - #### postinteract

          public void postinteract(java.util.ArrayList<IDynamics> agents)

      Description copied from interface: `IDynamics`
      executed after interact(ArrayList<IDynamics>). 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 `IWall`

    - #### 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.
      Overrides:
        `bounce` in class `IWall`