/*
Copyright (c) 2006 by Thomas J. Greenbaum. Some Rights Reserved.
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.
http://creativecommons.org/licenses/by-nc-sa/3.0/
Persistence Of Vision raytracer version 3.6
Spheriphor Spiral Generator, version 05 - January 5, 2007
For creation of a spherical spiral, that is a spiral partition of a spherical volume
based on conical surfaces created from a sequence of progressively smaller cones
all sharing the same apex situated at the sphere's center.
Command line options to redirect file output
Test resolution setting:
+FS24, +Lc:\Spheriphor\, +OSpheriphor001 Width=320, Height=240, +A
High resolution setting:
+FS24, +Lc:\Spheriphor\, +OSpheriphor001 Width=3072, Height=2304, +A
NOTES: +FS24 = System File (Windows BMP) 24bit color depth
*/
#include "stdinc.inc"
#include "math.inc"
// Increase max_trace_level to calculate multiple layers of transparent objects
global_settings { max_trace_level 20 }
/*
// Transparent colors - takes a long time to render with trans_no set close to 1.0
#declare trans_no = 0.7 ;
#declare Color01 = color rgbf <0.196078, 0.600000, 0.800000, trans_no> ;
#declare Color02 = color rgbf <0.950000, 0.950000, 0.050000, trans_no> ;
#declare Color03 = color rgbf <0.000000, 1.000000, 0.498039, trans_no> ;
#declare Color04 = color rgbf <1.000000, 0.000000, 0.000000, trans_no> ;
#declare Color05 = color rgbf <0.137255, 0.137255, 0.556863, trans_no> ;
*/
// Solid color for quick render
#declare Color01 = color rgb <0.196078, 0.600000, 0.800000> ;
#declare Color02 = color rgb <0.950000, 0.950000, 0.050000> ;
#declare Color03 = color rgb <0.000000, 1.000000, 0.498039> ;
#declare Color04 = color rgb <1.000000, 0.000000, 0.000000> ;
#declare Color05 = color rgb <0.137255, 0.137255, 0.556863> ;
#declare Cone_finish =
finish {
ambient 0.500
diffuse 0.400
specular 1.000
roughness 0.001
reflection {.3}
}
// *** Define the Parameters
#declare Cone_AngDe = 5 ; // Delta between consecutive cone angles
#declare Cone_AngTh = 1 ; // Angular thickness between outer and inner cone walls
#declare Cone_Ht01 = 100 ; // Initial height of cone from base to cap
#declare Cone_Ang01 = 45.5 ; // Initial cone angle (at apex)
#declare Pt_Center = <0,0,0> ; // Point - Center of sphere and apex (base point) of cones
#declare Pt_Cap01 = <0,Cone_Ht01,0> ; // Point - Cap point of cone 01
#declare Cap_Rad01 = tand(Cone_Ang01)*Cone_Ht01 ; // Radius of initial cone cap
#declare Sphr_Rado = Cap_Rad01/sind(Cone_Ang01) ; // Radius of outer sphere
#declare Sphr_Radi = Sphr_Rado*.9 ; // Radius of inner sphere (difference object)
// *** Outer cone dimensions
#declare Cone_Ang02 = Cone_Ang01-Cone_AngDe*1 ; // Cone angle 02
#declare Cone_Ang03 = Cone_Ang01-Cone_AngDe*2 ; // Cone angle 03
#declare Cone_Ang04 = Cone_Ang01-Cone_AngDe*3 ; // Cone angle 04
#declare Cone_Ang05 = Cone_Ang01-Cone_AngDe*4 ; // Cone angle 05
#declare Cone_Ang06 = Cone_Ang01-Cone_AngDe*5 ; // Cone angle 06
#declare Cone_Ang07 = Cone_Ang01-Cone_AngDe*6 ; // Cone angle 07
#declare Cone_Ang08 = Cone_Ang01-Cone_AngDe*7 ; // Cone angle 08
#declare Cone_Ang09 = Cone_Ang01-Cone_AngDe*8 ; // Cone angle 09
#declare Cone_Ht02 = cosd(Cone_Ang02)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 02 from base to cap
#declare Cap_Rad02 = tand(Cone_Ang02)*Cone_Ht02 ; // Radius of cone 02 cap
#declare Pt_Cap02 = <0,Cone_Ht02,0> ; // Point - Cap point of cone 02
#declare Cone_Ht03 = cosd(Cone_Ang03)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 03 from base to cap
#declare Cap_Rad03 = tand(Cone_Ang03)*Cone_Ht03 ; // Radius of cone 03 cap
#declare Pt_Cap03 = <0,Cone_Ht03,0> ; // Point - Cap point of cone 03
#declare Cone_Ht04 = cosd(Cone_Ang04)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 04 from base to cap
#declare Cap_Rad04 = tand(Cone_Ang04)*Cone_Ht04 ; // Radius of cone 04 cap
#declare Pt_Cap04 = <0,Cone_Ht04,0> ; // Point - Cap point of cone 04
#declare Cone_Ht05 = cosd(Cone_Ang05)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 05 from base to cap
#declare Cap_Rad05 = tand(Cone_Ang05)*Cone_Ht05 ; // Radius of cone 05 cap
#declare Pt_Cap05 = <0,Cone_Ht05,0> ; // Point - Cap point of cone 05
#declare Cone_Ht06 = cosd(Cone_Ang06)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 06 from base to cap
#declare Cap_Rad06 = tand(Cone_Ang06)*Cone_Ht06 ; // Radius of cone 06 cap
#declare Pt_Cap06 = <0,Cone_Ht06,0> ; // Point - Cap point of cone 06
#declare Cone_Ht07 = cosd(Cone_Ang07)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 07 from base to cap
#declare Cap_Rad07 = tand(Cone_Ang07)*Cone_Ht07 ; // Radius of cone 07 cap
#declare Pt_Cap07 = <0,Cone_Ht07,0> ; // Point - Cap point of cone 07
#declare Cone_Ht08 = cosd(Cone_Ang08)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 08 from base to cap
#declare Cap_Rad08 = tand(Cone_Ang08)*Cone_Ht08 ; // Radius of cone 08 cap
#declare Pt_Cap08 = <0,Cone_Ht08,0> ; // Point - Cap point of cone 08
#declare Cone_Ht09 = cosd(Cone_Ang09)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 09 from base to cap
#declare Cap_Rad09 = tand(Cone_Ang09)*Cone_Ht09 ; // Radius of cone 09 cap
#declare Pt_Cap09 = <0,Cone_Ht09,0> ; // Point - Cap point of cone 09
// *** Inner cones dimensions (difference objects)
#declare Cone_Ang01i = Cone_Ang01-Cone_AngTh ; // Inner Cone angle 01
#declare Cone_Ang02i = Cone_Ang02-Cone_AngTh ; // Inner Cone angle 02
#declare Cone_Ang03i = Cone_Ang03-Cone_AngTh ; // Inner Cone angle 03
#declare Cone_Ang04i = Cone_Ang04-Cone_AngTh ; // Inner Cone angle 04
#declare Cone_Ang05i = Cone_Ang05-Cone_AngTh ; // Inner Cone angle 05
#declare Cone_Ang06i = Cone_Ang06-Cone_AngTh ; // Inner Cone angle 06
#declare Cone_Ang07i = Cone_Ang07-Cone_AngTh ; // Inner Cone angle 07
#declare Cone_Ang08i = Cone_Ang08-Cone_AngTh ; // Inner Cone angle 08
#declare Cone_Ang09i = Cone_Ang09-Cone_AngTh ; // Inner Cone angle 09
#declare Cone_Ht01i = cosd(Cone_Ang01i)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 02 from base to cap
#declare Cap_Rad01i = tand(Cone_Ang01i)*Cone_Ht01i ; // Radius of cone 02 cap
#declare Pt_Cap01i = <0,Cone_Ht01i,0> ; // Point - Cap point of cone 02
#declare Cone_Ht02i = cosd(Cone_Ang02i)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 02 from base to cap
#declare Cap_Rad02i = tand(Cone_Ang02i)*Cone_Ht02i ; // Radius of cone 02 cap
#declare Pt_Cap02i = <0,Cone_Ht02i,0> ; // Point - Cap point of cone 02
#declare Cone_Ht03i = cosd(Cone_Ang03i)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 03 from base to cap
#declare Cap_Rad03i = tand(Cone_Ang03i)*Cone_Ht03i ; // Radius of cone 03 cap
#declare Pt_Cap03i = <0,Cone_Ht03i,0> ; // Point - Cap point of cone 03
#declare Cone_Ht04i = cosd(Cone_Ang04i)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 04 from base to cap
#declare Cap_Rad04i = tand(Cone_Ang04i)*Cone_Ht04i ; // Radius of cone 04 cap
#declare Pt_Cap04i = <0,Cone_Ht04i,0> ; // Point - Cap point of cone 04
#declare Cone_Ht05i = cosd(Cone_Ang05i)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 05 from base to cap
#declare Cap_Rad05i = tand(Cone_Ang05i)*Cone_Ht05i ; // Radius of cone 05 cap
#declare Pt_Cap05i = <0,Cone_Ht05i,0> ; // Point - Cap point of cone 05
#declare Cone_Ht06i = cosd(Cone_Ang06i)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 06 from base to cap
#declare Cap_Rad06i = tand(Cone_Ang06i)*Cone_Ht06i ; // Radius of cone 06 cap
#declare Pt_Cap06i = <0,Cone_Ht06i,0> ; // Point - Cap point of cone 06
#declare Cone_Ht07i = cosd(Cone_Ang07i)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 07 from base to cap
#declare Cap_Rad07i = tand(Cone_Ang07i)*Cone_Ht07i ; // Radius of cone 07 cap
#declare Pt_Cap07i = <0,Cone_Ht07i,0> ; // Point - Cap point of cone 07
#declare Cone_Ht08i = cosd(Cone_Ang08i)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 08 from base to cap
#declare Cap_Rad08i = tand(Cone_Ang08i)*Cone_Ht08i ; // Radius of cone 08 cap
#declare Pt_Cap08i = <0,Cone_Ht08i,0> ; // Point - Cap point of cone 08
#declare Cone_Ht09i = cosd(Cone_Ang09i)*Cap_Rad01/sind(Cone_Ang01) ; // Height of cone 09 from base to cap
#declare Cap_Rad09i = tand(Cone_Ang09i)*Cone_Ht09i ; // Radius of cone 09 cap
#declare Pt_Cap09i = <0,Cone_Ht09i,0> ; // Point - Cap point of cone 09
// *** Difference objects
#declare Diff_Base =
box {<-200,-200,0>,<200,200,200>
no_shadow
}
#declare Diff_45 =
union {
object { Diff_Base
}
object { Diff_Base
rotate <0,135,0>
}
}
// *** Cone objects // Inner-most spiral with smallest radius
#declare Cone_09 =
difference {
difference {
cone {Pt_Center,0,Pt_Cap09,Cap_Rad09 }
object { Diff_45 }
}
cone {Pt_Center,0,Pt_Cap09i,Cap_Rad09i }
}
#declare Cone_08 = // Next larger spiral
union {
difference {
difference {
cone {Pt_Center,0,Pt_Cap08,Cap_Rad08 }
object { Diff_45 }
}
cone {Pt_Center,0,Pt_Cap08i,Cap_Rad08i }
}
object { Cone_09 // Includes inner spiral
rotate <0,45,0>
rotate <0,0,Cone_AngDe>
}
}
#declare Cone_07 =
union {
difference {
difference {
cone {Pt_Center,0,Pt_Cap07,Cap_Rad07 }
object { Diff_45 }
}
cone {Pt_Center,0,Pt_Cap07i,Cap_Rad07i }
}
object { Cone_08
rotate <0,45,0>
rotate <0,0,Cone_AngDe>
}
}
#declare Cone_06 =
union {
difference {
difference {
cone {Pt_Center,0,Pt_Cap06,Cap_Rad06 }
object { Diff_45 }
}
cone {Pt_Center,0,Pt_Cap06i,Cap_Rad06i }
}
object { Cone_07
rotate <0,45,0>
rotate <0,0,Cone_AngDe>
}
}
#declare Cone_05 =
union {
difference {
difference {
cone {Pt_Center,0,Pt_Cap05,Cap_Rad05 }
object { Diff_45 }
}
cone {Pt_Center,0,Pt_Cap05i,Cap_Rad05i }
}
object { Cone_06
rotate <0,45,0>
rotate <0,0,Cone_AngDe>
}
}
#declare Cone_04 =
union {
difference {
difference {
cone {Pt_Center,0,Pt_Cap04,Cap_Rad04 }
object { Diff_45 }
}
cone {Pt_Center,0,Pt_Cap04i,Cap_Rad04i }
}
object { Cone_05
rotate <0,45,0>
rotate <0,0,Cone_AngDe>
}
}
#declare Cone_03 =
union {
difference {
difference {
cone {Pt_Center,0,Pt_Cap03,Cap_Rad03 }
object { Diff_45 }
}
cone {Pt_Center,0,Pt_Cap03i,Cap_Rad03i }
}
object { Cone_04
rotate <0,45,0>
rotate <0,0,Cone_AngDe>
}
}
#declare Cone_02 =
union {
difference {
difference {
cone {Pt_Center,0,Pt_Cap02,Cap_Rad02 }
object { Diff_45 }
}
cone {Pt_Center,0,Pt_Cap02i,Cap_Rad02i }
}
object { Cone_03
rotate <0,45,0>
rotate <0,0,Cone_AngDe>
}
}
#declare Spiral =
union {
difference {
difference {
cone {Pt_Center,0,Pt_Cap01,Cap_Rad01 }
object { Diff_45 }
}
cone {Pt_Center,0,Pt_Cap01i,Cap_Rad01i }
}
object { Cone_02
rotate <0,45,0>
rotate <0,0,Cone_AngDe>
}
}
// Two spirals joined at the outer cone edges to create a double ended spiral
#declare Two_Spirals =
union {
object { Spiral
rotate <0,45,0> // Rotate 45 degrees about y-axis to align outer cone edge to x-axis
}
object { Spiral
rotate <0,225,0> // Rotate 225 degrees (45+180) about y-axis
rotate <0,0,90> // Rotate 90 degrees about z-axis to align two spiral edges
}
}
// Give the Two Spirals color and finish
#declare Two_Spirals_Red =
object { Two_Spirals
pigment { Color04 }
finish { Cone_finish }
}
#declare Two_Spirals_Blu =
object { Two_Spirals
pigment { Color01 }
finish { Cone_finish }
}
#declare Two_Spirals_Yel =
object { Two_Spirals
pigment { Color02 }
finish { Cone_finish }
}
#declare Two_Spirals_Gre =
object { Two_Spirals
pigment { Color03 }
finish { Cone_finish }
}
// Three double spirals - Red
#declare Spheri_Spiral_Red =
difference {
union {
object { Two_Spirals_Red
}
object { Two_Spirals_Red
rotate <90,0,0>
rotate <0,180,0>
}
object { Two_Spirals_Red
rotate <0,0,90>
rotate <0,90,0>
}
}
difference {
sphere { Pt_Center,Sphr_Rado
pigment { Color04 } // Outer sphere
finish { Cone_finish }
}
sphere { Pt_Center,Sphr_Radi // Inner sphere (difference object)
pigment { Color04 }
finish { Cone_finish }
}
}
}
// Three double spirals - Blue
#declare Spheri_Spiral_Blu =
difference {
union {
object { Two_Spirals_Blu
rotate <0,90,0>
}
object { Two_Spirals_Blu
rotate <-90,0,0>
}
object { Two_Spirals_Blu
rotate <0,0,180>
}
}
difference {
sphere { Pt_Center,Sphr_Rado
pigment { Color01 } // Outer sphere
finish { Cone_finish }
}
sphere { Pt_Center,Sphr_Radi // Inner sphere (difference object)
pigment { Color01 }
finish { Cone_finish }
}
}
}
// Three double spirals - Yellow
#declare Spheri_Spiral_Yel =
difference {
union {
object { Two_Spirals_Yel
rotate <0,180,0>
}
object { Two_Spirals_Yel
rotate <90,0,0>
}
object { Two_Spirals_Yel
rotate <0,0,90>
rotate <0,270,0>
}
}
difference {
sphere { Pt_Center,Sphr_Rado
pigment { Color02 } // Outer sphere
finish { Cone_finish }
}
sphere { Pt_Center,Sphr_Radi // Inner sphere (difference object)
pigment { Color02 }
finish { Cone_finish }
}
}
}
// Three double spirals - Green
#declare Spheri_Spiral_Gre =
difference {
union {
object { Two_Spirals_Gre
rotate <0,270,0>
}
object { Two_Spirals_Gre
rotate <90,0,0>
rotate <0,90,0>
}
object { Two_Spirals_Gre
rotate <0,0,90>
}
}
difference {
sphere { Pt_Center,Sphr_Rado
pigment { Color03 } // Outer sphere
finish { Cone_finish }
}
sphere { Pt_Center,Sphr_Radi // Inner sphere (difference object)
pigment { Color03 }
finish { Cone_finish }
}
}
}
#declare Spheri_Spiral =
union {
object { Spheri_Spiral_Red }
object { Spheri_Spiral_Blu }
object { Spheri_Spiral_Yel }
object { Spheri_Spiral_Gre }
}
object { Spheri_Spiral
//rotate <0,45,0>
//rotate <45,0,0>
}
/* Show the difference object - test only
object { Diff_45
pigment { Color01 }
finish { Cone_finish }
}
*/
// B A C K G R O U N D
background { color White }
// L I G H T S
#declare L_dst1 = 160 ;
#declare L_dst2 = 200 ;
#declare L_clr1 = Gray60 ;
#declare L_clr2 = Gray30 ;
#declare F_dst = L_dst1*.75 ;
// Four lights opposite top cubic corners
light_source {
color L_clr1
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
light_source { <-L_dst1,L_dst1,L_dst1>
color L_clr1
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
light_source {
color L_clr1
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
light_source { <-L_dst1,L_dst1,-L_dst1>
color L_clr1
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
// Four lights opposite bottom corners
light_source {
color L_clr1
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
light_source { <-L_dst1,-L_dst1,L_dst1>
color L_clr1
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
light_source {
color L_clr1
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
light_source { <-L_dst1,-L_dst1,-L_dst1>
color L_clr1
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
// Six lights opposite cubic faces
light_source { <0,L_dst2,0> // +y axis
color L_clr2
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
light_source { <0,-L_dst2,0> // -y axis
color L_clr2
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
light_source { // +x axis
color L_clr2
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
light_source { <-L_dst2,0,0> // -x axis
color L_clr2
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
light_source { <0,0,L_dst2> // +z axis
color L_clr2
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
light_source { <0,0,-L_dst2> // -z axis
color L_clr2
spotlight
radius 35 falloff 40
fade_distance F_dst
point_at <0,0,0>
}
// C A M E R A S
#declare Cam01 =
camera {
orthographic
location <0,190,10>
look_at <0,0,10>
angle 70
}
#declare Cam02 =
camera {
location <180,180,180>
look_at <0,0,0>
right 1.33*x
angle 70
}
#declare Cam03 =
camera {
location <0,300,0>
look_at <0,0,0>
right 1.33*x
angle 70
}
camera { Cam02 }
|