All pastes #2076921 Raw Edit

Someone

public cpp v1 · immutable
#2076921 ·published 2011-06-08 20:31 UTC
rendered paste body
#include <iostream>#include <cmath>using namespace std;void rotate(int V[], float VStrich[], float winkel){	float push;	float matrix[3][3] = {{1, 0, 0},{0, cos(winkel), -sin(winkel)},{0, sin(winkel), cos(winkel)}};		for(int zeile = 0; zeile < 3; zeile++){		push = 0;		for(int spalte = 0; spalte < 3; spalte++){			push += matrix[zeile][spalte] * V[spalte];		}		VStrich[zeile] = push;	}}int main(){	int x, y, z, bogen;	float tetha;	const float PI=3.1415926535897932384626433832795;	int v[3];	float vStrich[3];		cout << "Koordinaten eingeben:" << endl;	cout << "x = ";	cin >> x;	cout << endl;	v[0] = x;	cout << "y = ";	cin >> y;	cout << endl;	v[1] = y;	cout << "z = ";	cin >> z;	cout << endl;	v[2] = z;		cout << "Winkel eingeben (Grad Bogenmass): ";	cin >> bogen;		tetha = bogen*PI/180;		//hier sieht man, dass mit den winkelfunktionen scheinbar etwas nicht ganz stimmt...test mit z.b. 180 ergibt völligen unsinn!	cout << sin(tetha) << endl;	cout << -sin(tetha) << endl;	cout << cos(tetha) << endl; 			rotate(v, vStrich, tetha);	cout << "Rotation um " << bogen << " Grad liefert:" << endl;	cout << "x = " << vStrich[0] << endl;	cout << "y = " << vStrich[1] << endl;	cout << "z = " << vStrich[2] << endl;	}