User:Le Forgeron/vault/RefImgCameraViewStereo

From POV-Wiki
Jump to navigation Jump to search

RefImgCameraViewStereo.png

#version 3.7;
global_settings {assumed_gamma 1 }

camera {
orthographic
location -(image_height+image_width)*z
direction z
up image_height*y
right image_width*x
rotate 45*x
rotate -45*y
}

#include "colors.inc"
background { White }
#default { texture { finish { ambient 1 diffuse 0 } } }

#declare Text_size = image_height / 21;
#declare Vertical_down_space = -Text_size*y*1.7;
#declare Vertical_up_space = Text_size*y*.6;
#declare Point_size = image_height / 82;
#declare Line_size = image_height / 482;

#macro Label(te,pos,col)
text { ttf "ttf-dejavu/DejaVuSerif.ttf" te 0.1,0
texture { pigment { colour col } }
translate -strlen(te)*0.23*x
rotate 45*x
rotate -45*y
scale Text_size translate pos }
#end

#macro Small_Label(te,pos,col)
text { ttf "ttf-dejavu/DejaVuSerif.ttf" te 0.1,0
texture { pigment { colour col } }
rotate 45*x
rotate -45*y
scale Text_size*2/3 translate pos }
#end

#macro Arrow(pos,dir)
#local k=vlength(dir);
cone { pos,0,pos-Text_size*dir/k,Point_size }
#end
#macro Ray(pos,dir)
#local k=vlength(dir);
cone { pos,0,pos-Text_size*dir/k,Point_size texture { pigment { colour Blue } } }
#end

#declare Location = <0,0,0.-.6*image_height>;
#declare Look_at = <0,0,0.7*image_height>;
#declare Center = <0,0,0.0*image_height>;
#declare Right = <image_height/3.5,0,0>;
#declare Up = <0,image_height/3.5,0>;
#declare Distance = 2.0;
#declare LEye = Location-Right*Distance/2;
#declare REye = Location+Right*Distance/2;
#declare Focus = (Look_at-Center)/2;
sphere { Location, Point_size }
Label("location",Location+Vertical_down_space, Black)
sphere { LEye, Point_size texture { pigment { color NeonPink } } }
sphere { REye, Point_size texture { pigment { color DarkGreen } } }

sphere { Look_at, Point_size }
Label("look_at",Look_at+Vertical_up_space, Black)

cylinder { Location, Center , Line_size }
cylinder { Center, Look_at , Line_size texture { pigment { checker colour Black, colour White scale Text_size } } }
Arrow(Center,Center-Location)
Label("direction", Center+Vertical_up_space, Black )

cylinder { -Right*2, 2*Right, Line_size }
Label("right",Right*2+Vertical_down_space, Black)
Arrow(Right*2,Right-Center)

cylinder { -Up*2, 2*Up, Line_size }
Label("up",Up*2+Vertical_up_space, Black)
Arrow(Up*2,Up-Center)

#macro Picture(Right,Up,Location,i )
box { i*(-Right-Up)+Location*(1-i), i*(Right+Up)+Location*(1-i) texture { pigment { colour rgbft 0.5 } } }
cylinder { i*(-Right-Up)+Location*(1-i), i*(Right-Up)+Location*(1-i), Line_size }
cylinder { i*(-Right+Up)+Location*(1-i), i*(Right+Up)+Location*(1-i), Line_size }
cylinder { i*(Right+Up)+Location*(1-i), i*(Right-Up)+Location*(1-i), Line_size }
cylinder { i*(-Right+Up)+Location*(1-i), i*(-Right-Up)+Location*(1-i), Line_size }
#end
#declare LAngle = degrees(atan2((LEye-Focus).x,-(LEye-Focus).z))*y;
#declare RAngle = degrees(atan2((REye-Focus).x,-(REye-Focus).z))*y;
Label("distance", REye-Vertical_up_space*2 ,Blue)
Label("parallaxe", Focus+Vertical_up_space, Red )

#declare Ratio = 6/9;
#declare Increment = Ratio/4;
union{
#for(i,Increment ,Ratio, Increment)
Picture(Right,Up,Location,i)
#end
cylinder { Location, Ratio*(Up+Right)+(1-Ratio)*Location, Line_size texture { pigment { colour NeonPink } } }
cylinder { Location, Ratio*(-Up+Right)+(1-Ratio)*Location, Line_size texture { pigment { colour NeonPink } } }
cylinder { Location, Ratio*(-Up-Right)+(1-Ratio)*Location, Line_size texture { pigment { colour NeonPink } } }
cylinder { Location, Ratio*(Up-Right)+(1-Ratio)*Location, Line_size texture { pigment { colour NeonPink } } }
translate -Location
rotate -LAngle
translate LEye
}

union{
#for(i,Increment ,Ratio, Increment)
Picture(Right,Up,Location,i)
#end
cylinder { Location, Ratio*(Up+Right)+(1-Ratio)*Location, Line_size texture { pigment { colour DarkGreen } } }
cylinder { Location, Ratio*(-Up+Right)+(1-Ratio)*Location, Line_size texture { pigment { colour DarkGreen } } }
cylinder { Location, Ratio*(-Up-Right)+(1-Ratio)*Location, Line_size texture { pigment { colour DarkGreen } } }
cylinder { Location, Ratio*(Up-Right)+(1-Ratio)*Location, Line_size texture { pigment { colour DarkGreen } } }
translate -Location
rotate -RAngle
translate REye
}

intersection {
disc { Center, Up, vlength(Location)/8, vlength(Location)/8-Point_size texture { pigment { colour Red } } }
plane { vcross(-Up,REye-Focus),0 texture { pigment { colour rgbt 1 } } }
plane { -x,0 texture { pigment { colour rgbt 1 } } }
translate Focus
}
intersection {
disc { Center, Up, vlength(Location)/8, vlength(Location)/8-Point_size texture { pigment { colour Red } } }
plane { vcross(-Up,REye-Focus),0 texture { pigment { colour rgbt 1 } } }
plane { -x,0 texture { pigment { colour rgbt 1 } } }
rotate 180*y
translate REye
}

intersection{
disc { Center, Up, vlength(Location)/7, vlength(Location)/7-Point_size texture { pigment { colour Red } } }
plane { x,0 texture { pigment { colour rgbt 1 } } }
plane { vcross(Up,LEye-Focus),0 texture { pigment { colour rgbt 1 } } }
translate Focus
}
intersection{
disc { Center, Up, vlength(Location)/7, vlength(Location)/7-Point_size texture { pigment { colour Red } } }
plane { x,0 texture { pigment { colour rgbt 1 } } }
plane { vcross(Up,LEye-Focus),0 texture { pigment { colour rgbt 1 } } }
rotate 180*y
translate LEye
}

cylinder { LEye, REye , 2*Line_size texture { pigment { colour Blue } } }


cylinder { LEye, Focus, Line_size texture { pigment { colour Red } } }
cylinder { REye, Focus, Line_size texture { pigment { colour Red } } }

cylinder { Center+REye-Location, REye , Line_size texture { pigment { color Scarlet  }} }
cylinder { Center+LEye-Location, LEye , Line_size texture { pigment { color Scarlet   }} }
union{
Arrow(Center+REye-Location,-Location)
Arrow(Center+LEye-Location,-Location)
texture { pigment { color Scarlet   }} 
}