physics3d
Class Torus
java.lang.Object
physics3d.Torus
- All Implemented Interfaces:
- PhysicsShape
public class Torus
- extends Object
- implements PhysicsShape
Torus represents a torus in 3 space
- Specification Fields
-
-
radiusFromCenter
: double // distance from center of torus to
center of circles on the tube.
-
radiusOfTube
: double // radius of tube
-
center
: Vect3 // point of center of the torus
-
orientation
: Vect3 // unit vector perpendicular to plane formed
by centers of circles along the tube.
-
texture
: String // texture of this object
Constructor Summary |
Torus(Vect3 center,
Vect3 orientation,
double radiusFromCenter,
double radiusOfTube)
|
Torus(Vect3 center,
Vect3 orientation,
double radiusFromCenter,
double radiusOfTube,
String texture)
|
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.
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