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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-17 17:32:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-17 17:32:54 +0300
commit5513da65b24a3ce77b1709acea841475115f3a7a (patch)
tree20bd4d26f20ac63ebf776cea3a0220c11258f06d /source/blender/blenlib/intern/BLI_dial_2d.c
parentf19ecdeec64506415b9a9f75293df866691bbd28 (diff)
Cleanup: trailing space for BLI
Diffstat (limited to 'source/blender/blenlib/intern/BLI_dial_2d.c')
-rw-r--r--source/blender/blenlib/intern/BLI_dial_2d.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/blenlib/intern/BLI_dial_2d.c b/source/blender/blenlib/intern/BLI_dial_2d.c
index d31367c5e87..1f4c59ac2fb 100644
--- a/source/blender/blenlib/intern/BLI_dial_2d.c
+++ b/source/blender/blenlib/intern/BLI_dial_2d.c
@@ -30,21 +30,21 @@
struct Dial {
/* center of the dial */
float center[2];
-
- /* threshold of the dial. Distance of current position has to be greater
+
+ /* threshold of the dial. Distance of current position has to be greater
* than the threshold to be used in any calculations */
float threshold_squared;
-
+
/* the direction of the first dial position exceeding the threshold. This
* is later used as the basis against which rotation angle is calculated */
float initial_direction[2];
/* cache the last angle to detect rotations bigger than -/+ PI */
float last_angle;
-
+
/* number of full rotations */
int rotations;
-
+
/* has initial_direction been initialized */
bool initialized;
};
@@ -53,17 +53,17 @@ struct Dial {
Dial *BLI_dial_initialize(const float start_position[2], float threshold)
{
Dial *dial = MEM_callocN(sizeof(Dial), "dial");
-
+
copy_v2_v2(dial->center, start_position);
dial->threshold_squared = threshold * threshold;
-
+
return dial;
}
float BLI_dial_angle(Dial *dial, const float current_position[2])
{
float current_direction[2];
-
+
sub_v2_v2v2(current_direction, current_position, dial->center);
/* only update when we have enough precision, by having the mouse adequately away from center */
@@ -77,14 +77,14 @@ float BLI_dial_angle(Dial *dial, const float current_position[2])
copy_v2_v2(dial->initial_direction, current_direction);
dial->initialized = true;
}
-
+
/* calculate mouse angle between initial and final mouse position */
cosval = dot_v2v2(current_direction, dial->initial_direction);
sinval = cross_v2v2(current_direction, dial->initial_direction);
-
+
/* clamp to avoid nans in acos */
angle = atan2f(sinval, cosval);
-
+
/* change of sign, we passed the 180 degree threshold. This means we need to add a turn.
* to distinguish between transition from 0 to -1 and -PI to +PI, use comparison with PI/2 */
if ((angle * dial->last_angle < 0.0f) &&
@@ -96,9 +96,9 @@ float BLI_dial_angle(Dial *dial, const float current_position[2])
dial->rotations++;
}
dial->last_angle = angle;
-
+
return angle + 2.0f * (float)M_PI * dial->rotations;
}
-
+
return dial->last_angle;
}