Jessica Timczyk – Project 07 – Curves

Curves

// Jessica Timczyk
// Section D
// jtimczyk@andrew.cmu.edu
// Project-07-Curves

// Global Variables
var z;
var colorR;
var colorG;
var colorB;


function setup() {
    createCanvas(480, 480);
    z = -width / 4;
}

function draw() {
    background(255, 215, 250);
    translate(width / 2, height / 2, z);
    rotate(map(mouseX, 0, width, 0, TWO_PI)); // allow curve to rotate
    colorR = map(mouseY, 0, height, 0, 100); // variables for color transition
    colorG = map(mouseY, 0, height, 70, 100);
    colorB = map(mouseY, 0, height, 100, 220);
    drawLoxodrome(0.4, map(mouseX, 0, 400, 0, 480)); // draw curves and change size as mouse moves
}

function drawLoxodrome(b, scal) { // equations for drawing the curves of the loxodrome
    for (var a = 0.4; a < 4; a += 0.2) {
        noStroke();
        fill(colorR, colorG, colorB); // fill of the curves change
        beginShape(QUAD_STRIP); // establish the begining of the curve shape
        var w = 0.1 / sqrt(a + 1);
        for (var t = -20; t < 20; t += 0.1) {
            var q = 4 + a * a * exp(2 * b * t);
            vertex(scal * 4 * a * exp( b * t) * cos(t) / q, scal * 4 * a * exp( b * t) * sin(t) / q);
            var c = a + w;
            q = 4 + c * c * exp(2 * b * t);
            vertex(scal * 4 * c * exp(b * t) * cos(t) / q, scal * 4 * c * exp(b * t) * sin(t) / q);
        }
        endShape();
    }
}

I really enjoyed doing this project, it allowed me to experiment with a bunch of different curves and shapes. Although it took a while to decide what shape to do and as well figure out the different equations and what each one does, the ending results are very interesting and intricate curves. I liked being able to manipulate and explore what each of the different parameters control. After messing with the different variables and trying to change different ones with the movements of the mouse, I  decided on having the mouse movement control the scale of the shape rather than one of the other parameters so that it would keep the main structure of the curve intact as it moved. Overall, I really enjoyed this project because it allowed me to explore more things and aspects of the code than other previous projects have allowed us.

Yingyang Zhou-Project-07-Curves

Curves

//Yingyang Zhou
//Section A
//yingyanz@andrew.cmu.edu
//Project-07


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

function draw() {
  background(250);
  drawAstroid();
  drawEpispiral();
  drawRadialCurve();
  frameRate(20);

function drawAstroid(){
  push();
  translate(width/2, height/2);
  var a = 200;
  var b = 200;
  for(r = 0; r < 5; r++){
    rotate(r);
    noFill();
    strokeWeight(0.1);
    var red = map(r, 0, 3.14, 0, 255);
    stroke(red,0,255-red);
    beginShape();
    for (var t = 0; t < mouseX; t++){
      x = a*cos(t)*cos(t)*cos(t);
      y = a*sin(t)*sin(t)*sin(t);
      curveVertex(x + random(0, 1),y + random(0, 1));
    }
    endShape();
  }
  pop();
}
}

function drawEpispiral(){
  push();
  translate(width/2, height/2);
  var a = 60;
  var b = 20;
  var h = constrain(mouseX/2, 0, width/2);
  var r = mouseX/50;
  noFill();
  strokeWeight(0.5);
  stroke("red");
  beginShape();
  for (c = 0; c < 200; c++){
    var t = map(c, 0, 180, 0, TWO_PI);
    x = (a+b)*cos(t)-h*cos(c+t*(a+b)/b);
    y = (a+b)*sin(t)-h*sin(c+t*(a+b)/b);
    curveVertex(x, y);
  }
  endShape();
  pop();
}

function drawRadialCurve(){
  push();
  translate(width/2, height/2);
  beginShape();
  var angle = map(mouseX,0, width, 0, 360);
  rotate(radians(angle));
  var a = 50;
  for (var t = 0; t < 200; t +=2){
    stroke(t, 0, 0);
    strokeWeight(0.5);
    var x = 1/3*a*(2*cos(t)+cos(2*t));
    var y = 1/3*a*(2*sin(t)-sin(2*t));
    curveVertex(x,y);
  }
  endShape();
  pop();

}

In this project, I start using functions which make the code more readable and easier to revise if needed. I use three types of curves in this project all involving sin and cos but different from each other and have different movement along the changes of mouse position.

