physics3d
Class Torus

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

public class Torus
extends Object
implements PhysicsShape

Torus represents a torus in 3 space

Specification Fields

Constructor Summary
Torus(Vect3 center, Vect3 orientation, double radiusFromCenter, double radiusOfTube)
           
Torus(Vect3 center, Vect3 orientation, double radiusFromCenter, double radiusOfTube, String texture)
           
 
Method Summary
 boolean containsPoint(Vect3 p)
           
 Vect3 getCenterPoint()
           
 Vect3 getOrientation()
           
 double getRadiusFromCenter()
           
 double getRadiusOfTube()
           
 ShapeClassification getShapeClassification()
           
 String getTexture()
           
 double minDistanceToObjectFromP(Vect3 p)
           
 Torus rotateAboutCwithAxisAandAngleT(Vect3 center, Vect3 axis, Angle tAngle)
           
 String toString()
           
 Torus translateByT(Vect3 t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Torus

public Torus(Vect3 center,
             Vect3 orientation,
             double radiusFromCenter,
             double radiusOfTube,
             String texture)
Requires:
radiusFromCenter >= 0, radiusOfTube >= 0, center != null, orientation != null, orientation.rho() > 0, texture != null
Effects:
Creates a new circle with the specified size and location and orientation in 3D.

Torus

public Torus(Vect3 center,
             Vect3 orientation,
             double radiusFromCenter,
             double radiusOfTube)
Requires:
radiusFromCenter >= 0, radiusOfTube >= 0, center != null, orientation != null, orientation.rho() > 0
Effects:
Creates a new circle with the specified size and location and orientation in 3D.
Method Detail

getRadiusFromCenter

public double getRadiusFromCenter()
Returns:
radius from center

getRadiusOfTube

public double getRadiusOfTube()
Returns:
radius of tube

getCenterPoint

public Vect3 getCenterPoint()
Returns:
center point

getOrientation

public Vect3 getOrientation()
Returns:
a unit vector perpendicular to the plane containing the center of circles along the tube.

getTexture

public String getTexture()
Returns:
texture of this object

containsPoint

public boolean containsPoint(Vect3 p)
Specified by:
containsPoint in interface PhysicsShape
Returns:
Vect3.isAbout(this.minDistanceToObjectFromP(p),0)
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 and p is outside the torus

rotateAboutCwithAxisAandAngleT

public Torus rotateAboutCwithAxisAandAngleT(Vect3 center,
                                            Vect3 axis,
                                            Angle tAngle)
Specified by:
rotateAboutCwithAxisAandAngleT in interface PhysicsShape
Returns:
A Torus 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 Torus translateByT(Vect3 t)
Specified by:
translateByT in interface PhysicsShape
Returns:
A Torus 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