Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2012-01-21 09:27:25 +0400
committerMike Erwin <significant.bit@gmail.com>2012-01-21 09:27:25 +0400
commit030649cf37697eed8f030e29da512b3d660cb307 (patch)
tree674055c6937a3aa1b21972250fc69efea7b4f9fb /source
parente6d81c2c44660aa6ee613e6c96074b3993d21135 (diff)
formatted snapquats table so entries line up, rounded to 7 significant digits (fp32 respects ~6), no functional change
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c86
1 files changed, 44 insertions, 42 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 1a06a0d4821..2620fe4ac71 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -518,52 +518,54 @@ static void viewops_data_free(bContext *C, wmOperator *op)
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 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
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];