home *** CD-ROM | disk | FTP | other *** search
/ Virtual Reality Madness / VRMAD96_ONE.ISO / virtek / libex / libex001.c < prev    next >
C/C++ Source or Header  |  1995-08-24  |  1KB  |  23 lines

  1.                                     // Example: 001 from Library Reference
  2. #include "..\3D-Ware\dddware.h"
  3. #include <stdio.h>
  4. short    angle[]={0,0};
  5. long     object[]={0,0,0};
  6. long     target[]={1000,0,0};       // X pos of target a little to the right.
  7. float    yaw, pitch;
  8. short  main(void)
  9. {
  10.   dddAlign(angle, target, object);  // Find the angles to point object at the target
  11.   pitch=angle[0];                   // Get a floating point copy of xangle.
  12.   pitch=(long)(pitch/(0xffc0/360)); // Calculate the real Degrees of the core degrees.
  13.   pitch=(int)(pitch+360)%360;       // Make sure in the range 0-359.
  14.   yaw=angle[1];
  15.   yaw=(long)(yaw/(0xffc0/360));
  16.   yaw=(int)(yaw+360)%360;
  17.                                     // NOTE. 0-360 degrees may not be absolutely
  18.                                     // accurate due to rounding errors.
  19.   printf("\n\nThe angles returned are :- 0x%X (xangle/pitch %.0f°)    0x%X (yangle/yaw %.0f°)\n\n",angle[0],
  20.   pitch, angle[1], yaw);
  21.   return 0;
  22. }
  23.