bezier()
Shape / CurvesDescription
Draws a cubic bezier curve on the screen.
Syntax
void bezier(float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2)
Parameters
| Name | Type | Description |
|---|---|---|
| x1 | float | x of start point |
| y1 | float | y of start point |
| 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 |
| x2 | float | x of end point |
| y2 | float | y of end point |
Returns
voidRelated
Under the Hood
From Processing.h:
void bezier(float,float,float,float,float,float,float,float);
bezier((float)x1,(float)y1,(float)cx1,(float)cy1,
(float)cx2,(float)cy2,(float)x2,(float)y2);
void bezier(float x1,float y1,float cx1,float cy1,float cx2,float cy2,float x2,float y2);
inline void bezier(float x1,float y1,float cx1,float cy1,float cx2,float cy2,float x2,float y2){ if(PApplet::g_papplet) PApplet::g_papplet->bezier(x1,y1,cx1,cy1,cx2,cy2,x2,y2); }
Under the Hood
From Processing.cpp:
void PApplet::bezier(float x1,float y1,float cx1,float cy1,float cx2,float cy2,float x2,float y2){
if(!doStroke)return;applyStroke();glLineWidth(strokeW);glBegin(GL_LINE_STRIP);
for(int i=0;i<=bezierDetailVal;i++){float t=i/(float)bezierDetailVal,u=1-t;
glVertex2f(u*u*u*x1+3*u*u*t*cx1+3*u*t*t*cx2+t*t*t*x2,u*u*u*y1+3*u*u*t*cy1+3*u*t*t*cy2+t*t*t*y2);}
glEnd();
}