|
| 1 | +// PoVRay 3.7.1 Scene File "torus2.pov" |
| 2 | +// author: Christoph Lipka |
| 3 | +// date: 2016-05-05 |
| 4 | +// |
| 5 | +// Demonstrates the use and effect of the torus spindle modes for |
| 6 | +// self-intersecting torus primitives, as introduced with POV-Ray 3.7.1 |
| 7 | +// |
| 8 | +// +w200 +h200 +kfi1 +kff4 +ua |
| 9 | +//------------------------------------------------------------------------ |
| 10 | + |
| 11 | +#version 3.71; |
| 12 | +global_settings{ assumed_gamma 1.0 } |
| 13 | + |
| 14 | +camera { |
| 15 | + angle 15 |
| 16 | + right x*image_width/image_height |
| 17 | + location <9,3,-9> |
| 18 | + look_at <0,0,0> |
| 19 | +} |
| 20 | + |
| 21 | +light_source { <0,500,-1000> colour rgb 1 } |
| 22 | +background{ colour rgbt 1 } |
| 23 | + |
| 24 | +default { |
| 25 | + finish { ambient 0.1 diffuse albedo 1.0 specular albedo 0.0 } |
| 26 | +} |
| 27 | + |
| 28 | +#declare HintTexture = texture { pigment { colour rgb 0.8 transmit 0.8 } } |
| 29 | +#declare OutsideTexture = texture { pigment { colour green 1 } } |
| 30 | +#declare InsideTexture = texture { pigment { colour red 1 } } |
| 31 | +#declare IntersectTexture = texture { pigment { colour blue 1 } } |
| 32 | + |
| 33 | +#declare SpindleMode = frame_number; |
| 34 | + |
| 35 | +// barely visible reference shape |
| 36 | +torus { |
| 37 | + 0.5,1 |
| 38 | + texture { HintTexture } |
| 39 | + no_shadow |
| 40 | + clipped_by { |
| 41 | + #if (SpindleMode = 2) |
| 42 | + box { <-0.5,-sin(pi/3),0>, <0.5,sin(pi/3),0.5> inverse } |
| 43 | + #elseif (SpindleMode = 3) |
| 44 | + union{ |
| 45 | + box { <-2,-2,-2>, <2,2,0> } |
| 46 | + box { <-0.5,-sin(pi/3),-0.5>, <0.5,sin(pi/3),0.5> } |
| 47 | + } |
| 48 | + #else |
| 49 | + box { <-2,-2,-2>, <2,2,0> } |
| 50 | + #end |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +#declare TheTorus = torus { |
| 55 | + 0.5,1 |
| 56 | + #switch (SpindleMode) |
| 57 | + #case (1) difference #break |
| 58 | + #case (2) intersection #break |
| 59 | + #case (3) merge #break |
| 60 | + #case (4) union #break |
| 61 | + #end |
| 62 | +} |
| 63 | + |
| 64 | + |
| 65 | +object { TheTorus |
| 66 | + texture { OutsideTexture } |
| 67 | + interior_texture { InsideTexture } |
| 68 | + clipped_by { box { <-2,-2,0>, <2,2,2> } } |
| 69 | +} |
| 70 | + |
| 71 | +plane { y, 0 |
| 72 | + clipped_by { TheTorus } |
| 73 | + texture { IntersectTexture } |
| 74 | +} |
0 commit comments