Miloslav Číž vor 4 Jahren
Ursprung
Commit
2797ec18c0
2 geänderte Dateien mit 18 neuen und 11 gelöschten Zeilen
  1. 8 5
      test_sdl.c
  2. 10 6
      tinyphysicsengine.h

+ 8 - 5
test_sdl.c

@@ -26,24 +26,27 @@ S3L_Index cubeTriangles[] = { S3L_CUBE_TRIANGLES };
 
 int main()
 {
-TPE_Vec4 a, b, r, r2, r3 axis;
-
+TPE_Vec4 a, b, r, r2, r3, axis;
 
 TPE_setVec4(&axis,512,0,0,0);
 
-TPE_rotationToQuaternion(axis,128,&r);
+TPE_rotationToQuaternion(axis,-128,&r);
 
 TPE_setVec4(&axis,0,512,0,0);
-TPE_rotationToQuaternion(axis,128,&r2);
+TPE_rotationToQuaternion(axis,-128,&r2);
 
 TPE_quaternionMultiply(r,r2,&r3);
 
 TPE_setVec4(&axis,512,0,0,0);
-TPE_rotationToQuaternion(axis,128,&r);
+TPE_rotationToQuaternion(axis,-128,&r);
 TPE_quaternionMultiply(r3,r,&r2);
 
 TPE_PRINTF_VEC4(r2);
 
+TPE_setVec4(&axis,0,0,512,0);
+TPE_rotationToQuaternion(axis,128,&r);
+
+TPE_PRINTF_VEC4(r);
 
 
   SDL_Window *window = SDL_CreateWindow("test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, S3L_RESOLUTION_X, S3L_RESOLUTION_Y, SDL_WINDOW_SHOWN); 

+ 10 - 6
tinyphysicsengine.h

@@ -10,17 +10,21 @@
 
   CONVENTIONS:
 
+  - Compatibility and simple usage with small3dlib is intended, so most
+    convention and data types copy those of small3dlib (which takes a lot of
+    conventions of OpenGL).
+
   - No floating point is used, we instead use integers (effectively a fixed
     point). TPE_FRACTIONS_PER_UNIT is an equivalent to 1.0 in floating point and
     all numbers are normalized by this constant.
 
   - Units: for any measure only an abstract mathematical unit is used. This unit
-    always has TPE_FRACTIONS_PER_UNIT parts. You can see assign any
-    correcpondence with real life units to these units. E.g. 1 spatial unit
-    (which you can see as e.g. 1 meter) is equal to TPE_FRACTIONS_PER_UNIT.
-    Same with temporatl (e.g. 1 second) and mass (e.g. 1 kilogram) units, and
-    also any derived units, e.g. a unit of velocity (e.g. 1 m/s) is also equal
-    to 1 TPE_FRACTIONS_PER_UNIT. A full angle is also split into
+    always has TPE_FRACTIONS_PER_UNIT parts. You can assign any correcpondence
+    with real life units to these units. E.g. 1 spatial unit (which you can see
+    as e.g. 1 meter) is equal to TPE_FRACTIONS_PER_UNIT. Same with temporatl
+    (e.g. 1 second) and mass (e.g. 1 kilogram) units, and also any derived
+    units, e.g. a unit of velocity (e.g. 1 m/s) is also equal to 1
+    TPE_FRACTIONS_PER_UNIT. A full angle is also split into
     TPE_FRACTIONS_PER_UNIT parts (instead of 2 * PI or degrees).
 */