STATE_engine_2D_point_to_3D_point_on_plane

 

 


   The function associates a 2D point on the rendered window and a plane in the 3D world.
   This function is useful for example when dragging an object with the mouse.
   Once we click on the object we can get the polygon that was clicked using STATE_engine_2D_point_to_3D()
   Now when dragging the object the mouse could move outside the object and then we wouldn't be able to use
   STATE_engine_2D_point_to_3D(). By using this function we tell the engine that the 2D point
   is related to a specific polygon even if the 2d coords are outside this polygon.
   Detailes:
   Gets a two dimensional point (x,y) which is a point in the rendered window
   Usually we get this point from events like OnLButtonDown()
   The function returns the corresponding three dimensional point
   in the 3D world that is on the given plane. 
  
   Arguments:
  	x,y   -  A two dimensional point in the rendered window
    p3D - a point x,y,z in the 3D world which corresponds to the given 2D point and is located on the given plane.
  			 When calling the function to content of this argument is not relevant.
  			 The function calculate the 3D point and returns it through this argument.
  
    polygons_plane - A plane in the 3D World (doesnt have to be a plane of any specific polygon)
  					 The result p3D point will always be on this plane.
  
   Return Value: OK or VR_ERROR
  
   See also STATE_engine_2D_point_to_3D_point(), STATE_polygon_get_plane()
  
   Example:
  		int x=10, y=20;
  		double result[3];
  		the_plane[0]=10;   This is a random plane. Instead we could have used STATE_polygon_get_plane()
  		the_plane[1]=11;
  		the_plane[2]=12;
  		the_plane[3]=14;
  		int return_code;
  		return_code=STATE_engine_2D_point_to_3D(x,y, the_plane ,result);

 

 

Go to page 1      Select API

 

Copyright © 2007 3DSTATE Corporation. www.3dstate.com