File: float4.pov

package info (click to toggle)
povray 1%3A3.6.1-12
  • links: PTS
  • area: non-free
  • in suites: lenny, squeeze
  • size: 31,084 kB
  • ctags: 20,310
  • sloc: ansic: 110,032; cpp: 86,573; sh: 13,595; pascal: 5,942; asm: 2,994; makefile: 1,753; ada: 1,637
file content (63 lines) | stat: -rw-r--r-- 1,711 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Persistence Of Vision Raytracer version 3.5 sample file.
// FLOAT4.POV
// Animate this scene with clock values +ki0.0 to +kf1.0
// Demonstrate sqrt, pow, degrees & atan2 as well as Pythagorean Theorm
// using a 3-4-5 triangle and some boxes.

global_settings { assumed_gamma 2.2 }

#include "colors.inc"

#declare Rad=1/6;
#declare Font="cyrvetic.ttf"

camera {
   location  <0, 0, -140>
   direction <0, 0,  11>
   look_at   <0, 0,   0>
}

light_source { <5000, 10000, -20000> color White}
plane { z, Rad hollow on pigment {checker color rgb <1,.8,.8> color rgb <1,1,.8>} }

#declare A=4;
#declare B=3*clock;
#declare C=sqrt(pow(A,2)+pow(B,2));
#declare Angle_b=atan2(B,A);
#declare b_Degrees=degrees(Angle_b);

union {
  box{0,<A,-A,1>
    pigment {checker Yellow , Red}
  }

  box{0,<B,B,1>
    pigment {checker Yellow , Blue}
    translate x*A
  }
  box{0,<C,C,1>
    pigment {checker Yellow , Green}
    rotate z*b_Degrees
  }

  intersection{
    box{0,2}
    cylinder{-z,z,2}
    cylinder{-z,z,1.75 inverse}
    translate z*.1
    pigment{Magenta*.7}
  }

  text{ttf Font "A=4",0.1,0 translate <1,-5,0> pigment{Red}}
  text{ttf Font concat("B=",str(B,1,2)),0.1,0 translate <4.25,-1.25,0> pigment{Blue}}
  text{ttf Font "C=sqrt(pow(A,2)",0.1,0  translate <-9,2,0> pigment{Green}}
  text{ttf Font "+pow(B,2))",0.1,0  translate <-7,1,0> pigment{Green}}
  text{ttf Font concat("C=",str(C,1,2)),0.1,0 pigment{Green}
       translate (C+0.3)*y
       rotate z*b_Degrees
      }
  text{ttf Font concat("b=atan2(B,C)=",str(Angle_b,1,2)),0.1,0 translate <-9,-1,0> pigment{Magenta*.7}}
  text{ttf Font concat("degrees(b)=",str(b_Degrees,1,2)),0.1,0 translate <-8.5,-2,0> pigment{Magenta*.7}}

  translate x-y
}