gizmoball.physics
Class PhysicsCircle

java.lang.Object
  extended by gizmoball.physics.PhysicsCircle
All Implemented Interfaces:
PhysicsObject, PrimitivesCollection

public class PhysicsCircle
extends java.lang.Object
implements PhysicsObject

A PhysicsCircle is a wrapper class for a three dimensional representation of a plane circle.

Specification Fields :
circle : PlaneCircle // the circle wrapped in this

Constructor Summary
PhysicsCircle(Vect3 center, Vect3 normal, double radius, double mass, double reflectionCoeff, Vect3 velocity)
          Creates a new PhysicsCircle without rotation or texture
PhysicsCircle(Vect3 center, Vect3 normal, double radius, double mass, double reflectionCoeff, Vect3 velocity, java.lang.String texture)
          Creates a new PhysicsCircle without rotation
PhysicsCircle(Vect3 center, Vect3 normal, double radius, double mass, double reflectionCoeff, Vect3 rotCenter, Vect3 rotOmega, Vect3 velocity)
          Creates a new PhysicsCircle without texture
PhysicsCircle(Vect3 center, Vect3 normal, double radius, double mass, double reflectionCoeff, Vect3 rotCenter, Vect3 rotOmega, Vect3 velocity, java.lang.String texture)
          Creates a new PhysicsCircle
 
Method Summary
 boolean containsPoint(Vect3 p)
          Returns whether p is in this.
 Vect3 getBCenter()
           
 Vect3Pair getBoundingBox()
           
 double getBRadius()
           
 java.util.Collection<LateralCylinder> getLateralCylinders()
           
 double getMass()
           
 java.util.Collection<PlaneCircle> getPlaneCircles()
           
 java.util.Collection<PlanePolygon> getPlanePolygons()
           
 Vect3 getPosition()
           
 double getReflectionCoeff()
           
 Vect3 getRotCenter()
           
 Vect3 getRotOmega()
           
 java.util.Collection<Sphere> getSpheres()
           
 java.util.Collection<Torus> getTori()
           
 Vect3 getVelocity()
           
 double minDistanceToObjectFromP(Vect3 p)
          Returns the minimum distance from p to this
 Vect3 reflect(PhysicsSphere ps)
           
 void rotateAboutAxis(Vect3 center, Vect3 axis, double angle)
           
 void setMass(double m)
           
 void setPosition(Vect3 pos)
           
 void setReflectionCoeff(double rc)
           
 void setRotCenter(Vect3 rc)
           
 void setRotOmega(Vect3 ro)
           
 void setVelocity(Vect3 vel)
           
 double timeUntilCollision(PhysicsSphere ball, double lookahead)
          Returns the time until a collision between ball and this
 void update(double timestep)
          Updates the state of this after the passage of timestep.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhysicsCircle

public PhysicsCircle(Vect3 center,
                     Vect3 normal,
                     double radius,
                     double mass,
                     double reflectionCoeff,
                     Vect3 rotCenter,
                     Vect3 rotOmega,
                     Vect3 velocity,
                     java.lang.String texture)
Creates a new PhysicsCircle

Parameters:
center - the center of the circle
normal - a vector normal to the plane of the circle
radius - the radius of the circle
mass - the mass of the circle
reflectionCoeff - the coefficient of reflection of the circle
rotCenter - the center of rotation of the circle
rotOmega - the angular velocity of the circle about rotCenter
velocity - the velocity of rotCenter
texture - the texture of the circle
Requires:
(mass >= 0) && (radius >= 0) && (0 <= reflectionCoeff <= 1) && (center != null) && (normal != null) && (rotCenter != null) && (rotOmega != null) && (velocity != null)
Effects:
creates a new PhysicsCircle pc such that: pc.circle.center = center && pc.circle.normal = normal && pc.circle.radius = radius && pc.mass = mass && pc.reflectionCoeff = reflectionCoeff && pc.rotCenter = rotCenter && pc.rotOmega = rotOmega && pc.velocity = velocity && pc.bcenter = center && pc.bradius = radius + 0.1

PhysicsCircle

public PhysicsCircle(Vect3 center,
                     Vect3 normal,
                     double radius,
                     double mass,
                     double reflectionCoeff,
                     Vect3 rotCenter,
                     Vect3 rotOmega,
                     Vect3 velocity)
Creates a new PhysicsCircle without texture

Parameters:
center - the center of the circle
normal - a vector normal to the plane of the circle
radius - the radius of the circle
mass - the mass of the circle
reflectionCoeff - the coefficient of reflection of the circle
rotCenter - the center of rotation of the circle
rotOmega - the angular velocity of the circle about rotCenter
velocity - the velocity of rotCenter
Requires:
(mass >= 0) && (radius >= 0) && (0 <= reflectionCoeff <= 1) && (center != null) && (normal != null) && (rotCenter != null) && (rotOmega != null) && (velocity != null)
Effects:
creates a new PhysicsCircle pc such that: pc.circle.center = center && pc.circle.normal = normal && pc.circle.radius = radius && pc.mass = mass && pc.reflectionCoeff = reflectionCoeff && pc.rotCenter = rotCenter && pc.rotOmega = rotOmega && pc.velocity = velocity && pc.bcenter = center && pc.bradius = radius + 0.1

PhysicsCircle

