3.2: Trigonometry and Polar Coordinates – The Nature of Code

[ad_1]
Chapter: 3

Official book website:

Twitter:
added annotations

This video describes the basics of trigonometry and how to use polar coordinates in Processing.

Read along:

Help us caption & translate this video!


Posted

in

by

Tags:

Comments

10 responses to “3.2: Trigonometry and Polar Coordinates – The Nature of Code”

  1. archi tech Avatar

    my maths teacher always told us an easy way of remembering SOHCAHTOA.
    SEX=SIN
    ON=OPPOSITE
    HARD=HYPOTENUSE
    CONCRETE=COS
    ALWAYS=ADJACENT
    HURTS=HYPOTENUSE
    THE=TAN
    OUTER=OPPOSITE
    ARMS=ADJACENT
    Always stuck with my that has. haha

  2. BrokenRobot Games Avatar

    So I understand what you are saying here, but how does one calculate the angle into a usable format. As it stands I've been using Cartesian coordinates to do all of my angle calculations in what seems like a primitive manner. I've been on Khan academy which doesn't have full access to the PVector function, Vector math doesn't work. So I take my origin (player) x,y as x1 and y1, and the mouse as x2, y2 and calculate angle with slope using m = y2-y1 over x2 – x1, then I can create a trajectory as y += m.y and x += m.x respectively. However after watching this I'm interested how I can convert to cos(o) sin(o) using angles if I don't know the angle. While I feel like the answer is staring me in the face, I don't know it. the rise over run doesn't give me the angle that I'm aware of, only a magnitude of the distance for individual x's and y's per iteration of frame. So how to get the angle??

  3. P-YAN Avatar

    Just a quick note if you are learning this stuff but using P5.JS. PI will not work outside setup, here's a thread about it (https://github.com/processing/p5.js/issues/903). Not really sure of solid alternative, I just wrote 3.14 as the actual value instead.

  4. David James ASMR Avatar

    //mapping the "yo-yo" with peril noise, for anyone who's stuck!

    float y;
    float x;
    float r = 100;
    float a = 0.0;
    float t = 0;

    void setup() {
    size(600, 600);
    }

    void draw() {
    background(255);

    translate(width/2, height/2);
    y = r*sin(a);
    x = r*cos(a);
    fill(0);
    line(0, 0, x, y);
    ellipse(x, y, 50, 50);

    a+= 0.1;
    float n = noise(t);
    r = map(n, 0, 1, 0, 200);
    t+= 0.01;
    }

  5. Handsome Bobby Avatar

    You are awesome!!!! And btw your constant reminder of perlin noise made me master it rapidly 😀
    Thanks for everything!!!

  6. SC5 Music Avatar

    I'm not somebody who has been very good at math in the past, but I've learned more about math in this video than in my entire four years of high school. You have a way of explaining things that is easy to follow and just makes a lot of sense to the point where I'm actually interested in a subject that used to intimidate me. Nice job!

  7. serhan Avatar

    Great tutorial

  8. Atrixium Avatar

    You are succeeding where my high school math teachers failed, I'm actually beginning to understand trigonometry and its real world applications, this is awesome!

Leave a Reply

Your email address will not be published. Required fields are marked *