es.ucm.look.ar.math.collision
Class SquareArmature

java.lang.Object
  extended by es.ucm.look.ar.math.collision.SquareArmature
All Implemented Interfaces:
Armature
Direct Known Subclasses:
SquareDebugArmature

public class SquareArmature
extends java.lang.Object
implements Armature


Constructor Summary
SquareArmature(Point3 topLeft, Point3 bottomLeft, Point3 bottomRight, Point3 topRight)
          Constructs a square armature from 4 points.
 
Method Summary
 boolean contains(Point3 p)
          Returns true if the given point is contained by the armature.
 Point3 getIntersectionPoint(Ray r)
          Test whether a ray intersects with the armature.
 boolean intersects(Ray r)
          Return if the given ray intersects with the armature
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SquareArmature

public SquareArmature(Point3 topLeft,
                      Point3 bottomLeft,
                      Point3 bottomRight,
                      Point3 topRight)
Constructs a square armature from 4 points. This 4 points must be contained for the same plane. If not, weird behavior will happen

Parameters:
topLeft -
bottomLeft -
bottomRight -
topRight -
Method Detail

contains

public boolean contains(Point3 p)
Description copied from interface: Armature
Returns true if the given point is contained by the armature. false otherwise

Specified by:
contains in interface Armature
Parameters:
p - the point
Returns:
true if the given point is contained by the armature. false otherwise

getIntersectionPoint

public Point3 getIntersectionPoint(Ray r)
Description copied from interface: Armature
Test whether a ray intersects with the armature. If it does, returns the intersection point. If it doesn't, returns null

Specified by:
getIntersectionPoint in interface Armature
Parameters:
r - the ray
Returns:
the intersection point. null if there is no intersection

intersects

public boolean intersects(Ray r)
Description copied from interface: Armature
Return if the given ray intersects with the armature

Specified by:
intersects in interface Armature
Parameters:
r - the ray
Returns:
true if there is intersection. false otherwise