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:
authormano-wii <germano.costa@ig.com.br>2019-07-23 07:50:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-07-23 07:56:49 +0300
commit6e72d3e00e4ac5b6750f6add5e69664e65779fe5 (patch)
treeef6c53fc691594cba36c312ee1a886efcb2ae921 /source/blender/editors/transform/transform_constraints.c
parent0a0e2dd8a2ce002b76d834c621766e8da3f1b678 (diff)
Fix T67389: Transform constraints fail at large distances
Diffstat (limited to 'source/blender/editors/transform/transform_constraints.c')
-rw-r--r--source/blender/editors/transform/transform_constraints.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index cb539c8d1a5..208242d53b3 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -235,8 +235,7 @@ static void axisProjection(const TransInfo *t,
normalize_v3_v3_length(out, axis, -factor);
}
else {
- float v[3], i1[3], i2[3];
- float v2[3], v4[3];
+ float v[3];
float norm_center[3];
float plane[3];
@@ -261,14 +260,17 @@ static void axisProjection(const TransInfo *t,
}
}
else {
- add_v3_v3v3(v2, t_con_center, axis);
- add_v3_v3v3(v4, v, norm);
-
- isect_line_line_v3(t_con_center, v2, v, v4, i1, i2);
-
- sub_v3_v3v3(v, i2, v);
-
- sub_v3_v3v3(out, i1, t_con_center);
+ /* Use ray-ray intersection instead of line-line because this gave
+ * precision issues adding small values to large numbers. */
+ float mul;
+ if (isect_ray_ray_v3(v, norm, t_con_center, axis, &mul, NULL)) {
+ madd_v3_v3v3fl(out, t_con_center, axis, mul);
+ sub_v3_v3(out, t_con_center);
+ }
+ else {
+ /* In practice this should never fail. */
+ BLI_assert(0);
+ }
/* possible some values become nan when
* viewpoint and object are both zero */