net.sf.j3d.physics
Class Sphere

java.lang.Object
  extended by net.sf.j3d.threeD.raytracer.engine.AbstractSurface
      extended by net.sf.j3d.threeD.raytracer.primitives.Sphere
          extended by net.sf.j3d.physics.Sphere
All Implemented Interfaces:
RigidBody, ParticleGroup, Surface, Light, SurfaceLight

public class Sphere
extends Sphere
implements RigidBody, ParticleGroup, SurfaceLight

Author:
Mike Murray

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sf.j3d.physics.RigidBody
RigidBody.State
 
Field Summary
 
Fields inherited from interface net.sf.j3d.threeD.raytracer.lighting.Light
castShadows
 
Constructor Summary
Sphere()
          Constructs a new Sphere object using (0.0, 0.0, 0.0) for all vector values 1.0 for mass, 1.0 for the coefficient of restitution, and 4 for the radial sample.
Sphere(Vector x, Vector r, Vector v, Vector w, Vector f, Vector t, double mass, double e, double radius, int radialSample)
          Constructs a new Sphere object using the specified initial rigid body state values.
 
Method Summary
 void draw(Camera c, Graphics g, double ox, double oy, double scale)
           
 double getIntensity()
          Returns the intensity of this Light object as a double value.
 SphericalLight getLight()
           
 double[][] getParticleVertices()
           
 double getRadius()
           
 Light[] getSamples()
           
 Light[] getSamples(int samples)
           
 RigidBody.State getState()
           
 Vector[] intersect(RigidBody b)
          Performs intersection calculations for this RigidBody object and the specified RigidBody object.
 void setIntensity(double intensity)
          Sets the intensity of this Light object.
 void setLight(SphericalLight light)
          Sets the SphericalLight object used by this Sphere object.
 void setLighting(boolean on)
           
 void setRadius(double radius)
           
 void updateModel()
           
 void updateVertices()
           
 
Methods inherited from class net.sf.j3d.threeD.raytracer.primitives.Sphere
getIndexOfRefraction, getNormalAt, intersect, intersectAt, triangulate
 
Methods inherited from class net.sf.j3d.threeD.raytracer.engine.AbstractSurface
addShader, addTexture, addTransform, calculateTransform, getColor, getColorAt, getColorAt, getIndexOfRefraction, getLocation, getParent, getReflectedPercentage, getReflectedPercentage, getRefractedPercentage, getRefractedPercentage, getRotationCoefficients, getScaleCoefficients, getShadeBack, getShadeFront, getShaderSet, getSize, getTexture, getTextures, getTextureSet, getTransform, getTransform, getTransforms, removeTexture, removeTransform, setColor, setIndexOfRefraction, setLocation, setParent, setReflectedPercentage, setRefractedPercentage, setRotationCoefficients, setScaleCoefficients, setShadeBack, setShadeFront, setShaders, setShaders, setSize, setTexture, setTextures, setTransform, setTransforms, shade
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.j3d.threeD.raytracer.lighting.Light
getColor, getColorAt, setColor
 

Constructor Detail

Sphere

public Sphere()
Constructs a new Sphere object using (0.0, 0.0, 0.0) for all vector values 1.0 for mass, 1.0 for the coefficient of restitution, and 4 for the radial sample.


Sphere

public Sphere(Vector x,
              Vector r,
              Vector v,
              Vector w,
              Vector f,
              Vector t,
              double mass,
              double e,
              double radius,
              int radialSample)
Constructs a new Sphere object using the specified initial rigid body state values.

Parameters:
x - location
r - rotation
v - linear velocity
w - angular velocity
f - force
t - torque
mass - mass
e - coefficient of restitution
radius - radius
Method Detail

setRadius

public void setRadius(double radius)

getRadius

public double getRadius()

updateModel

public void updateModel()
Specified by:
updateModel in interface RigidBody

updateVertices

public void updateVertices()

intersect

public Vector[] intersect(RigidBody b)
Description copied from interface: RigidBody
Performs intersection calculations for this RigidBody object and the specified RigidBody object.

Specified by:
intersect in interface RigidBody
Returns:
{intersection point, normal to intersection} or a zero length array if there is no intersection.

getParticleVertices

public double[][] getParticleVertices()
Specified by:
getParticleVertices in interface ParticleGroup
See Also:
ParticleGroup.getParticleVertices()

getState

public RigidBody.State getState()
Specified by:
getState in interface RigidBody
See Also:
RigidBody.getState()

draw

public void draw(Camera c,
                 Graphics g,
                 double ox,
                 double oy,
                 double scale)
Specified by:
draw in interface RigidBody
See Also:
RigidBody.draw(Camera, Graphics, double, double, double)

setLighting

public void setLighting(boolean on)

setLight

public void setLight(SphericalLight light)
Sets the SphericalLight object used by this Sphere object.

Parameters:
light - SphericalLight object to use.

getLight

public SphericalLight getLight()
Returns:
The SphericalLight object stored by this Sphere object.

getSamples

public Light[] getSamples(int samples)
Specified by:
getSamples in interface SurfaceLight
Parameters:
samples - Total number of samples to return.
Returns:
An array containing samples for this SurfaceLight instance.
See Also:
SurfaceLight.getSamples(int)

getSamples

public Light[] getSamples()
Specified by:
getSamples in interface SurfaceLight
Returns:
An array containing samples for this SurfaceLight instance.
See Also:
SurfaceLight.getSamples()

setIntensity

public void setIntensity(double intensity)
Description copied from interface: Light
Sets the intensity of this Light object.

Specified by:
setIntensity in interface Light
See Also:
Light.setIntensity(double)

getIntensity

public double getIntensity()
Description copied from interface: Light
Returns the intensity of this Light object as a double value.

Specified by:
getIntensity in interface Light
See Also:
Light.getIntensity()