/* Common stuff for baseball seam demos. The demo file bbseam.pov does not make use of this. It is self-contained and kept simple for educational purposes. Fancier demos use the ComputeBBallSeam macro. (C) 2006 Daren Scot Wilson, Boulder Colorado This script is intended for educational purposes, and may be copied, modified and distributed for classroom and noncommercial use. Contact: Daren Scot Wilson, GreenSquiggle@comcast.net www.darenscotwilson.com */ // trig funcs using degrees #macro sind(a) sin(6.28315*a/360.) #end #macro cosd(a) cos(6.28315*a/360.) #end // ComputeBBallSeam macro // // Creates variables with the position and orientation triad // for points along a baseball seam curve // args: // aa: angle (alpha) in degrees. vary from 0 to 360 // R: radius. // Seam is on a sphere of radius R at the origin, with Z as the // axis of symmetry. // Use this macro to build your fancy seam with stitches/flower pots/buffalo // or whatever placed along it, on an object based at the origin, // typically a CSG union, and then rotate and translate the whole // mess to where desired. #macro ComputeBBallSeam(aa, ball_radius) #local c1 = cosd(aa); #local s1 = sind(aa); #local c3 = cosd(3*aa); #local s3 = sind(3*aa); #local xx = (9/13)*c1-(4/13)*c3; #local yy = (9/13)*s1+(4/13)*s3; #local zz = (12/13)*cosd(2*aa); #declare pSeam = ball_radius*; #declare vSeam = vnormalize( <-s1+(4/3)*s3, c1+(4/3)*c3, -(8/3)*sind(2*aa) > ); #declare nSeam = vnormalize(); #declare wSeam = vcross(vSeam, nSeam); #end