j3d.org Code

org.j3d.geom.spline
Class BSplinePatchGenerator

java.lang.Object
  extended by org.j3d.geom.GeometryGenerator
      extended by org.j3d.geom.spline.PatchGenerator
          extended by org.j3d.geom.spline.BSplinePatchGenerator

public class BSplinePatchGenerator
extends PatchGenerator

Geometry generator for generating rectangular BSpline patches.

BSpline patches of all orders are permitted. Order information is derived from the provided knot coordinates. When generating a patch, the values for the coordinates are nominally provided in the X and Z plane although no explicit checking is performed to ensure that knot coordinates do not self-intersect or do anything nasty. Normals are always generated as the average between the adjacent edges.

Version:
$Revision: 1.8 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.geom.spline.PatchGenerator
controlPointCoordinates, controlPointWeights, depthFacetCount, normalsChanged, numDepthControlPoints, numNormalValues, numPatchValues, numTexcoordValues, numWidthControlPoints, patchChanged, patchCoordinates, patchNormals, patchTexcoords, texCoordsChanged, useControlPointWeights, widthFacetCount
 
Constructor Summary
BSplinePatchGenerator()
          Construct a new generator with default settings of 20 grid squares over the length of one surface.
BSplinePatchGenerator(int widthFacets, int depthFacets)
          Construct a new generator with the specified number of tessellations over the side of the patch, regardless of extents and default degree of 3 for both width and depth.
BSplinePatchGenerator(int widthFacets, int depthFacets, int t)
          Construct a new generator with the specified number of tessellations over the side of the patch, regardless of extents and the same degree for both width and depth.
BSplinePatchGenerator(int widthFacets, int depthFacets, int tWidth, int tDepth)
          Construct a new generator with the specified number of tessellations over the side of the patch, regardless of extents and specific degree for both width and depth.
 
Method Summary
 void generateSmoothKnots()
          Convenience method to set knots that give a better looking curve shape using the existing curve degree.
 void generateSmoothKnots(int tWidth, int tDepth)
          Convenience method to set knots that give a better looking curve shape and set a new degree for the curve directly.
 int getDepthDegree()
          Get the degree of the curve being generated.
 int getWidthDegree()
          Get the degree of the curve being generated.
protected  void regeneratePatch()
          Regenerate the patch coordinate points according to the NURBS surface function.
 void setPatchKnots(int tWidth, double[] wKnots, int tDepth, double[] dKnots)
          Set the bezier patch knots.
 void setPatchKnots(int tWidth, float[] wKnots, int tDepth, float[] dKnots)
          Set the bezier patch knots.
 
Methods inherited from class org.j3d.geom.spline.PatchGenerator
enableControlPointWeights, generate, getVertexCount, hasControlPointWeights, regenerateNormals, regenerateTexcoords, setFacetCount, setPatchControlPoints, setPatchControlPoints, setPatchControlPoints, setPatchControlPoints, setPatchControlPoints, setPatchControlPoints, setPatchControlPoints, setPatchControlPoints, setPatchWeights, setPatchWeights, setPatchWeights, setPatchWeights
 
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

BSplinePatchGenerator

public BSplinePatchGenerator()
Construct a new generator with default settings of 20 grid squares over the length of one surface.


BSplinePatchGenerator

public BSplinePatchGenerator(int widthFacets,
                             int depthFacets)
Construct a new generator with the specified number of tessellations over the side of the patch, regardless of extents and default degree of 3 for both width and depth.

Parameters:
widthFacets - The number of facets on the width of the patch
depthFacets - The number of facets on the width of the patch
Throws:
java.lang.IllegalArgumentException - The number of facets is less than 3

BSplinePatchGenerator

public BSplinePatchGenerator(int widthFacets,
                             int depthFacets,
                             int t)
Construct a new generator with the specified number of tessellations over the side of the patch, regardless of extents and the same degree for both width and depth.

Parameters:
widthFacets - The number of facets on the width of the patch
depthFacets - The number of facets on the width of the patch
t - The degree of the curve > 1
Throws:
java.lang.IllegalArgumentException - The number of facets is less than 3

BSplinePatchGenerator

public BSplinePatchGenerator(int widthFacets,
                             int depthFacets,
                             int tWidth,
                             int tDepth)
Construct a new generator with the specified number of tessellations over the side of the patch, regardless of extents and specific degree for both width and depth.

Parameters:
widthFacets - The number of facets for the width
depthFacets - The number of facets for the depth
tWidth - The degree of the curve in the width direction > 1
tDepth - The degree of the curve in the depth direction > 1
Throws:
java.lang.IllegalArgumentException - The number of facets is less than 3
Method Detail

setPatchKnots

public void setPatchKnots(int tWidth,
                          float[] wKnots,
                          int tDepth,
                          float[] dKnots)
Set the bezier patch knots. The array is presented as [depth][width] 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 and equal length an exception is generated.

Parameters:
tWidth - The degree in the width direction
wKnots - The knot coordinate values in the width direction
tDepth - The degree in the depth direction
dKnots - The knot coordinate values in the depth direction

setPatchKnots

public void setPatchKnots(int tWidth,
                          double[] wKnots,
                          int tDepth,
                          double[] dKnots)
Set the bezier patch knots. The array is presented as [depth][width] 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 and equal length an exception is generated.

Parameters:
tWidth - The degree in the width direction
wKnots - The knot coordinate values in the width direction
tDepth - The degree in the depth direction
dKnots - The knot coordinate values in the depth direction

getWidthDegree

public int getWidthDegree()
Get the degree of the curve being generated.

Returns:
A value >= 2

getDepthDegree

public int getDepthDegree()
Get the degree of the curve being generated.

Returns:
A value >= 2

generateSmoothKnots

public void generateSmoothKnots(int tWidth,
                                int tDepth)
Convenience method to set knots that give a better looking curve shape and set a new degree for the curve directly. The traditional way of setting these is to have knot[i] = i, but whenever curves change this results in a lot of extra calculations. This smoothing function will localize the changes at any particular breakpoint in the line.

Parameters:
tWidth - The degree of the curve in the width direction
tDepth - The degree of the curve in the depth direction

generateSmoothKnots

public void generateSmoothKnots()
Convenience method to set knots that give a better looking curve shape using the existing curve degree. The traditional way of setting these is to have knot[i] = i, but whenever curves change this results in a lot of extra calculations. This smoothing function will localize the changes at any particular breakpoint in the line.


regeneratePatch

protected final void regeneratePatch()
Regenerate the patch coordinate points according to the NURBS surface function.

Specified by:
regeneratePatch in class PatchGenerator

j3d.org Code

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