// Spherical spiral script! // Joe Chidzik, joe.chidzik@gmail.com global proc sphereSpiral() { int $radius = 3; // The sphere radius int $resolution = 8; // How many points per revolution int $revolutions = 8; // How many revolutions float $theta = 0; float $phi = 0; $pointCount = $resolution * $revolutions; float $pointAngle = (360 / $resolution); // How many degrees between each point $pointAngle = deg_to_rad($pointAngle); // Convert to rads! $azimuthAngle = (3.1415 / $pointCount); $pointCount = $resolution * $revolutions; float $x = $radius * (sin($theta) * cos($phi)); float $z = $radius * (sin($theta) * sin($phi)); float $y = $radius * (cos($theta)); string $cmd = ("curve -d 5 -p " + $x + " " + $y + " " + $z); // Setup our initial curve command string for ( $i = 0; $i < $pointCount; $i++) { $phi = ($phi + $pointAngle); $theta = $theta + $azimuthAngle; $x = $radius * (sin($theta) * cos($phi)); $z = $radius * (sin($theta) * sin($phi)); $y = $radius * (cos($theta)); $cmd = ($cmd + " -p " + $x + " " + $y + " " + $z); } eval($cmd); } sphereSpiral();