/********************************************************************************** Persistence of Vision Ray Tracer Scene Description File File name : position_finder.pov Version : 3.5 / MegaPOV 1.21 Description : tool to find exact positions for an object on your ground or whatever - not very mature during render you see the position and inclination in the message window (Alt+M), after finishing you have to scroll Date : August 2006 Author : Norbert Kern E-mail : p.b.i. Copyright (C) 2006. All rights reserved. Use and/or modification of this scene is free, except for commercial purposes. Commercial distribution is not allowed without written permission from the author. **********************************************************************************/ // Render settings (right-click on a line below): // +w640 +h640 +a0.3 +am2 +bm2 +wt6 #version 3.7; #ifndef (Standalone) #declare Standalone = on; #end // macro stuff __________________________________________________________________ #macro pos_finder (areal, mirror, cam_loc, lookat, cam_ang, x_pos, y_pos, sign_scale, sign_rot) #include"transforms.inc" #declare cam_mirror = mirror; // 1 for normal / -1 for mirror image #declare cam_z = 0.5*image_width/image_height/tan(radians(cam_ang*0.5)); // amount of camera zoom #declare cam_a = cam_mirror*image_width/image_height; // camera aspect ratio #declare cam_s = y; // camera sky vector #declare cam_d = vnormalize (lookat-cam_loc); // camera direction vector #declare cam_r = vnormalize (vcross(cam_s,cam_d)); // camera right vector #declare cam_up = vnormalize (vcross(cam_d,cam_r)); // camera up vector #declare cam_dir = cam_d*cam_z; // direction vector scaled #declare cam_right = cam_r*cam_a; // right vector scaled #declare dir_y = vaxis_rotate (lookat-cam_loc,vcross (lookat-cam_loc,cam_up),(0.5-y_pos*0.01)*cam_ang/image_width*image_height); #declare dir_xy = vaxis_rotate (dir_y,cam_up,(0.5-x_pos*0.01)*cam_mirror*cam_ang); #declare Norm = <0,0,0>; #declare Inter = trace (areal,cam_loc,dir_xy,Norm); #if (vlength (Norm) != 0) #declare rx = degrees (atan2 (Norm.z,Norm.y)); #declare rz = -degrees (atan2 (Norm.x,Norm.y)); #declare precise = 4; // number of digits shown in message window union { cylinder {0.2*y,1*y,0.05} cone {0,0,0.2*y,0.08} text { ttf "cyrvetic.ttf" concat ("rotate <",str (rx,0,precise-1),", 0, ",str (rz,0,precise-1),">") 0.1,0 scale 0.1 rotate <-rx,0,-rz> translate <0.1,0.6,0> } text { ttf "cyrvetic.ttf" concat ("translate <",str (Inter.x,0,precise),", ",str (Inter.y,0,precise),", ",str (Inter.z,0,precise),">") 0.05,0 scale 0.1 rotate <-rx,0,-rz> translate <0.1,0.48,0> } text { ttf "cyrvetic.ttf" concat ("Normal <",str (Norm.x,0,precise),", ",str (Norm.y,0,precise),", ",str (Norm.z,0,precise),">") 0.05,0 scale 0.1 rotate <-rx,0,-rz> translate <0.1,0.36,0> } texture { pigment {color rgb <0.99, 0.1, 0.1>} finish {emission 0.1 diffuse 1 specular 0.0 roughness 0.1 reflection 0.0} } scale sign_scale rotate translate Inter } #debug concat (" \n") #debug concat ("Position Finder results:\n") #debug concat ("rotate <",str (rx,0,precise-1),", 0, ",str (rz,0,precise-1),">\n") #debug concat ("translate <",str (Inter.x,0,precise),", ",str (Inter.y,0,precise),", ",str (Inter.z,0,precise),">\n") #debug concat ("normal <",str (Norm.x,0,precise),", ",str (Norm.y,0,precise),", ",str (Norm.z,0,precise),">\n") #debug concat (" \n") #else #debug concat (" \n") #debug concat ("Position Finder results:\n") #debug concat ("position not on areal, please try other x_pos or y_pos values\n") #debug concat (" \n") #end #end //of macro //_______________________________________________________________________________ #if (Standalone) global_settings{ assumed_gamma 1.0 } #default{ finish{ ambient 0.0 diffuse 0.9 }} #include "math.inc" #include "SharkD/Axis and Grid/Axes_macro.inc" // the coordinate grid and axes Axes_Macro ( 1.0, // Axes_axesSize, The distance from the origin to one of the grid's edges. (float) 1.0/3, // Axes_majUnit, The size of each large-unit square. (float) 5, // Axes_minUnit, The number of small-unit squares that make up a large-unit square. (integer) 0.003, // Axes_thickRatio, The thickness of the grid lines (as a factor of axesSize). (float) on, // Axes_aBool, Turns the axes on/off. (boolean) on, // Axes_mBool, Turns the minor units on/off. (boolian) off, // Axes_xBool, Turns the plane perpendicular to the x-axis on/off. (boolean) on, // Axes_yBool, Turns the plane perpendicular to the y-axis on/off. (boolean) off // Axes_zBool, Turns the plane perpendicular to the z-axis on/off. (boolean) ) object {Axes_Object} // definitions __________________________________________________________________ #declare mirror = 1; #declare cam_loc = <1, 1.5, -3>; #declare lookat = <0.0, 0.0, 0.0>; #declare cam_ang = 50; #declare sign_scale = 0.75; #declare sign_rot = 0; #declare areal = disc { <0, 0, 0>, y, 1.0, 0.0 scale 1 rotate <0, 0, -10> //rotate 45*y texture { pigment {color srgb <0.5, 0.6, 0.2>} normal {bozo scale 0.02} finish {ambient 0 diffuse 0.6} } } // scene __________________________________________________________________ //Reading the cursor position on the rendered image: #local Width_pos = 217; //first cursor position on image #local Height_pos = 347; //second cursor position on image //Positions calculated to percentages of screen location: #declare x_pos = 100-(100/image_width*Width_pos); // between 0 for right and 100 for left image edge #declare y_pos = 100/image_height*Height_pos; // between 0 for sky and 100 for lower image egde //#declare x_pos = 75; // between 0 for left and 100 for right image edge //#declare y_pos = 50; // between 0 for sky and 100 for lower image egde #debug concat("\n x_pos: <",vstr(3, x_pos, ", ", 0,3),">\n") #debug concat(" y_pos: <",vstr(3, y_pos, ", ", 0,3),">\n\n") pos_finder (areal, mirror, cam_loc, lookat, cam_ang, x_pos, y_pos, sign_scale, sign_rot) camera { location cam_loc look_at lookat up y sky y right x*image_width/image_height angle cam_ang } light_source {0 color rgb 1 translate <-200, 400, 150>} light_source {0 color rgb 0.25 shadowless translate cam_loc} background {color rgb 0.99} object {areal} //orientation of normal: #if (vlength (Norm) != 0) union { cone {<0, 1.5, 0>, 0.04, <0, 1.8, 0>, 0.0} cylinder {<0, 0, 0>, <0, 1.5, 0>, 0.01} scale sign_scale rotate translate Inter pigment {srgb <1, 1, 0>} } #end #end //of Standalone