public class Patch extends java.lang.Object implements Patchy
draw()
method as needed.
The control points can be given as a 4x4 array of PVectors,
3 4x4 arrays of floats (interprested as the x, y, and z coordinates
respectively), or 3 4x4 arrays of doubles (interpreted like the
floats). All internal operations are done in double-precision,
which is then rounded down for drawing in PApplet.
A Patch has a BoundingVolume, which is useful for scaling and
positioning when drawing.
This class is not thread-safe. In particular, if you modify a Patch's
control points while another thread is calling draw()
on the
same instance, results are undefined.BEZIER, BSPLINE, CATMULL_ROM, HERMITE
Modifier and Type | Method and Description |
---|---|
static Patch |
create(double[][] basis,
double[][] cpX,
double[][] cpY,
double[][] cpZ) |
static Patch |
create(double[][] basis,
double[][] cpX,
double[][] cpY,
double[][] cpZ,
int gridSteps) |
static Patch |
create(double[][] basis,
float[][] cpX,
float[][] cpY,
float[][] cpZ) |
static Patch |
create(double[][] basis,
float[][] cpX,
float[][] cpY,
float[][] cpZ,
int gridSteps) |
static Patch |
create(double[][] basis,
PVector[][] controlPoints) |
static Patch |
create(double[][] basis,
PVector[][] controlPoints,
int gridSteps) |
void |
draw(PApplet p) |
void |
draw(PApplet p,
PImage texture) |
void |
drawControlPoints(PApplet p) |
BoundingVolume |
getBounds() |
BoundingVolume |
scale(double scale) |
void |
set(int row,
int col,
double x,
double y,
double z) |
void |
set(int row,
int col,
PVector cp) |
void |
setBasis(double[][] basis)
Set the basis matrix for this
|
void |
setGridSteps(int gridSteps)
Sets the "smoothness" of the rendered patch.
|
void |
setX(int row,
int col,
double val) |
void |
setY(int row,
int col,
double val) |
void |
setZ(int row,
int col,
double val) |
void |
translate(double dx,
double dy,
double dz) |
public static Patch create(double[][] basis, PVector[][] controlPoints)
public static Patch create(double[][] basis, PVector[][] controlPoints, int gridSteps)
public static Patch create(double[][] basis, float[][] cpX, float[][] cpY, float[][] cpZ)
public static Patch create(double[][] basis, float[][] cpX, float[][] cpY, float[][] cpZ, int gridSteps)
public static Patch create(double[][] basis, double[][] cpX, double[][] cpY, double[][] cpZ)
public static Patch create(double[][] basis, double[][] cpX, double[][] cpY, double[][] cpZ, int gridSteps)
public BoundingVolume getBounds()
public void set(int row, int col, double x, double y, double z)
public void set(int row, int col, PVector cp)
public void setX(int row, int col, double val)
public void setY(int row, int col, double val)
public void setZ(int row, int col, double val)
public void setBasis(double[][] basis)
Patchy
Set the basis matrix for this
public void setGridSteps(int gridSteps)
Patchy
Sets the "smoothness" of the rendered patch.
When generating the triangle mesh for this patch, use gridSteps X gridSteps vertices. Therefore, the cost of rendering this patch rises as the square of this parameter.
The default value is 20
.
setGridSteps
in interface Patchy
public BoundingVolume scale(double scale)
public void translate(double dx, double dy, double dz)
public void drawControlPoints(PApplet p)
drawControlPoints
in interface Patchy
processing library patchy by Jonathan Feinberg. (c) 2013