jme.geometry.primitive
Class Disk

java.lang.Object
  extended byjme.geometry.primitive.Primitive
      extended byjme.geometry.primitive.Quadric
          extended byjme.geometry.primitive.Disk
All Implemented Interfaces:
Geometry
Direct Known Subclasses:
PartialDisk

public class Disk
extends Quadric

Disk defines a disk geometry. The disk is defined by two radii. That of the inner circle and that of the outer circle. The inner radius can be zero creating a solid disk. Any value greater than zero for the inner radius will result in a hole of the given radius. The number of slices determine the number of subdivisions around the z axis. While the loops determine the number of concentric rings around the center.

Version:
$Id: Disk.java,v 1.4 2003/09/08 20:29:27 mojomonkey Exp $
Author:
Mark Powell

Field Summary
protected  double innerRadius
           
protected  int loops
           
protected  double outerRadius
           
protected  int slices
           
 
Fields inherited from class jme.geometry.primitive.Quadric
quadricPointer
 
Fields inherited from class jme.geometry.primitive.Primitive
alpha, blue, green, red
 
Constructor Summary
Disk(double innerRadius, double outerRadius, int slices, int loops)
          Constructor creates a new Disk geometry object.
 
Method Summary
 Vector[] getPoints()
          getPoints returns an array of Vectors that represents each point that makes up the piece of geometry.
 void render()
          render handles rendering the sphere to the view context.
 void setInnerRadius(double innerRadius)
          setInnerRadius sets the inner radius of the disk.
 void setLoops(int loops)
          setLoops sets the number of loops for the disk.
 void setOuterRadius(double outerRadius)
          setOuterRadius sets the outer radius of the disk.
 void setSlices(int slices)
          setSlices sets the slices of the disk.
 
Methods inherited from class jme.geometry.primitive.Quadric
initialize, preRender
 
Methods inherited from class jme.geometry.primitive.Primitive
clean, getTextureId, setColor, setTexture, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

innerRadius

protected double innerRadius

outerRadius

protected double outerRadius

slices

protected int slices

loops

protected int loops
Constructor Detail

Disk

public Disk(double innerRadius,
            double outerRadius,
            int slices,
            int loops)
Constructor creates a new Disk geometry object. The disk is defined by the given parameters, innerRadius, outerRadius, slices and loops. The inner radius can be zero creating a solid disk. Any value greater than zero for the inner radius will result in a hole of the given radius. The number of slices determine the number of subdivisions around the z axis. While the loops determine the number of concentric rings around the center.

Parameters:
innerRadius - the inner radius of the disk.
outerRadius - the outer raidus of the disk.
slices - the subdivisions of the disk.
loops - the concentric rings aroudn the disk.
Throws:
MonkeyRuntimeException - if any parameter is negative and all but innerRadius is zero.
Method Detail

render

public void render()
render handles rendering the sphere to the view context.

Specified by:
render in interface Geometry
Specified by:
render in class Quadric

setInnerRadius

public void setInnerRadius(double innerRadius)
setInnerRadius sets the inner radius of the disk.

Parameters:
innerRadius - the new inner radius.
Throws:
MonkeyRuntimeException - if innerRadius is less than zero.

setOuterRadius

public void setOuterRadius(double outerRadius)
setOuterRadius sets the outer radius of the disk.

Parameters:
outerRadius - the new outer radius.
Throws:
MonkeyRuntimeException - if outerRadius is less than or equal to zero.

setSlices

public void setSlices(int slices)
setSlices sets the slices of the disk.

Parameters:
slices - the new slices value.
Throws:
MonkeyRuntimeException - if slices is less than or equal to zero.

setLoops

public void setLoops(int loops)
setLoops sets the number of loops for the disk.

Parameters:
loops - the new loops value.
Throws:
MonkeyRuntimeException - if loops are less than or equal to zero.

getPoints

public Vector[] getPoints()
Description copied from interface: Geometry
getPoints returns an array of Vectors that represents each point that makes up the piece of geometry.

Returns:
the array of vectors for the points.