physics3d
Class PlanePolygon

java.lang.Object
  extended by physics3d.PlanePolygon
All Implemented Interfaces:
PhysicsShape

public class PlanePolygon
extends Object
implements PhysicsShape

PlanePolygon represents a plane polygon in 3 space

Specification Fields

Constructor Summary
PlanePolygon(List<Vect3> vertices)
           
PlanePolygon(List<Vect3> vertices, String texture)
           
 
Method Summary
 boolean containsPoint(Vect3 p)
           
 Vect3 getNormal()
           
 ShapeClassification getShapeClassification()
           
 String getTexture()
           
 Iterator<Vect3> getVertices()
           
 double minDistanceToObjectFromP(Vect3 p)
           
 Plane planeContainingObject()
           
 PlanePolygon rotateAboutCwithAxisAandAngleT(Vect3 center, Vect3 axis, Angle tAngle)
           
 String toString()
           
 PlanePolygon translateByT(Vect3 t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlanePolygon

public PlanePolygon(List<Vect3> vertices,
                    String texture)
Requires:
vertices is not null, texture is not null, vertices.size() >=3, vertices contains no null elements, the points represented by the end of the vectors lie in a plane and are arranged in sequential order of occurrence, the i, i+1, and i+2 mod vertices.size() elements of vertices are not collinear for any i, and the polygon is convex and not self intersecting.
Effects:
constructs a 3D Polygon

PlanePolygon

public PlanePolygon(List<Vect3> vertices)
Requires:
vertices is not null, vertices.size() >=3, vertices contains no null elements, the points represented by the end of the vectors lie in a plane and are arranged in sequential order of occurrence, the i, i+1, and i+2 mod vertices.size() elements of vertices are not collinear for any i, and the polygon is convex and not self intersecting.
Effects:
constructs a 3D Polygon
Method Detail

getNormal

public Vect3 getNormal()
Returns:
a unit vector perpendicular to this.

getVertices

public Iterator<Vect3> getVertices()
Returns:
an iterator over the vertices, going in the order with which they were passed upon creation

getTexture

public String getTexture()
Returns:
texture of this object

planeContainingObject

public Plane planeContainingObject()
Returns:
the Plane containing this

containsPoint

public boolean containsPoint(Vect3 p)
Specified by:
containsPoint in interface PhysicsShape
Returns:
true if p is within the geometric shape created by moving this up and down this.normal by GameConstants.TOLERANCE, false otherwise
Requires:
p is not null

minDistanceToObjectFromP

public double minDistanceToObjectFromP(Vect3 p)
Specified by:
minDistanceToObjectFromP in interface PhysicsShape
Returns:
the minimum distance between p and this
Requires:
p is not null

rotateAboutCwithAxisAandAngleT

public PlanePolygon rotateAboutCwithAxisAandAngleT(Vect3 center,
                                                   Vect3 axis,
                                                   Angle tAngle)
Specified by:
rotateAboutCwithAxisAandAngleT in interface PhysicsShape
Returns:
A PlanePolygon rotated about the line created by center and axis counterclockwise by an amount tAngle with same texture.
Requires:
center != null, axis != null, axis.rho() > 0, tAngle != null.

translateByT

public PlanePolygon translateByT(Vect3 t)
Specified by:
translateByT in interface PhysicsShape
Returns:
A PlanePolygon translated by t with same texture
Requires:
t != null

toString

public String toString()
Overrides:
toString in class Object

getShapeClassification

public ShapeClassification getShapeClassification()
Specified by:
getShapeClassification in interface PhysicsShape