Draw some cool stuff!

1 reply [Last post]
deepblue's picture
Joined: 01/06/2011

I wanted to jump into the cool stuff so I found some interesting classes to use to draw stuff and other cool classes that draw really interesting math stuff.
1 - You need the draw library: http://algs4.cs.princeton.edu/stdlib/StdDraw.java.html
2 - You need the turtle class: http://introcs.cs.princeton.edu/32class/Turtle.java.html
3 - Create cool stuff!
Try N-gon: http://introcs.cs.princeton.edu/32class/Ngon.java.html 
Try Koch curve: http://introcs.cs.princeton.edu/32class/Koch.java.html
Try logarithmic spiral: http://introcs.cs.princeton.edu/32class/Spiral.java.html
In all classes, replace Integer.parseInt(args[0]) and/or Double.parseDouble(args[1]) with real values. Don't put values bigger than 6 in Koch, you can't see it.
Fool around with it and learn the code! Hopefully we can integrate the turtle and draw class into what we're doing.
Also note that http://introcs.cs.princeton.edu/home/ is a great resource for programming. Thanks for this, Princeton!
Poked around for a bit and in the RSA cryptosystem exercise I found this:
"Legal notice. It is a violation of US law to export your solution for this assignment to foreign governments or embargoed destinations (Cuba, Iran, Iraq, Libya, North Korea, Serbia, Sudan, Syria, and Taliban-controlled areas of Afghanistan as of January 2000). It is also illegal to import your solution into several countries, including France, Iran, Iraq, and Russia."
Made me lol.

Joined: 12/13/2010
Very cool.  I like the n-body

Very cool.  I like the n-body simulation assignment introcs.cs.princeton.edu/assignments/nbody.html.  We should be able to implement a 3D version of this