Revision: 43577
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43577
Author:   merwin
Date:     2012-01-21 05:27:25 +0000 (Sat, 21 Jan 2012)
Log Message:
-----------
formatted snapquats table so entries line up, rounded to 7 significant digits 
(fp32 respects ~6), no functional change

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_edit.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c     
2012-01-21 03:37:44 UTC (rev 43576)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c     
2012-01-21 05:27:25 UTC (rev 43577)
@@ -518,52 +518,54 @@
 
 static const float thres = 0.93f; //cos(20 deg);
 
-#define COS45 0.70710678118654746
+#define COS45 0.7071068
 #define SIN45 COS45
 
-static float snapquats[39][5] = {
+#define NUM_SNAP_QUATS 39
+
+static const float snapquats[NUM_SNAP_QUATS][5] = {
        /*{q0, q1, q3, q4, view}*/
-       {COS45, -SIN45, 0.0, 0.0, RV3D_VIEW_FRONT},  //front
-       {0.0, 0.0, -SIN45, -SIN45, RV3D_VIEW_BACK}, //back
-       {1.0, 0.0, 0.0, 0.0, RV3D_VIEW_TOP},       //top
-       {0.0, -1.0, 0.0, 0.0, RV3D_VIEW_BOTTOM},      //bottom
-       {0.5, -0.5, -0.5, -0.5, RV3D_VIEW_RIGHT},    //left
-       {0.5, -0.5, 0.5, 0.5, RV3D_VIEW_LEFT},      //right
+       {COS45, -SIN45, 0.0,    0.0,   RV3D_VIEW_FRONT},
+       {0.0,    0.0,  -SIN45, -SIN45, RV3D_VIEW_BACK},
+       {1.0,    0.0,   0.0,    0.0,   RV3D_VIEW_TOP},
+       {0.0,   -1.0,   0.0,    0.0,   RV3D_VIEW_BOTTOM},
+       {0.5,   -0.5,  -0.5,   -0.5,   RV3D_VIEW_RIGHT},
+       {0.5,   -0.5,   0.5,    0.5,   RV3D_VIEW_LEFT},
 
        /* some more 45 deg snaps */
-       {0.65328145027160645, -0.65328145027160645, 0.27059805393218994, 
0.27059805393218994, 0},
-       {0.92387950420379639, 0.0, 0.0, 0.38268342614173889, 0},
-       {0.0, -0.92387950420379639, 0.38268342614173889, 0.0, 0},
-       {0.35355335474014282, -0.85355335474014282, 0.35355338454246521, 
0.14644660055637360, 0},
-       {0.85355335474014282, -0.35355335474014282, 0.14644660055637360, 
0.35355338454246521, 0},
-       {0.49999994039535522, -0.49999994039535522, 0.49999997019767761, 
0.49999997019767761, 0},
-       {0.27059802412986755, -0.65328145027160645, 0.65328145027160645, 
0.27059802412986755, 0},
-       {0.65328145027160645, -0.27059802412986755, 0.27059802412986755, 
0.65328145027160645, 0},
-       {0.27059799432754517, -0.27059799432754517, 0.65328139066696167, 
0.65328139066696167, 0},
-       {0.38268336653709412, 0.0, 0.0, 0.92387944459915161, 0},
-       {0.0, -0.38268336653709412, 0.92387944459915161, 0.0, 0},
-       {0.14644658565521240, -0.35355335474014282, 0.85355335474014282, 
0.35355335474014282, 0},
-       {0.35355335474014282, -0.14644658565521240, 0.35355335474014282, 
0.85355335474014282, 0},
-       {0.0, 0.0, 0.92387944459915161, 0.38268336653709412, 0},
-       {-0.0, 0.0, 0.38268336653709412, 0.92387944459915161, 0},
-       {-0.27059802412986755, 0.27059802412986755, 0.65328133106231689, 
0.65328133106231689, 0},
-       {-0.38268339633941650, 0.0, 0.0, 0.92387938499450684, 0},
-       {0.0, 0.38268339633941650, 0.92387938499450684, 0.0, 0},
-       {-0.14644658565521240, 0.35355338454246521, 0.85355329513549805, 
0.35355332493782043, 0},
-       {-0.35355338454246521, 0.14644658565521240, 0.35355332493782043, 
0.85355329513549805, 0},
-       {-0.49999991059303284, 0.49999991059303284, 0.49999985098838806, 
0.49999985098838806, 0},
-       {-0.27059799432754517, 0.65328145027160645, 0.65328139066696167, 
0.27059799432754517, 0},
-       {-0.65328145027160645, 0.27059799432754517, 0.27059799432754517, 
0.65328139066696167, 0},
-       {-0.65328133106231689, 0.65328133106231689, 0.27059793472290039, 
0.27059793472290039, 0},
-       {-0.92387932538986206, 0.0, 0.0, 0.38268333673477173, 0},
-       {0.0, 0.92387932538986206, 0.38268333673477173, 0.0, 0},
-       {-0.35355329513549805, 0.85355329513549805, 0.35355329513549805, 
0.14644657075405121, 0},
-       {-0.85355329513549805, 0.35355329513549805, 0.14644657075405121, 
0.35355329513549805, 0},
-       {-0.38268330693244934, 0.92387938499450684, 0.0, 0.0, 0},
-       {-0.92387938499450684, 0.38268330693244934, 0.0, 0.0, 0},
-       {-COS45, 0.0, 0.0, SIN45, 0},
-       {COS45, 0.0, 0.0, SIN45, 0},
-       {0.0, 0.0, 0.0, 1.0, 0}
+       { 0.6532815, -0.6532815, 0.2705981, 0.2705981, 0},
+       { 0.9238795,  0.0,       0.0,       0.3826834, 0},
+       { 0.0,       -0.9238795, 0.3826834, 0.0,       0},
+       { 0.3535534, -0.8535534, 0.3535534, 0.1464466, 0},
+       { 0.8535534, -0.3535534, 0.1464466, 0.3535534, 0},
+       { 0.4999999, -0.4999999, 0.5,       0.5,       0},
+       { 0.2705980, -0.6532815, 0.6532815, 0.2705980, 0},
+       { 0.6532815, -0.2705980, 0.2705980, 0.6532815, 0},
+       { 0.2705978, -0.2705980, 0.6532814, 0.6532814, 0},
+       { 0.3826834,  0.0,       0.0,       0.9238794, 0},
+       { 0.0,       -0.3826834, 0.9238794, 0.0,       0},
+       { 0.1464466, -0.3535534, 0.8535534, 0.3535534, 0},
+       { 0.3535534, -0.1464466, 0.3535534, 0.8535534, 0},
+       { 0.0,        0.0,       0.9238794, 0.3826834, 0},
+       {-0.0,        0.0,       0.3826834, 0.9238794, 0},
+       {-0.2705980,  0.2705980, 0.6532813, 0.6532813, 0},
+       {-0.3826834,  0.0,       0.0,       0.9238794, 0},
+       { 0.0,        0.3826834, 0.9238794, 0.0,       0},
+       {-0.1464466,  0.3535534, 0.8535533, 0.3535533, 0},
+       {-0.3535534,  0.1464466, 0.3535533, 0.8535533, 0},
+       {-0.4999999,  0.4999999, 0.4999999, 0.4999999, 0},
+       {-0.2705980,  0.6532815, 0.6532814, 0.2705980, 0},
+       {-0.6532815,  0.2705980, 0.2705980, 0.6532814, 0},
+       {-0.6532813,  0.6532813, 0.2705979, 0.2705979, 0},
+       {-0.9238793,  0.0,       0.0,       0.3826833, 0},
+       { 0.0,        0.9238793, 0.3826833, 0.0,       0},
+       {-0.3535533,  0.8535533, 0.3535533, 0.1464466, 0},
+       {-0.8535533,  0.3535533, 0.1464466, 0.3535533, 0},
+       {-0.3826833,  0.9238794, 0.0,       0.0,       0},
+       {-0.9238794,  0.3826833, 0.0,       0.0,       0},
+       {-COS45,      0.0,       0.0,       SIN45,     0},
+       { COS45,      0.0,       0.0,       SIN45,     0},
+       { 0.0,        0.0,       0.0,       1.0,       0}
 };
 
 enum {
@@ -724,7 +726,7 @@
 
                mul_qt_v3(viewquat_inv, zaxis);
 
-               for (i = 0 ; i < 39; i++){
+               for (i = 0 ; i < NUM_SNAP_QUATS; i++){
 
                        float view = (int)snapquats[i][4];
                        float viewquat_inv_test[4];

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to