public PhysicsCircle(Vect3 center,
                     Vect3 normal,
                     double radius,
                     double mass,
                     double reflectionCoeff,
                     Vect3 velocity,
                     java.lang.String texture)
Creates a new PhysicsCircle without rotation

Requires:
(mass >= 0) && (radius >= 0) && (0 <= reflectionCoeff <= 1) && (center != null) && (normal != null) && (velocity != null)
Effects:
creates a new PhysicsCircle with the given parameters such that: rotCenter = center && rotOmega = Vect3.ZERO

PhysicsCircle

public PhysicsCircle(Vect3 center,
                     Vect3 normal,
                     double radius,
                     double mass,
                     double reflectionCoeff,
                     Vect3 velocity)
Creates a new PhysicsCircle without rotation or texture

Requires:
(mass >= 0) && (radius >= 0) && (0 <= reflectionCoeff <= 1) && (center != null) && (normal != null) && (velocity != null)
Effects:
creates a new PhysicsCircle with the given parameters such that: rotCenter = center && rotOmega = Vect3.ZERO
Method Detail

containsPoint

public boolean containsPoint(Vect3 p)
Description copied from interface: PhysicsObject
Returns whether p is in this.

Specified by:
containsPoint in interface PhysicsObject
Returns:
true if the distance from p to this is less than GameConstants.TOLERANCE

getBCenter

public Vect3 getBCenter()
Specified by:
getBCenter in interface PhysicsObject
Returns:
this.bcenter

getBRadius

public double getBRadius()
Specified by:
getBRadius in interface PhysicsObject
Returns:
this.bradius

getMass

public double getMass()
Specified by:
getMass in interface PhysicsObject
Returns:
this.mass

getPosition

public Vect3 getPosition()
Specified by:
getPosition in interface PhysicsObject
Returns:
this.position

getReflectionCoeff

public double getReflectionCoeff()
Specified by:
getReflectionCoeff in interface PhysicsObject
Returns:
this.reflectionCoeff

getRotCenter

public Vect3 getRotCenter()
Specified by:
getRotCenter in interface PhysicsObject
Returns:
this.rotCenter

getRotOmega

public Vect3 getRotOmega()
Specified by:
getRotOmega in interface PhysicsObject
Returns:
this.rotOmega

getVelocity

public Vect3 getVelocity()
Specified by:
getVelocity in interface PhysicsObject
Returns:
this.velocity

minDistanceToObjectFromP

public double minDistanceToObjectFromP(Vect3 p)
Description copied from interface: PhysicsObject
Returns the minimum distance from p to this

Specified by:
minDistanceToObjectFromP in interface PhysicsObject
Returns:
the minimum distance from p to this

reflect

public Vect3 reflect(PhysicsSphere ps)
Specified by:
reflect in interface PhysicsObject
Returns:
the velocity of ps reflected off of this

setMass

public void setMass(double m)
Specified by:
setMass in interface PhysicsObject

setPosition

public void setPosition(Vect3 pos)
Specified by:
setPosition in interface PhysicsObject

setReflectionCoeff

public void setReflectionCoeff(double rc)
Specified by:
setReflectionCoeff in interface PhysicsObject

setRotCenter

public void setRotCenter(Vect3 rc)
Specified by:
setRotCenter in interface PhysicsObject

setRotOmega

public void setRotOmega(Vect3 ro)
Specified by:
setRotOmega in interface PhysicsObject

setVelocity

public void setVelocity(Vect3 vel)
Specified by:
setVelocity in interface PhysicsObject

rotateAboutAxis

public void rotateAboutAxis(Vect3 center,
                            Vect3 axis,
                            double angle)
Specified by:
rotateAboutAxis in interface PhysicsObject

timeUntilCollision

public double timeUntilCollision(PhysicsSphere ball,
                                 double lookahead)
Description copied from interface: PhysicsObject
Returns the time until a collision between ball and this

Specified by:
timeUntilCollision in interface PhysicsObject
Returns:
the time until collision or POSITIVE_INFINITY if the collision will not occur

update

public void update(double timestep)
Description copied from interface: PhysicsObject
Updates the state of this after the passage of timestep. Uses the Geometry3D library for rotations

Specified by:
update in interface PhysicsObject

getLateralCylinders

public java.util.Collection<LateralCylinder> getLateralCylinders()
Specified by:
getLateralCylinders in interface PrimitivesCollection
Returns:
this.lateralCylinders

getPlaneCircles

public java.util.Collection<PlaneCircle> getPlaneCircles()
Specified by:
getPlaneCircles in interface PrimitivesCollection
Returns:
this.planeCircles

getPlanePolygons

public java.util.Collection<PlanePolygon> getPlanePolygons()
Specified by:
getPlanePolygons in interface PrimitivesCollection
Returns:
this.planePolygons

getSpheres

public java.util.Collection<Sphere> getSpheres()
Specified by:
getSpheres in interface PrimitivesCollection
Returns:
this.spheres

getTori

public java.util.Collection<Torus> getTori()
Specified by:
getTori in interface PrimitivesCollection
Returns:
this.tori

getBoundingBox

public Vect3Pair getBoundingBox()
Specified by:
getBoundingBox in interface PhysicsObject
Returns:
a bounding box consisting of one Vect3 with smaller coordinates and one Vect3 with larger coordinates