j3d.org Code

org.j3d.geom.spline
Class BezierGenerator

java.lang.Object
  extended by org.j3d.geom.GeometryGenerator
      extended by org.j3d.geom.spline.BezierGenerator

public class BezierGenerator
extends GeometryGenerator

Geometry generator for generating a single Bezier curve.

Bezier curves of all orders are permitted. Order information is derived from the provided controlPoint coordinates.

Version:
$Revision: 1.4 $
Author:
Justin Couch

Constructor Summary
BezierGenerator()
          Construct a new generator with default settings of 16 line segments over the length of one curve.
BezierGenerator(int facets)
          Construct a new generator with the specified number of tessellations over the length of the curve, regardless of extents.
 
Method Summary
 void generate(GeometryData data)
          Generate a new set of geometry items patchd on the passed data.
 int getVertexCount(GeometryData data)
          Get the number of vertices that this generator will create for the curve.
 void setControlPoints(float[] controlPoints)
          Set the curve controlPoints.
 void setControlPoints(float[] controlPoints, int numValid)
          Set the curve controlPoints from a subset of the given array.
 void setFacetCount(int facets)
          Change the number of facets used to create this cone.
 
Methods inherited from class org.j3d.geom.GeometryGenerator
createFaceNormal, createFaceNormal, createRadialNormal, createRadialNormal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BezierGenerator

public BezierGenerator()
Construct a new generator with default settings of 16 line segments over the length of one curve.


BezierGenerator

public BezierGenerator(int facets)
Construct a new generator with the specified number of tessellations over the length of the curve, regardless of extents.

Parameters:
facets - The number of facets on the side of the curve
Throws:
java.lang.IllegalArgumentException - The number of facets is less than 3
Method Detail

setFacetCount

public void setFacetCount(int facets)
Change the number of facets used to create this cone. This will cause the geometry to be regenerated next time they are asked for. The minimum number of facets is 3.

Parameters:
facets - The number of facets on the side of the cone
Throws:
java.lang.IllegalArgumentException - The number of facets is less than 3

setControlPoints

public void setControlPoints(float[] controlPoints)
Set the curve controlPoints. The array is presented with the coordinates flattened as [Xn, Yn, Zn] in the width array. The order of the patch is determined by the passed array. If the arrays are not of minimum length 3 an exception is generated.

Parameters:
controlPoints - The controlPoint coordinate values

setControlPoints

public void setControlPoints(float[] controlPoints,
                             int numValid)
Set the curve controlPoints from a subset of the given array. The array is presented with the coordinates flattened as [Xn, Yn, Zn] in the width array. The order of the patch is determined by the and number of points. If the arrays are not of minimum length 3 an exception is generated.

Parameters:
controlPoints - The controlPoint coordinate values
numValid - The number of valid points in the array

getVertexCount

public int getVertexCount(GeometryData data)
                   throws UnsupportedTypeException
Get the number of vertices that this generator will create for the curve. This is just the number of facets + 1.

Specified by:
getVertexCount in class GeometryGenerator
Parameters:
data - The data to base the calculations on
Returns:
The vertex count for the object
Throws:
UnsupportedTypeException - The generator cannot handle the type of geometry you have requested

generate

public void generate(GeometryData data)
              throws UnsupportedTypeException,
                     InvalidArraySizeException
Generate a new set of geometry items patchd on the passed data. If the data does not contain the right minimum array lengths an exception will be generated. If the array reference is null, this will create arrays of the correct length and assign them to the return value.

Specified by:
generate in class GeometryGenerator
Parameters:
data - The data to patch the calculations on
Throws:
InvalidArraySizeException - The array is not big enough to contain the requested geometry
UnsupportedTypeException - The generator cannot handle the type of geometry you have requested

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org