// program to rotate a bunch of preset coordinates
// I wrote this for making elixir since yadex's rotation functions are shite
// RjY 26:1/3/2004
#include <stdio.h>
#include <math.h>
// origin of shape
#define XOFF (-736.0)
#define YOFF (1184.0)
// values in rotation matrix
// (COS, -SIN)
// (SIN,  COS)
// (tan theta is -1/4, so you can work cos theta and sin theta out)
#define COS (4.0/sqrt(17.0))
#define SIN (-1.0/sqrt(17.0))
// convenience
typedef struct point_s {
	double x;
	double y;
} point;
// shape in the map editor that needs rotating because yadex is too stupid
// to be able to do it itself without making it all wonky
static const point shape[] = {
	// corners of crate
	{32, 32},	// top right corner
	{32, -32},	// bottom right
	{-32, -32},	// bottom left
	{-32, 32},	// top left
	// outer corners of claw
	{-8, 40},	// top left
	{8,40},		// top right
	{40,8},		// right top
	{40,-8},	// right bottom
	{8,-40},	// bottom right
	{-8,-40},	// bottom left
	{-40,-8},	// left bottom
	{-40,8},	// left top
	// where the claw meets the edges of the crate
	{-8, 32},	// top left
	{8,32},		// top right
	{32,8},		// right top
	{32,-8},	// right bottom
	{8,-32},	// bottom right
	{-8,-32},	// bottom left
	{-32,-8},	// left bottom
	{-32,8},	// left top
	// inner corners of claw
	{8,8},		// top right
	{8,-8},		// bottom right
	{-8,-8},	// bottom left
	{-8,8},		// top left
	// claw arm diamond shape thing
	{0,8},		// top
	{8,0},		// right
	{0,-8},		// bottom
	{-8,0},		// left
	// terminator
	{0,0}
};
int main(void) {
	int i = -1;
	double x, y;
	do {
		i++;
		x = XOFF + COS * shape[i].x - SIN * shape[i].y;
		y = YOFF + SIN * shape[i].x + COS * shape[i].y;
		printf("(%10f, %10f)->(%10f, %10f)\n",
				shape[i].x, shape[i].y, x, y);
	} while (shape[i].x != 0.0 || shape[i].y != 0.0);
	return 0;
}