source/DSGM_atan2Lerp.c
// Basic lookup+linear interpolation for atan2. 
// Returns [0,2pi), where pi ~ 0x4000.
Basic lookup+linear interpolation for atan2.
Basic lookup + linear interpolation for atan2 .
uint atan2Lerp(int x, int y) {
	if(y == 0) return (x >= 0 ? 0 : BRAD_PI);
	int phi, fa, fb, h;
	uint t;
	OCTANTIFY(x, y, phi);
	phi *= BRAD_PI/4;
	t = QDIV(y, x, ATAN_FP);
	h = t % ATANLUT_STRIDE;
	fa = atanLUT[t/ATANLUT_STRIDE  ];
	fb = atanLUT[t/ATANLUT_STRIDE+1];
	return phi + ((fa + ((fb-fa)*h >> ATANLUT_STRIDE_SHIFT))>>3);
}
uint atan2Lerp ( int x , int y ) { if ( y == 0 ) return ( x >= 0 ? 0 : BRAD_PI ) ; int phi , fa , fb , h ; uint t ; OCTANTIFY ( x , y , phi ) ; phi *= BRAD_PI / 4 ; t = QDIV ( y , x , ATAN_FP ) ; h = t % ATANLUT_STRIDE ; fa = atanLUT [ t / ATANLUT_STRIDE ] ; fb = atanLUT [ t / ATANLUT_STRIDE + 1 ] ; return phi + ( ( fa + ( ( fb - fa ) * h >> ATANLUT_STRIDE_SHIFT ) ) >> 3 ) ; }
Basic lookup+linear interpolation for atan2.
Basic lookup + linear interpolation for atan2 .