Han Yu Project 07 Curves

sketch

// Han Yu
// Section D
// hyu1@andrew.cmu.edu
// Project 07

var nPoints = 200;

function setup() {
    createCanvas(400, 400, WEBGL); // create a 3D canvas
    frameRate(100);
}

function draw() {
    background(100);   
    fill(250); 
    rotateZ(millis() / 8000);
    stroke(250);    
    drawFlower();
}

function drawFlower() {
    // http://mathworld.wolfram.com/Slinky.html   
    var x;
    var y;
    var z;
    // variables inside the formula
    var p = constrain((mouseX / width), 0.0, 400);
    var q = constrain((mouseY / height), 0.0, 400.0);
    
    fill(200, 200, 255, 100.5);
    beginShape();
    stroke(250);
    for (var i = 0; i < nPoints; i++) {
        var t = map(i, 0, nPoints, 0, TWO_PI);
        
        // Flower(slinky):
        x = (PI+100*cos(10*q*t))*cos(t);
        y = (PI+100*cos(10*q*t))*sin(t);
        z = 1/2*p*t + 100*sin(10*p*t);    

        vertex(x, y, z);
    }
    endShape(CLOSE);
}

I used a slinky curve for my project. A slinky curve is a space curve which consists of a spiral wound around a helix. I altered it in order to show the formation of a flower. Overall I found this project is helpful with familiar with 3D plane and curves. Below are some screenshots of different stages of my project.

Start stage. Mouse at top left corner.
Flower in formation.
Final stage complex flower. Mouse at bottom right corner.

Jacky’s Project 07

sketch

//Yinjie Tian
//Section B
//yinjiet@andrew.cmu.edu
//Assignment-07-A
function setup() {
    createCanvas(480, 480);
    frameRate(10);
}

function draw() {
    background(0);
    noFill();
    stroke(255, random(150,255), 255)
    var nPoints = 20;
    var radius = width / 2 - mouseX;
    var radius2 = width / 2 - mouseX * random(0.4, 0.9)
    var radius3 = width / 2 - mouseX * random(0.4, 0.9)
    var radius4 = width / 2 - mouseX * random(0.4, 0.9)
    var radius5 = width / 2 - mouseX * random(0.4, 0.9)
    var radius6 = width / 2 - mouseX * random(0.4, 0.9)
   
    
    
    // draw the circle as a wiggly circle
    push();
    
    translate(width / 2, height / 2);
    beginShape();

    for (var a = 0; a < nPoints; a++) { //circle 1
        var theta = map(a, 0, nPoints, 0, TWO_PI);
        var px = radius * cos(theta);
        var py = radius * sin(theta);
        vertex(px + random(-5, 5), py + random(-5, 5));
    }
        noFill();
        stroke(random(150,255), 255, 255)
     for (var b = 0; b < nPoints; b++) {    //circle 2
        var theta = map(b, 0, nPoints, 0, TWO_PI);
        var px = radius2 * cos(theta);
        var py = radius2 * sin(theta);
        vertex(px + random(-5, 5), py + random(-5, 5));
    }
    noFill();
        stroke(random(150,255), random(150,255), random(150,255))
     for (var c = 0; c < nPoints; c++) {    //circle 3
        var theta = map(c, 0, nPoints, 0, TWO_PI);
        var px = radius3 * cos(theta);
        var py = radius3 * sin(theta);
        vertex(px + random(-5, 5), py + random(-5, 5));
    }
     for (var d = 0; d < nPoints; d++) {    //circle 4
        var theta = map(d, 0, nPoints, 0, TWO_PI);
        var px = radius4 * cos(theta);
        var py = radius4 * sin(theta);
        vertex(px + random(-5, 5), py + random(-5, 5));
    }
        noFill();
        stroke(random(150,255), 255, 255)
     for (var e = 0; e < nPoints; e++) {    //circle 5
        var theta = map(e, 0, nPoints, 0, TWO_PI);
        var px = radius5 * cos(theta);
        var py = radius5 * sin(theta);
        vertex(px + random(-5, 5), py + random(-5, 5));
    }
    noFill();
        stroke(random(150,255), random(150,255), random(150,255))
     for (var f = 0; f < nPoints; f++) {    //circle 6
        var theta = map(f, 0, nPoints, 0, TWO_PI);
        var px = radius6 * cos(theta);
        var py = radius6 * sin(theta);
        vertex(px + random(-5, 5), py + random(-5, 5));
    }
    endShape(CLOSE);
    pop();
    
    
    
}

