User:Le Forgeron/vault/RefImgCameraViewSpherical

From POV-Wiki
Jump to navigation Jump to search

RefImgCameraViewSpherical.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.4*image_height>;
#declare Look_at = <0,0,0.7*image_height>;
#declare Center = <0,0,-0.0*image_height>;
#declare Right = <image_width/4,0,0>;
#declare Up = <0,image_height/4,0>;
#declare FA = 80;
#declare FB = 70;
sphere { Location, Point_size }
Label("location",Location+4*Vertical_down_space, Black)

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
)
#include "finish.inc"
#macro Picture(Right,Up,Location,i)
#local rc=vlength(Location-Center);
#local rr=vlength(Right);
#local ru=rc*sin(radians(FB));
#local lu=rc*cos(radians(FB));
//#local ra=sqrt(rr*rr+rc*rc+ru*ru);
//#local rb=sqrt(rr*rr+rc*rc+ru*ru);
//#declare xa=asin(rr/(1*rb));

intersection {
sphere { Location, i*(rc)  
texture { pigment { colour rgbft 0.5 }  } }
plane { y,ru*i no_shadow  texture { pigment { colour rgbf 1 } } }
plane { -y,ru*i no_shadow texture { pigment { colour rgbf 1 } } }
plane { x,0 rotate y*FA translate Location  no_shadow texture { pigment { colour rgbf 1 } }  }
plane { -x,0 rotate -y*FA translate Location  no_shadow texture { pigment { colour rgbf 1 } }  }
//plane { -x,0 rotate -y*50  no_shadow texture { pigment { colour rgbft 1 } }  }
//cone { Location, 0 , Center*2-Location, 2*rr
texture { pigment { colour rgbft 0.5 }  } 
}

intersection {
union {
torus { lu*i, Line_size translate Location+y*ru*i }
torus { lu*i, Line_size translate Location-y*ru*i }
}
plane { x,0 rotate y*FA translate Location  no_shadow texture { pigment { colour rgbf 1 } }  }
plane { -x,0 rotate -y*FA translate Location  no_shadow texture { pigment { colour rgbf 1 } }  }
}
intersection {
torus { rc*i, Line_size rotate 90*z rotate FA*y translate Location }
plane { -y,0 rotate FB*x rotate y*FA translate Location  no_shadow texture { pigment { colour rgbf 1 } }  }
plane { y,0 rotate -FB*x rotate y*FA translate Location  no_shadow texture { pigment { colour rgbf 1 } }  }
}
intersection {
torus { rc*i, Line_size rotate 90*z rotate -FA*y translate Location }
plane { -y,0 rotate FB*x rotate -y*FA translate Location  no_shadow texture { pigment { colour rgbf 1 } }  }
plane { y,0 rotate -FB*x rotate -y*FA translate Location  no_shadow texture { pigment { colour rgbf 1 } }  }
}

//disc { Location-(Location-Center)*i, (Location-Center), i*rr, i*rr-Line_size }
#end
#for(i,1/4,1,1/4)
Picture(Right,Up,Location,i)
#end


cylinder { Location, Center, Line_size translate -Location rotate y*FA translate Location texture { pigment { colour Red } } }
cylinder { Location, Center, Line_size translate -Location rotate -y*FA translate Location texture { pigment { colour Red } } }
Label("angle", Location*2+Vertical_up_space*14 ,Red)

cylinder { Location, Center Line_size translate -Location rotate -x*FB  translate Location  texture { pigment { colour Yellow } } }
cylinder { Location, Center Line_size  translate -Location rotate x*FB translate Location  texture { pigment { colour Yellow } } }
Label("angle", Location*2+Vertical_up_space*9 ,Black)

cylinder { Location, Center Line_size translate -Location rotate x*FB rotate y*FA translate Location texture { pigment { colour Blue } }  }
cylinder { Location, Center Line_size translate -Location rotate -x*FB rotate y*FA translate Location  texture { pigment { colour Blue } } }
cylinder { Location, Center Line_size translate -Location rotate -x*FB rotate -y*FA translate Location  texture { pigment { colour Blue } } }
cylinder { Location, Center Line_size translate -Location rotate x*FB rotate -y*FA translate Location  texture { pigment { colour Blue } } }
/*
cylinder { Location, Up+Right, Line_size }
cylinder { Location, -Up+Right, Line_size }
cylinder { Location, -Up-Right, Line_size }
cylinder { Location, Up-Right, Line_size }
*/
Ray ( Location+4/5*vrotate((Center-Location),FB*x+y*FA), vrotate((Center-Location),FB*x+y*FA) )
Ray ( Location+4/5*vrotate((Center-Location),-FB*x+y*FA), vrotate((Center-Location),-FB*x+y*FA) )
Ray ( Location+4/5*vrotate((Center-Location),-FB*x-y*FA), vrotate((Center-Location),-FB*x-y*FA) )
Ray ( Location+4/5*vrotate((Center-Location),FB*x-y*FA), vrotate((Center-Location),FB*x-y*FA) )


intersection {
disc { Location, Up, vlength(Location)/6, vlength(Location)/6-Point_size texture { pigment { colour Red } } }
plane { x,0 rotate y*FA translate Location texture { pigment { colour rgbt 1 } } }
plane { -x,0 rotate -y*FA translate Location texture { pigment { colour rgbt 1 } } }
}

intersection {
disc { 0, x , vlength(Location)/7, vlength(Location)/7-Point_size
translate Location 
texture { pigment { colour Yellow } } }
plane { y,0 rotate -x*FB translate Location texture { pigment { colour rgbt 1 } } }
plane { -y,0  rotate x*FB  translate Location texture { pigment { colour rgbt 1 } } }
//plane { 0 translate Location texture { pigment { colour rgbt 1 } } }
//plane { vcross(-Right,Location-Center+Up),0 translate Location texture { pigment { colour rgbt 1 } } }
}