polar tri
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void setup() { | |
| size(600, 600); | |
| fill(0); | |
| noStroke(); | |
| } | |
| void polarVertex(float dist, float ang) { | |
| vertex(100*exp(dist)*cos(ang), 100*exp(dist)*sin(ang)); | |
| } | |
| void polarLine(float dist1, float ang1, float dist2, float ang2) { | |
| for (int i=0; i<10; i++) | |
| polarVertex(map(i, 0, 10, dist1, dist2), map(i, 0, 10, ang1, ang2)); | |
| } | |
| void draw() { | |
| background(250); | |
| pushMatrix(); | |
| translate(width/2, height/2); | |
| for (int i=0; i<10; i++) { | |
| pushMatrix(); | |
| rotate(TWO_PI*i/10); | |
| beginShape(); | |
| polarLine(0, 0, -.4, PI/10); | |
| polarLine(-.4, PI/10, -.4, -PI/10); | |
| polarLine(-.4, -PI/10, 0, 0); | |
| endShape(); | |
| popMatrix(); | |
| } | |
| popMatrix(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment