/* 6.914, Example 1.5 quads, curves, beziers 0) The quad() commands generates quadrilateral shapes. You give four arguments, including an x and y for each point: quad(x1, y1, x2, y2, x3, y3, x4, y4); 1) The curve() command uses control points to generate curves. The first two points and the last two points are general indicators of how the curve should look. The middle four points are the two coordinate sets that give the start and end points for the curve. curve(cx1, cy1, x1, y1, x2, y2, cx2, cy2); 1a) curveTightness is a measure of how tightly the curve should adhere to the control points. Default curveTightness is 0. 2) The bezier() command also uses control points to generate a curve. The first/last two points give the first/last points of the curve. The control points designate tangents for the line. bezier(x1, y1, cx1, cy1, cx2, cy2, x2, y2); */ void setup(){ size(300, 300); smooth(); } void draw(){ background(230); noFill(); //quad stroke(255, 0, 0); quad(40, 50, 50, 80, 40, 100, 15, 60); //curve // default curveTightness is 0 - try changing it //curveTightness(3); stroke(0, 200, 0); curve(5, 126, 5, 126, 73, 110, 73, 161); curve(73, 124, 73, 150, 15, 165, 15, 165); stroke(0); curve(5, 126, 73, 110, 73, 150, 15, 165); // bezier stroke(0, 200, 0); line(70, 245, 5, 210); // line between x1, y1 and cx1, xy1 line(90, 290, 15, 280); // line between cx2, cy2 and x2, y2 stroke(0, 0, 0); bezier(70, 245, 5, 210, 90, 290, 15, 280); }