For this project, I first choose the ellipse as the base geometry. Then I use vertex to make each of the ellipse to wiggle. The radius for the ellipse are selected randomly based on the mouseX position. Colors for the curves are also selected randomly.

Justin Yook- Project 07

curves

// Justin Yook
// jyook@andrew.cmu.edu
// Section C
// Project 07

var nPoints = 250; // number of points drawn to create shape

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

function draw() {
    background(0);
    fill(255);
    text("Modified Quadrifolum", 20, 40);

    // draw the curve
    push();
    translate(width / 2, height / 2);
    drawQuadrifoliumMod();
    pop();
}

function drawQuadrifoliumMod() {
    // http://mathworld.wolfram.com/Quadrifolium.html
    // Polar equation is in form: r = a * sin(2 * theta), but I modified 2 to 6 to create a flower

    var x;
    var y;
    var r;
    var a = constrain(mouseX, 60, 220);

    beginShape();
    for (var i = 0; i < nPoints; i++) {
        var theta = map(i, 0, nPoints, 0, TWO_PI);

        // Modified Quadrifolium
        if (mouseX > width / 2) {
        fill(0, 191, 255);
        r = a * sin(6 * theta);
        x = r * cos(theta);
        y = r * sin(theta);
        vertex(x + random(-2, 2), y + random(-2, 2));
        }

        // Original Quadrifolium
        if (mouseX < width / 2) {
        fill(0, 191, 255);
        r = a * sin(3 * theta);
        x = r * cos(theta);
        y = r * sin(theta);
        vertex(x + random(-2, 2), y + random(-2, 2));
        }
    }
    endShape(CLOSE);
}

In this project, I used modified versions of the quadrifolium to create flower-like shapes. I was inspired by the way fire appears on gas stoves, so I made the shapes jiggle slightly. The parameter that is interactive is the size of the curves, and the number of flower petals. When the mouse moves to the right, more petals show up, and the size increases. When the mouse moves to the left, fewer petals show up, and the size decreases.

Hannah Cai—Project 07—Curves

(click to reset.)

/* Hannah Cai
Section C
hycai@andrew.cmu.edu
Project-07-Curves
*/


var ra = 50; //radius of base circle
var rb = 10; //radius of revolving perimeter circle
var h = 0; //height of curve from the center of rb
var t; //time
var o; //opacity of background
var x;
var y;
var v; //velocity


function setup() {
    createCanvas(480,480);
    background(0);
    stroke(255);
    strokeWeight(1);
    frameRate(30); //.5x animation
}

function draw() {
    o = map(mouseY, 0, height, 100, 25); //maps mouseY to background opacity
    mouseY = constrain(mouseY, 0, height); //constrains mouseY to canvas
    background(0, o);
    v = map(mouseX, 0, width, 1, -1); //maps velocity of ra and h to mouseX 
    ra += v; 
    h += v;

    for (t = 0; t < TWO_PI; t += .01) { 
        push();
        translate(width / 2, height / 2); //moves origin to center
        //epitrochoid equation
        x = (ra + rb) * cos(t) - h * cos(((ra + rb) / rb) * t); 
        y = (ra + rb) * sin(t) - h * sin(((ra + rb) / rb) * t);
        point(x, y); //draws points on the curve
        pop();
    }
}

//resets animation when mouse is clicked
function mouseClicked() {
    ra = 50;
    h = 0;
    t = 0;
}


inverted
starting point
opening
expanding
expanded (mouse in center)
expanded (mouse in bottom left or right)

For my project, I chose the epitrochoid:

When writing the code for it, I felt more interested by the particle patterns formed by the curve rather than the curve itself, so I chose to focus on those. While I didn’t enjoy the math involved (there were some really interesting/beautiful curves that I wanted to try creating, but just couldn’t understand), I do think it’s cool that you can basically plug equations straight into code and generate visual effects with them. Overall, I enjoyed the project.

Justin Yook- Looking Outwards 07

Glimpse of the application visuals

Peak Spotting by Studio.NAND is an interactive application created for Deutsche Bahn, a railway company located in Berlin, Germany. It is a visual tool that allows Deutsche Bahn to manage their rail network by looking up to 100 days into the future. Specifically, tasks such as optimizing prices, train coordination, and providing better customer service. The program is run by machine learning algorithms that display data in an instant for the traffic managers. I think this application is interesting because it helps visualize and understand complicated issues, that might be hard for people to casually identify and resolve. The German rail network seems intricate and it can be easy for anyone to overlook details. One can see Studio.NAND’s artistic sensibilities from the simple design; the train routes, and the trains can be quickly checked.

