Handout 33
PovRay Orientation
// Persistence of Vision Ray Tracer Scene Description File
// File: axes.pov
// Vers: 3.5
// Desc: Axes Example
// Date: September 4, 2004
#include "colors.inc"
global_settings { assumed_gamma 1.2 }
light_source {<0,23,0> White * 1 shadowless}
light_source {<0,0,-5> White * 1 shadowless}
camera
{ angle 0
location <10, 10 ,-10>
rotate <0,0,0>
look_at <0,0,0>
translate <0,0,0>
}
//------------------------------ the Axes --------------------------------
//------------------------------------------------------------------------
#macro Axis( AxisLen, Dark_Texture,Light_Texture)
union{
cylinder { <0,-AxisLen,0>,<0,AxisLen,0>,0.05
texture{checker texture{Dark_Texture }
texture{Light_Texture}
translate<0.1,0,0.1>}
}
cone{<0,AxisLen,0>,0.2,<0,AxisLen+0.7,0>,0
texture{Dark_Texture}
}
} // end of union
#end // of macro "Axis()"
//------------------------------------------------------------------------
#macro AxisXYZ( AxisLenX, AxisLenY, AxisLenZ, Tex_Dark, Tex_Light)
//--------------------- drawing of 3 Axes --------------------------------
union{
#if (AxisLenX != 0)
object { Axis(AxisLenX, Tex_Dark, Tex_Light) rotate< 0,0,-90>}// x-Axis
text { ttf "arial.ttf", "x", 0.15, 0 texture{Tex_Dark}
scale 0.5 translate <AxisLenX+0.05,0.4,-0.10>}
#end // of #if
#if (AxisLenY != 0)
object { Axis(AxisLenY, Tex_Dark, Tex_Light) rotate< 0,0, 0>}// y-Axis
text { ttf "arial.ttf", "y", 0.15, 0 texture{Tex_Dark}
scale 0.5 translate <-0.3,AxisLenY+0.50,-0.10>}
#end // of #if
#if (AxisLenZ != 0)
object { Axis(AxisLenZ, Tex_Dark, Tex_Light) rotate<90,0, 0>}// z-Axis
text { ttf "arial.ttf", "z", 0.15, 0 texture{Tex_Dark}
scale 0.5 translate <-0.35,0.2,AxisLenZ+0.10>}
#end // of #if
} // end of union
#end// of macro "AxisXYZ( ... )"
//------------------------------------------------------------------------
#declare Texture_A_Dark = texture {
pigment{color rgb<1,0.35,0>}
finish {ambient 0.15 diffuse 0.85 phong 1}
}
#declare Texture_A_Light = texture {
pigment{color rgb<1,1,1>}
finish {ambient 0.15 diffuse 0.85 phong 1}
}
//-------------------------------------------------- end of coordinate axes
///////////////////////////// axes ////////////////////////////////
#macro Axes(Length)
#declare Size=0.1;
union {
// z-axis
box {
<Size, Size, Length> // Near lower left corner
<-Size, -Size, -Length> // Far upper right corner
texture { pigment { color Blue } }
rotate <0,0,0>
}
text {
ttf "timrom.ttf" "z" 0.1, 0
pigment { Blue }
rotate <0,0,0>
translate <0,0,Length>
}
// x-axis
box {
<Size, Size, Length> // Near lower left corner
<-Size, -Size, -Length> // Far upper right corner
texture { pigment { color Red } }
rotate <0,90,0>
}
text {
ttf "timrom.ttf" "X" 0.1, 0
pigment { Red }
translate <Length,0,0>
}
// y-axis
box {
<Size, Size, Length> // Near lower left corner
<-Size, -Size, -Length> // Far upper right corner
texture { pigment { color Green } }
rotate <90,0,0>
}
text {
ttf "timrom.ttf" "y" 0.1, 0
pigment { Green }
translate <0,Length,0>
}
}
#end
///////////////////////////// axes ////////////////////////////////
// draw the axes
object{ AxisXYZ(5, 5, 5, Texture_A_Dark, Texture_A_Light)
translate <-3,0,-3>
}
object{ Axes(5)
translate <3,0,3>
}