home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Virtual Reality Madness
/
VRMAD96_ONE.ISO
/
virtek
/
libex
/
libex001.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-24
|
1KB
|
23 lines
// Example: 001 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)
{
dddAlign(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 core 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;
}