physics3d
Class LateralCylinder

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

public class LateralCylinder
extends Object
implements PhysicsShape

LateralCylinder represents the lateral part of a cylinder in 3 space

Specification Fields

Constructor Summary
LateralCylinder(double radius, Vect3 bottomCenter, Vect3 topCenter)
           
LateralCylinder(double radius, Vect3 bottomCenter, Vect3 topCenter, String texture)
           
 
Method Summary
 boolean containsPoint(Vect3 p)
           
 Vect3 getBottomCenter()
           
 Vect3 getDirection()
           
 double getRadius()
           
 ShapeClassification getShapeClassification()
           
 String getTexture()
           
 Vect3 getTopCenter()
           
 double minDistanceToObjectFromP(Vect3 p)
           
 LateralCylinder rotateAboutCwithAxisAandAngleT(Vect3 center, Vect3 axis, Angle tAngle)
           
 String toString()
           
 LateralCylinder translateByT(Vect3 t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LateralCylinder

public LateralCylinder(double radius,
                       Vect3 bottomCenter,
                       Vect3 topCenter,
                       String texture)
Requires:
radius >= 0 && bottomCenter != null && topCenter != null && !topCenter.equals(bottomCenter) && texture != null
Effects:
creates a cylinder with radius 'radius' bottom center 'bottomCenter' and top center 'topCenter'

LateralCylinder

public LateralCylinder(double radius,
                       Vect3 bottomCenter,
                       Vect3 topCenter)
Requires:
radius >= 0 && bottomCenter != null && topCenter != null && !topCenter.equals(bottomCenter)
Effects:
creates a cylinder with radius 'radius' bottom center 'bottomCenter' and top center 'topCenter'
Method Detail

getRadius

public double getRadius()
Returns:
the radius of this lateral cylinder

getTopCenter

public Vect3 getTopCenter()
Returns:
the top center of this lateral cylinder

getBottomCenter

public Vect3 getBottomCenter()
Returns:
the bottom center of this lateral cylinder

getDirection

public Vect3 getDirection()
Returns:
the unit vector pointing from the bottom center to the top center

getTexture

public String getTexture()
Returns:
texture of this object

containsPoint

public boolean containsPoint(Vect3 p)
Specified by:
containsPoint in interface PhysicsShape
Returns:
true if Vect3.isAbout(this.minDistanceToObjectFromP(p),0), false otherwise
Requires:
p != 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 LateralCylinder rotateAboutCwithAxisAandAngleT(Vect3 center,
                                                      Vect3 axis,
                                                      Angle tAngle)
Specified by:
rotateAboutCwithAxisAandAngleT in interface PhysicsShape
Returns:
A LateralCylinder 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 LateralCylinder translateByT(Vect3 t)
Specified by:
translateByT in interface PhysicsShape
Returns:
A LateralCylinder 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