

int p_to_w ( SS_XYZ *pt, int screen_x, int screen_y )
SS_XYZ *pt; // address of 3D point to receive world point int screen_x; // screen x coordinate int screen_y; // screen y coordinate



Synopsis 
#include "silver.h"
The p_to_w function computes a 3D world coordinate based on the screen coordinates screen_x and screen_y . The world point is copied into the SS_XYZ at pt .


Parameters 
pt is the address of a 3D point that is to receive the computed world point. screen_x and screen_y are graphics screen coordinates, such that 0 <= screen_x < spixel_width and 0 <= screen_y < spixel_height .


Return Value 
If the screen coordinate is within the bounds of the current window, then p_to_w returns 1, and pt is computed such that it lies on the current window in world space. Otherwise p_to_w returns 0.


Comments 
While related to the function w_to_p , the two are not inverse functions. Calling p_to_w with the results of w_to_p may not return the original point because w_to_p does not preserve any depth information, and may truncate a value when converting to integer space.


See Also 



