December 2010
3 posts
1 tag
Ulam Spiral in Processing
/* So I found the YouTube Channel of ViHart. She's got these quirky, awesome math videos involving lots of doodles. Her most recent video is on the Ulam Spiral, so I thought I would try to recreate it in processing. Enjoy. Here's the video of her drawing. http://www.youtube.com/watch?v=Yhlv5Aeuo_k */ void setup() { size(400, 400); background(255); } void draw() { int cy = height...
Dec 17th
1 note
1 tag
Reading OBJ files in MATLAB
% Not the most exciting code that I've written recently. % Can you tell that it's finals week and I'm a little busy? % readobj % Reads the obj file format. function [v, vt, vn, f] = readobj(filename) fid = fopen(filename, 'r'); vcount = 0; vtcount = 0; vncount = 0; fcount = 0; v = []; vt = []; vn = []; f = []; % Iterate through each line of the OBJ file. while ~feof(fid) line =...
Dec 9th
1 note
1 tag
Simple Animations in Python
from graphics import * import time """ In the CS 141 class that I teach at Rhodes College we use a simple graphics library written by Dr. John Zelle to demonstrate basic object oriented programming topics. My assignment to the class was to use the graphics library to tell a simple story. This program tells the story of a frog sitting on a lily pad made of gold coins (I'm not sure why I put in...
Dec 3rd
3 notes