// Netball Object // Create by Chris Bartlett 07.02.2005 // Permission is granted for all forms of reuse // Usage notes // ----------- // When working on the seams of the ball it's easiest to just render one or two segment // (for speed and clarity). // // If a cut doesn't appear where you expect it to, rendering the cutting tool in a bright // colour may help you to see where the mistake is. // // When adding stitches it helps to brightly colour the stitches that you're working on. // To make them even clearer you can change the sphere definition of the stitch to be // centred at <0,BallRadius,0> instead of <0,BallRadius-CutRadius,0> so that they project // a little above the surface of the ball. camera {location<1.2,1.1,-2.3> look_at<0,0,0>} light_source{<30,30,-20> color rgb 1} light_source{<10,30,-200> color rgb 1} #declare BallRadius = 1; #local CutRadius = 0.02; // Radius of curvature of the seams // Create a cutting tool that is a flat surface with a torus cut out of it. // The outermost extent of the torus is the same radius as the ball. // You may like to render just the cutting tool if you're having a problem imagining it. #declare Cuttingedge = difference { box {<-BallRadius*1.1,-BallRadius*1.1,0>,BallRadius*1.1} torus {1-CutRadius,CutRadius rotate x*90} translate -z*CutRadius } // For 'special' cuts we don't want to cut all the way through so create half a cutting // tool as well. #declare HalfCut = intersection { object {Cuttingedge} box {1.1*<-BallRadius,-BallRadius,0>,<0,BallRadius,BallRadius>*1.1 translate -z*CutRadius} } // Create a selection of lines of stitches to use on different seams. // This example uses an arc of small stretched spheres to imitate the distortion of the // leather where the stitches pass through. #declare LongStitchLine = union { #local StitchAngle = -53; #while (StitchAngle <= 53) sphere {<0,BallRadius-CutRadius,0>,CutRadius scale <0.5,1,1.5> rotate z*StitchAngle} #local StitchAngle = StitchAngle + 2; #end translate -z*CutRadius } #declare MediumStitchLine = union { #local StitchAngle = -10; #while (StitchAngle <= 10) sphere {<0,BallRadius-CutRadius,0>,CutRadius scale <0.5,1,1.5> rotate z*StitchAngle} #local StitchAngle = StitchAngle + 2; #end translate -z*CutRadius } #declare ShortStitchLine = union { #local StitchAngle = 84; #while (StitchAngle <= 96) sphere {<0,BallRadius-CutRadius,0>,CutRadius scale <0.5,1,1.5> rotate z*StitchAngle} #local StitchAngle = StitchAngle + 2; #end translate -z*CutRadius } // The central strip is cut out of a sphere with lines of stitches added to each edge. // The important thing when cutting is that the center of the sphere and the centre of the // cutting tool are coincident. Here both stay at the origin which is by far the easiest // place for the centres to be. // The rotations for the stitches are the same as for the cutting tool except that the // stitches sometimes need rotating around the z axis. This is because the stitches only // form an arc, whereas the cutting tool forms a complete circle. #declare StraightSegment = union { difference { sphere {0,BallRadius} object{Cuttingedge rotate -x*80} object{Cuttingedge rotate x*80} object{Cuttingedge rotate -y*35} object{Cuttingedge rotate y*35} } object{LongStitchLine rotate -x*80} object{LongStitchLine rotate z*180 rotate x*80} object{ShortStitchLine rotate -y*35} object{ShortStitchLine rotate z*180 rotate y*35} } // We will need a nearly triangular piece (one corner trimmed off) to patch into the corners. #declare TriangleSegment = union { difference { sphere {0,BallRadius} object{Cuttingedge rotate -y*30 rotate -x*69} object{Cuttingedge rotate y*90 rotate z*30 rotate -y*69} object{Cuttingedge rotate x*110} object{Cuttingedge rotate y*90 rotate -z*20 rotate -y*53} } object{MediumStitchLine rotate -z*30 rotate -y*30 rotate -x*69} object{MediumStitchLine rotate -z*59 rotate y*90 rotate z*30 rotate -y*69} } // The segment that lies either side of the central strip is quite a tricky shape. // We need to slice odd bits out of a strip then patch in the triangular corner piece. // The stitches just follow the seams. #declare OffsetSegment = union { difference { sphere {0,BallRadius} object{Cuttingedge rotate -x*55} object{Cuttingedge rotate x*100} object{Cuttingedge rotate y*90 rotate -z*20 rotate -y*53} object{Cuttingedge rotate -y*90 rotate z*20 rotate y*53} object{Cuttingedge rotate y*90 rotate z*30 rotate -y*69} object{Cuttingedge rotate -y*90 rotate -z*30 rotate y*69} object{HalfCut rotate -z*35 rotate y*20 rotate -x*53} object{HalfCut rotate z*215 rotate -y*20 rotate -x*53} } object{ShortStitchLine rotate -z*90 rotate -x*55} object{LongStitchLine rotate z*180 rotate x*100} object{ShortStitchLine rotate -z*103 rotate y*20 rotate -x*53} object{ShortStitchLine rotate -z*77 rotate -y*20 rotate -x*53} object{ShortStitchLine rotate -z*168 rotate y*90 rotate -z*20 rotate -y*53} object{ShortStitchLine rotate -z*22 rotate -y*90 rotate z*20 rotate y*53} object {TriangleSegment} object {TriangleSegment scale <-1,1,1>} } // Assemble three strips to form one sixth of the balls surface #declare SetOfSegments = union { object {OffsetSegment} object {StraightSegment} object {OffsetSegment rotate z*180} } // The whole ball uses six sets of the three strips (appropriately rotated) #declare Netball = union { object {SetOfSegments} object {SetOfSegments rotate <90,90,0>} object {SetOfSegments rotate <90,0,90>} object {SetOfSegments rotate x*180} object {SetOfSegments rotate <270,90,0>} object {SetOfSegments rotate <90,0,270>} } // Draw an example of the ball object {Netball pigment {color rgb <1,1,1>}}