//Dana Kim
//Section D

var nPoints = 30;

function setup() {
  createCanvas(480, 480);

function drawCurve() {
  var cx = constrain(mouseX, 100, 400);
  var cy = constrain(mouseY, 100, 400);

  for(var i = 0; i < nPoints; i++){
    var t = (i/1.5)*500; //determines the angle of the vertexes
    var a = (cx/.5); //determines the scale of curve
    var px = (1/cos(t)+(a*cos(t)))*cos(t);
    var py = (1/cos(t)+(a*cos(t)))*sin(t);
    stroke(cx, 0, cy);
    ellipse(px, py, 5, 5); //creates ellipses along points of curve
    stroke(0, cx, cy);
    vertex(px*1.5, py*1.5); //creates curves

function draw() {

I used the Conchoid of de Sluze roulette curve for this project. I made two different, yet connected, objects within the drawing with this curve. One of the set of curves was written to be made of ellipses that are placed on points along the curve. The second set just draws the curves as they are. The scale and colors were set to change as the mouseX and mouseY changes.

Leave a Reply