Source: https://nand.io/projects/peak-spotting

Julie Choi – Project 07 – Curves

jjchoi_curves

// Julie Choi
// jjchoi
// Project 07
// Section E

var nPoints = 360;

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

function draw() {
	background(230, 171, 130);
	push();
    translate(240, 240);
	drawEightCurve();
    drawCruciform();
	pop(); 
}

function drawEightCurve() { 
	// http://mathworld.wolfram.com/EightCurve.html
    var x;
    var y;
    var a = 300;
    var b = a / 2.0;
    var p = constrain(mouseY, 0, 480);
    var q = mouseX / 400;
    stroke(148, 79, 81);

    //create for loop to create eight curves in different sizes
    for(var r = 0; r < 1; r+=0.1){
    	// use push pop to rotate the forms with mouse location
        push();
        rotate(map(p, 0, 480, 0, 2 * PI));
        beginShape();
        noFill();
        // make the lines jitter by adding random function
        for (var i = 0; i < nPoints; i++) {
            var t = map(i, 0, nPoints, 0, PI * 2);
            x = a * sin(t) * (q + r) + random(-1, 1);
            y = a * sin(t) * cos(t) * (q + r) + random(-1, 1);
            vertex(x, y);
        }
        endShape(CLOSE);
        pop();
    }
}

function drawCruciform() { 
	// http://mathworld.wolfram.com/Cruciform.html
    var x2;
    var y2;
    var a2 = 300;
    var b2 = a2 / 2.0;
    var p2 = constrain(mouseY, 0, 480);
    var q2 = mouseX / 400;
    stroke(255);

    //create for loop to create cruciforms in different sizes
    for(var j = 0; j < 1; j+=0.1){
    	// use push pop to rotate the forms with mouse location
        push();
        rotate(/*map(p2, 0, 480, 0, 2 * */PI);
        beginShape();
        noFill();
        // make the lines jitter by adding random function
        for (var i = 0; i < nPoints; i++) {
            var t2 = map(i, 0, nPoints, 0, PI * 2);
            x2 = a2 * (1/(cos(t2)) * (q2 + j) + random(-0.5, 0.5));
            y2 = a2 * (1/(sin(t2)) * cos(t2) * (q2 + j) + random(-0.5, 0.5));
            vertex(x2, y2);
        }
        endShape(CLOSE);
        pop();
    }
}

Approaching this project was challenging than I thought because it incorporated different sources of information from a website. However, I learned how to use it to my advantage to create this chaotic curve pattern. My initial idea was to put two different types of curves: eight curves and cruciform. I got the eight curves to jitter and move based on the mouse, but for the cruciforms, I ended up jittering throughout the whole canvas creating a spiderweb-like visual. This was not my initial idea, but just playing around with the different variables and adding it to the formulas provided in the website helped me explore all the different variations of the lines. Down here are the steps of how my curves transform:

Alexandra Kaplan – Looking Outwards – 7

 

Infographic containing the map of different regions as well as the phone call map.

The project on information visualization that caught my eye was a project created by the New York Times in 2011 called “Phone Call Cartography” in which researches from MIT, AT&T, and IBM compiled research about phone calls and where they are from/to. This data is then compiled into a map in different arcs each representing thousands of phone calls. I have always enjoyed looking at maps, so seeing such interesting data being the foundation of one is fascinating. For the algorithm, it seems like they assigned the data to different regions and had regions with more data be taller and bolder. I think that it is really cool that even without the normal geographic map of the United States, it is still possible to tell what cities are where as well as a general population of different areas. I would be interested in seeing a similar map for today, I wonder if there would be a similar number of phone calls, fewer, or greater.

Looking outwards 7 rrandell

http://www.aaronkoblin.com/project/flight-patterns/

This is a link to his website and here are some photos of his work below:

The piece that I have chosen for this data visualization looking outwards is called Flight Patterns by Aaron Koblin. I am particularly drawn to this piece because of how clearly you can see a map start to take place over the hundreds of thousands of flights in America. Not only is the data clear, but it is also strangely beautiful and ethereal– the individual flights serve as pieces of blue-ish light that light up the dark negative space. Aaron Koblin used FAA (Federal Aviation Administration) data and parsed and plotted it to represent the artwork that is shown on his website. He also used the ‘processing’ programming environment which is a coding language designed specifically for visual arts.