EnttPong/src/libs/SDL2_gfx/SDL2_rotozoom.c
/*!
\brief Internal target surface sizing function for rotozooms with trig result return. 

\param width The source surface width.
\param height The source surface height.
\param angle The angle to rotate in degrees.
\param zoomx The horizontal scaling factor.
\param zoomy The vertical scaling factor.
\param dstwidth The calculated width of the destination surface.
\param dstheight The calculated height of the destination surface.
\param canglezoom The sine of the angle adjusted by the zoom factor.
\param sanglezoom The cosine of the angle adjusted by the zoom factor.

*/
\brief Internal target surface sizing function for rotozooms with trig result return.
\param width The source surface width.
\param height The source surface height.
\param angle The angle to rotate in degrees.
\param zoomx The horizontal scaling factor.
\param zoomy The vertical scaling factor.
\param dstwidth The calculated width of the destination surface.
\param dstheight The calculated height of the destination surface.
\param canglezoom The sine of the angle adjusted by the zoom factor.
\param sanglezoom The cosine of the angle adjusted by the zoom factor.
\ brief Internal target surface sizing function for rotozooms with trig result return . \ param width The source surface width . \ param height The source surface height . \ param angle The angle to rotate in degrees . \ param zoomx The horizontal scaling factor . \ param zoomy The vertical scaling factor . \ param dstwidth The calculated width of the destination surface . \ param dstheight The calculated height of the destination surface . \ param canglezoom The sine of the angle adjusted by the zoom factor . \ param sanglezoom The cosine of the angle adjusted by the zoom factor .
void _rotozoomSurfaceSizeTrig(int width, int height, double angle, double zoomx, double zoomy, 
	int *dstwidth, int *dstheight, 
	double *canglezoom, double *sanglezoom)
{
	double x, y, cx, cy, sx, sy;
	double radangle;
	int dstwidthhalf, dstheighthalf;
	radangle = angle * (M_PI / 180.0);
	*sanglezoom = sin(radangle);
	*canglezoom = cos(radangle);
	*sanglezoom *= zoomx;
	*canglezoom *= zoomy;
	x = (double)(width / 2);
	y = (double)(height / 2);
	cx = *canglezoom * x;
	cy = *canglezoom * y;
	sx = *sanglezoom * x;
	sy = *sanglezoom * y;
	dstwidthhalf = MAX((int)
		ceil(MAX(MAX(MAX(fabs(cx + sy), fabs(cx - sy)), fabs(-cx + sy)), fabs(-cx - sy))), 1);
	dstheighthalf = MAX((int)
		ceil(MAX(MAX(MAX(fabs(sx + cy), fabs(sx - cy)), fabs(-sx + cy)), fabs(-sx - cy))), 1);
	*dstwidth = 2 * dstwidthhalf;
	*dstheight = 2 * dstheighthalf;
}
void _rotozoomSurfaceSizeTrig ( int width , int height , double angle , double zoomx , double zoomy , int * dstwidth , int * dstheight , double * canglezoom , double * sanglezoom ) { double x , y , cx , cy , sx , sy ; double radangle ; int dstwidthhalf , dstheighthalf ; radangle = angle * ( M_PI / 180.0 ) ; * sanglezoom = sin ( radangle ) ; * canglezoom = cos ( radangle ) ; * sanglezoom *= zoomx ; * canglezoom *= zoomy ; x = ( double ) ( width / 2 ) ; y = ( double ) ( height / 2 ) ; cx = * canglezoom * x ; cy = * canglezoom * y ; sx = * sanglezoom * x ; sy = * sanglezoom * y ; dstwidthhalf = MAX ( ( int ) ceil ( MAX ( MAX ( MAX ( fabs ( cx + sy ) , fabs ( cx - sy ) ) , fabs ( - cx + sy ) ) , fabs ( - cx - sy ) ) ) , 1 ) ; dstheighthalf = MAX ( ( int ) ceil ( MAX ( MAX ( MAX ( fabs ( sx + cy ) , fabs ( sx - cy ) ) , fabs ( - sx + cy ) ) , fabs ( - sx - cy ) ) ) , 1 ) ; * dstwidth = 2 * dstwidthhalf ; * dstheight = 2 * dstheighthalf ; }
\brief Internal target surface sizing function for rotozooms with trig result return.
\ brief Internal target surface sizing function for rotozooms with trig result return .
/*
	* Determine destination width and height by rotating a centered source box 
	*/