bezierVertex()
Shape / VertexDescription
Specifies vertex coordinates for bezier curves inside beginShape()/endShape().
Syntax
void bezierVertex(float cx1, float cy1, float cx2, float cy2, float x, float y)
Parameters
| Name | Type | Description |
|---|---|---|
| cx1 | float | x of first control point |
| cy1 | float | y of first control point |
| cx2 | float | x of second control point |
| cy2 | float | y of second control point |
| x | float | x of anchor point |
| y | float | y of anchor point |
Returns
voidRelated
Under the Hood
From Processing.h:
void bezierVertex(float cx1, float cy1, float cx2, float cy2, float x, float y);
Under the Hood
From Processing.cpp:
void PApplet::bezierVertex(float cx1,float cy1,float cx2,float cy2,float x,float y){
if(!inShape||shapeVerts.empty())return;
auto[x0,y0]=shapeVerts.back();const int sg=bezierDetailVal;
for(int i=1;i<=sg;i++){float t=i/(float)sg,u=1-t;
float bx=u*u*u*x0+3*u*u*t*cx1+3*u*t*t*cx2+t*t*t*x, by=u*u*u*y0+3*u*u*t*cy1+3*u*t*t*cy2+t*t*t*y;
shapeVerts.push_back({bx,by}); shapeVerts3D.push_back({bx,by,0.0f});}
}