Browse Source

neue rotationsfunktion

seba 12 years ago
parent
commit
e8de360ed9
2 changed files with 22 additions and 0 deletions
  1. 21
    0
      emath_opengl.cpp
  2. 1
    0
      emath_opengl.h

+ 21
- 0
emath_opengl.cpp View File

@@ -50,3 +50,24 @@ void rotFrom2VecTo2Vec(Punkt3D a, Punkt3D b, Punkt3D c, Punkt3D d) {
50 50
 // 	rvec2.print("rvecdeg2");
51 51
 	
52 52
 }
53
+
54
+void rotvec2(Punkt3D a, Punkt3D b, Punkt3D c, Punkt3D d, float *dega, Punkt3D *veca, float *degb, Punkt3D *vecb) {
55
+	*dega = a.calcAngle(b);
56
+	if(*dega==180.0f)
57
+		*veca = a.getOrtographic();
58
+	else if(*dega==0.0f)
59
+		veca->set(1.0f, 0.0f, 0.0f);
60
+	else
61
+		*veca = a.kreuzprodukt(b);
62
+	*degb = 0.0f;
63
+	vecb->set(1.0f, 0.0f, 0.0f);
64
+	c = Rotationsmatrix(*veca, *dega) * c;
65
+	
66
+	*degb = c.calcAngle(d);
67
+	if(*degb==180.0f)
68
+		*vecb = c.getOrtographic();
69
+	else if(*degb==0.0f)
70
+		vecb->set(1.0f, 0.0f, 0.0f);
71
+	else
72
+		*vecb = c.kreuzprodukt(d);
73
+}

+ 1
- 0
emath_opengl.h View File

@@ -9,4 +9,5 @@
9 9
 
10 10
 void rotFrom2VecTo2Vec(Punkt3D a, Punkt3D b, Punkt3D c, Punkt3D d, Punkt3D *, float *, Punkt3D *, float *);
11 11
 void rotFrom2VecTo2Vec(Punkt3D a, Punkt3D b, Punkt3D c, Punkt3D d);
12
+void rotvec2(Punkt3D a, Punkt3D b, Punkt3D c, Punkt3D d, float *dega, Punkt3D *veca, float *degb, Punkt3D *vecb);
12 13
 #endif

Loading…
Cancel
Save