quad()
Shape / 2D PrimitivesDescription
Draws a quadrilateral (a four-sided polygon) using the x and y coordinates of its four vertices.
Syntax
void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
Parameters
| Name | Type | Description |
|---|---|---|
| x1 | float | x of first vertex |
| y1 | float | y of first vertex |
| x2 | float | x of second vertex |
| y2 | float | y of second vertex |
| x3 | float | x of third vertex |
| y3 | float | y of third vertex |
| x4 | float | x of fourth vertex |
| y4 | float | y of fourth vertex |
Returns
voidRelated
Under the Hood
From Processing.h:
void quad(float,float,float,float,float,float,float,float);
inline void quad(A x1,B y1,C x2,D y2,E x3,F y3,G x4,H y4){ _api::quad((float)x1,(float)y1,(float)x2,(float)y2,(float)x3,(float)y3,(float)x4,(float)y4);
void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
inline void quad(float x1,float y1,float x2,float y2,float x3,float y3,float x4,float y4){ if(PApplet::g_papplet) PApplet::g_papplet->quad(x1,y1,x2,y2,x3,y3,x4,y4); }
Under the Hood
From Processing.cpp:
void PApplet::quad(float x1, float y1, float x2, float y2,
float x3, float y3, float x4, float y4) {
if (doFill) {
applyFill();
glBegin(GL_QUADS);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x3, y3);
glVertex2f(x4, y4);
glEnd();
}
if (doStroke) {
applyStroke();
glLineWidth(strokeW);
glBegin(GL_LINE_LOOP);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x3, y3);
glVertex2f(x4, y4);
glEnd();
restoreLighting();
}
}