function [torus_points] = torus %This function creates a torus. %Created by Jim Work, University of South Carolina, August 13th, 2003 circle = []; for i = 0:(pi/8):2*pi x = cos(i); y = sin(i); circle = [circle; x y]; end circle = circle + 5; tor = []; for i = 1:16 for k = 1:16 j = (pi/8)*k x = cos(j)*(circle(i,1)); y = circle(k,2); z = sin(j)*(circle(i,1)); tor = [tor; x y z]; end end tor = addindex(tor); jimplot3(tor); torus_points = tor;