home *** CD-ROM | disk | FTP | other *** search
- // Example: 002 from Library Reference
- #include "..\3D-Ware\dddware.h"
- #include <stdio.h>
- short angle[]={0,0};
- long object[]={0,0,0};
- long target[]={1000,0,0}; // X pos of target a little to the right.
- float yaw, pitch;
- short main(void)
- {
- dddAlign16(angle,target,object); // Find the angles to point object at the target
- pitch=angle[0]; // Get a floating point copy of xangle.
- pitch=(long)(pitch/(0xffc0/360)); // Calculate the real Degrees of the 3D-Ware degrees.
- pitch=(int)(pitch+360)%360; // Make sure in the range 0-359.
- yaw=angle[1];
- yaw=(long)(yaw/(0xffc0/360));
- yaw=(int)(yaw+360)%360;
- // NOTE. 0-360 degrees may not be absolutely accurate
- // due to rounding errors.
- printf("\n\nThe angles returned are :- 0x%X (xangle/pitch %.0f°) 0x%X (yangle/yaw %.0f°)\n\n",angle[0],
- pitch, angle[1], yaw);
- return 0;
- }
-