toxi.geom.mesh
Class BezierPatch

java.lang.Object
  extended by toxi.geom.mesh.BezierPatch

public class BezierPatch
extends java.lang.Object

4x4 bezier patch implementation with tesselation support (dynamic resolution) for generating triangle mesh representations.


Field Summary
 Vec3D[][] points
           
 
Constructor Summary
BezierPatch()
           
BezierPatch(Vec3D[][] points)
           
 
Method Summary
 Vec3D computePointAt(float u, float v)
           
static Vec3D computePointAt(float u, float v, Vec3D[][] points)
          Computes a single point on the bezier surface given by the 2d array of control points.
 BezierPatch set(int x, int y, Vec3D p)
           
 Mesh3D toMesh(int res)
           
 Mesh3D toMesh(Mesh3D mesh, int res)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

points

public Vec3D[][] points
Constructor Detail

BezierPatch

public BezierPatch()

BezierPatch

public BezierPatch(Vec3D[][] points)
Method Detail

computePointAt

public static Vec3D computePointAt(float u,
                                   float v,
                                   Vec3D[][] points)
Computes a single point on the bezier surface given by the 2d array of control points. The desired point's coordinates have to be specified in UV space (range 0.0 .. 1.0). The implementation does not check or enforce the correct range of these coords and will not return valid points if the range is exceeded.

Parameters:
u - positive normalized U coordinate on the bezier surface
v - positive normalized V coordinate on the bezier surface
points - 4x4 array defining the patch's control points
Returns:
point on surface

computePointAt

public Vec3D computePointAt(float u,
                            float v)

set

public BezierPatch set(int x,
                       int y,
                       Vec3D p)

toMesh

public Mesh3D toMesh(int res)

toMesh

public Mesh3D toMesh(Mesh3D mesh,
                     int res)