STATE_object_set_axis_system

 

 



   Rotates the object so that the orientation of the object matches the given directions
   returns OK or VR_ERROR
   One of the useful usage of this function together with STATE_object_get_axis_system() and get\set location
   is to save the objact exact position.
   For more explaniton see inside the book "3D programming for windows using STATE"
   One of the given axises could be 0,0,0 in this case this axis is calculated automatically(derived from the other two axises).
   If the given axises are not orthogonal, the function 
   handle it by building an orthogonal system that is close as possible
   to the given axis.
  
   Arguments:
  
  		double x[3], double y[3], double z[3];
  			The X Axis, the Y axis and the Z axis.
  			The given axises do not have to be a unit vector. and one of the axises
  			could be left for the function to calculate by giving(0,0,0)			
  			
  
   Here are some examples, note that
   all the examples give the same result.
   Example A:
  	x_axis[0]=0; x_axis[1]=1; x_axis[2]=0; 
  	y_axis[0]=-1; y_axis[1]=0; y_axis[2]=0; 
  	z_axis[0]=0; z_axis[1]=0; z_axis[2]=1; 
  	STATE_object_set_axis_system(x_axis, y_axis, z_axis);
  
   Example B:
  	  Example B would give exactly the same result as example A
  	x_axis[0]=0; x_axis[1]=111; x_axis[2]=0; 
  	y_axis[0]=-17; y_axis[1]=0; y_axis[2]=0; 
  	z_axis[0]=0; z_axis[1]=0; z_axis[2]=12; 
  	STATE_object_set_axis_system(x_axis, y_axis, z_axis);
  
   Example C:
  	  Note that  z_axis=(0,0,0) and will be automatically 
       calculated by the function
  	  Example C would give exactly the same result as example A and B
  	x_axis[0]=0; x_axis[1]=111; x_axis[2]=0; 
  	y_axis[0]=-17; y_axis[1]=0; y_axis[2]=0; 
  	z_axis[0]=0; z_axis[1]=0; z_axis[2]=0; 
  	STATE_object_set_axis_system(x_axis, y_axis, z_axis);
  
   Example D:
       Note that z_axis=(0,0,0) and that the x_axis and the y_axis are not orthogonal to each other.
      Note that we will get again the same result
  	x_axis[0]=0; x_axis[1]=1; x_axis[2]=0; 
  	y_axis[0]=-1; y_axis[1]=11; y_axis[2]=0; 
  	z_axis[0]=0; z_axis[1]=0; z_axis[2]=0; 
  	STATE_object_set_axis_system(x_axis, y_axis, z_axis);
  
   Example E:
       Note that z_axis=(-1,0,0) which doesn't give a right hand system
  	   in this case the z_axis will be ignored and calculated by doing cross between the x_axis and the y_axis
      Note that we will get again the same result
  	x_axis[0]=0; x_axis[1]=1; x_axis[2]=0; 
  	y_axis[0]=-1; y_axis[1]=0; y_axis[2]=0; 
  	z_axis[0]=0; z_axis[1]=0; z_axis[2]=-1; 
  	STATE_object_set_axis_system(x_axis, y_axis, z_axis);

 

 

Go to page 1      Select API

 

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