STATE_group_rotate_to_match_axis_system

 

 


   rotates the group so that the orientation of the group matches the given directions
   The given directions dont have to be normalized.
   one of the direction can be 0,0,0 in this case it is calculated automatically.
   If the given axis are not orthogonal, the function 
   handle it by building an orthogonal system that is close as possible
   to the given axis.
   see also STATE_group_calculate_axis_system()
   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_group_rotate_to_match_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_group_rotate_to_match_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_group_rotate_to_match_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_group_rotate_to_match_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_group_rotate_to_match_axis_system(x_axis, y_axis, z_axis);
  
   Returns OK or VR_ERROR.

 

 

Go to page 1      Select API

 

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