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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-12-27 15:05:49 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-12-27 15:05:49 +0400
commit76b562237f31a804cd2eba9e3af6effa54f31b5b (patch)
treed789e373995ad0ab4ca0fb5668937c5b7814bb2d /source/blender/blenlib/intern/math_geom.c
parent03e388127034c35c82ed0f84b2239125111db5a4 (diff)
parentd09a8ea9e7a8ad208326b99a0631e9efc7119fbd (diff)
Merge branch 'master' into soc-2013-depsgraph_mtsoc-2013-depsgraph_mt
Conflicts: source/blender/blenkernel/intern/constraint.c source/blender/blenkernel/intern/depsgraph.c source/blender/blenkernel/intern/object.c source/blender/blenkernel/intern/scene.c source/blender/blenkernel/intern/shrinkwrap.c source/blender/collada/AnimationExporter.cpp source/blender/editors/space_image/image_ops.c source/blender/editors/space_view3d/view3d_view.c source/blender/makesrna/intern/rna_scene.c source/blender/modifiers/intern/MOD_util.c source/blender/render/intern/source/pipeline.c
Diffstat (limited to 'source/blender/blenlib/intern/math_geom.c')
-rw-r--r--source/blender/blenlib/intern/math_geom.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 11875722d27..1d03bf42f83 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -721,24 +721,16 @@ bool isect_point_poly_v2(const float pt[2], const float verts[][2], const unsign
/* first vector */
fp1[0] = (float)(p1[0] - pt[0]);
fp1[1] = (float)(p1[1] - pt[1]);
- normalize_v2(fp1);
for (i = 0; i < nr; i++) {
- float dot, ang, cross;
p2 = verts[i];
/* second vector */
fp2[0] = (float)(p2[0] - pt[0]);
fp2[1] = (float)(p2[1] - pt[1]);
- normalize_v2(fp2);
/* dot and angle and cross */
- dot = dot_v2v2(fp1, fp2);
- ang = fabsf(saacos(dot));
- cross = (float)((p1[1] - p2[1]) * (p1[0] - pt[0]) + (p2[0] - p1[0]) * (p1[1] - pt[1]));
-
- if (cross < 0.0f) angletot -= ang;
- else angletot += ang;
+ angletot += angle_signed_v2v2(fp1, fp2);
/* circulate */
copy_v2_v2(fp1, fp2);
@@ -769,24 +761,16 @@ bool isect_point_poly_v2_int(const int pt[2], const int verts[][2], const unsign
/* first vector */
fp1[0] = (float)(p1[0] - pt[0]);
fp1[1] = (float)(p1[1] - pt[1]);
- normalize_v2(fp1);
for (i = 0; i < nr; i++) {
- float dot, ang, cross;
p2 = verts[i];
/* second vector */
fp2[0] = (float)(p2[0] - pt[0]);
fp2[1] = (float)(p2[1] - pt[1]);
- normalize_v2(fp2);
/* dot and angle and cross */
- dot = dot_v2v2(fp1, fp2);
- ang = fabsf(saacos(dot));
- cross = (float)((p1[1] - p2[1]) * (p1[0] - pt[0]) + (p2[0] - p1[0]) * (p1[1] - pt[1]));
-
- if (cross < 0.0f) angletot -= ang;
- else angletot += ang;
+ angletot += angle_signed_v2v2(fp1, fp2);
/* circulate */
copy_v2_v2(fp1, fp2);