Created
August 28, 2014 21:28
-
-
Save josePhoenix/c7b311562dde8b3ea238 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| size(400,400); | |
| int off_x = 200; | |
| int off_y = 200; | |
| int r = 30; | |
| PVector radius, nextradius, center_to_center, center; | |
| center = new PVector(0, 0); | |
| radius = new PVector(r, 0); | |
| nextradius = new PVector(r, 0); | |
| nextradius.rotate(TWO_PI /6.0); | |
| center_to_center = new PVector(1,0); | |
| center_to_center.setMag(2 * (float)Math.sqrt(3) / 2.0); | |
| center_to_center.mult(r); | |
| center_to_center.rotate(PI / 6.0); | |
| for (float theta = 0; theta < TWO_PI; theta += TWO_PI / 6.0) { | |
| line(radius.x + off_x, radius.y + off_y, nextradius.x + off_x, nextradius.y + off_y); | |
| radius.rotate(TWO_PI / 6.0); | |
| nextradius.rotate(TWO_PI / 6.0); | |
| } | |
| for (int i = 0; i < 6; i++) { | |
| radius = new PVector(r, 0); | |
| nextradius = new PVector(r, 0); | |
| nextradius.rotate(TWO_PI /6.0); | |
| for (float theta = 0; theta < TWO_PI; theta += TWO_PI / 6.0) { | |
| line( | |
| center_to_center.x + radius.x + off_x, | |
| center_to_center.y + radius.y + off_y, | |
| center_to_center.x + nextradius.x + off_x, | |
| center_to_center.y + nextradius.y + off_y | |
| ); | |
| radius.rotate(TWO_PI / 6.0); | |
| nextradius.rotate(TWO_PI / 6.0); | |
| } | |
| center_to_center.rotate(PI / 3.0); | |
| } | |
| line(0 + off_x, 0 + off_y, center_to_center.x + off_x, center_to_center.y + off_y); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment