view rotate.c @ 20:ebc55ce699ec

Rotate the other way around: z, y, x - more useful to us
author Josef "Jeff" Sipek <jeffpc@optonline.net>
date Sat, 03 Dec 2005 00:35:58 -0500
parents 51e9b6b85edd
children 72194bf15970
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

void rotate_header(float a, float b, float g)
{
	printf("%f %f %f\n"
	       "%f %f %f\n"
	       "%f %f %f", cos(a)*cos(b), -cos(g)*sin(a)+cos(a)*sin(b)*sin(g), cos(a)*cos(g)*sin(b)+sin(a)*sin(g),
	       		   cos(b)*sin(a), cos(a)*cos(g)+sin(a)*sin(b)*sin(g), cos(g)*sin(a)*sin(b)-cos(a)*sin(g),
			   -sin(b), cos(b)*sin(g), cos(b)*cos(g));
}

int main(int argc, char** argv)
{
	float omega, phi, rho;
	char c;

	scanf("%f %f %f", &omega, &phi, &rho);
	rotate_header(omega, phi, rho);

	while((c = getc(stdin)) != EOF)
		putc(c, stdout);
		

	return 0;
}