/* A Diamond shaped object generator for use with PovRay 3.1 Usage is as follows (after including the file at the start of your scene): Diamond ([Number of Sides], [Radius of top face], [Height of top section], [Radius of centre section], [Depth of bottom section]) eg, to create a nicely faceted diamond: object {Diamond (16, 4, 1, 5, 4) texture {Diamond_Texture} translate y * 4 rotate <30, 55, 0>} or, to create multiple diamonds: #declare MyDiamond = object {Diamond (.... */ // --- Dimaond.mcr --------------------------------------- // // DIAMOND GENERATOR FOR PERSISTENCE OF VISION 3.1 // // Originally authored by: Ken Koehler // Modified by Jeroen van den Bos, April 1993 // Modified by Ken Tyler, Nov 25 1997, July 14 1998 // Modified by Chris Colefax, 18 July 1998: converted to POV-Ray 3.1 macro #macro Diamond (NumSides, TopRadius, TopHeight, CentreRadius, BottomDepth) mesh { #local ARK = pi / NumSides; #local BottomTip = <0, -BottomDepth, 0>; #local TopCentre = <0, TopHeight, 0>; #local LongSide = true; #local CurrentPoint = ; #local P1 = CurrentPoint * CentreRadius; #local P2 = CurrentPoint * TopRadius + (y * TopHeight); #local C = -1.5 * ARK; #while (C < ((2 * pi) + (-2.5 * ARK))) #if (LongSide = true) #local CurrentPoint = ; #else #local CurrentPoint = ; #end #local P3 = CurrentPoint * CentreRadius; #local P4 = CurrentPoint * TopRadius + (y * TopHeight); triangle {P1, P3, BottomTip} triangle {P1, P3, P4} triangle {P1, P4, P2} triangle {TopCentre, P4, P2} #local P1 = P3; #local P2 = P4; #local LongSide = (LongSide = true ? false : true); #local C = C + (ARK * 2); #end } #end // --- End File ---------------------------------------