diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-14 15:57:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-14 15:57:35 +0400 |
commit | eb66c453017521894d788d06ec2b966949549aa2 (patch) | |
tree | dc3c5e55f3093f95532b1640be103f2c2c706874 /source/blender | |
parent | e369c2375bc8158aae781af9bf39a66030f3693c (diff) |
correct pyapi function intersect_line_sphere_2d() using 3d vecs when only 2d are needed.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/mathutils/mathutils_geometry.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 91cff67fc49..af06617949f 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -734,8 +734,8 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO float sphere_radius; int clip = TRUE; - float isect_a[3]; - float isect_b[3]; + float isect_a[2]; + float isect_b[2]; if (!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere_2d", &vector_Type, &line_a, @@ -753,24 +753,24 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO return NULL; } else { - short use_a = TRUE; - short use_b = TRUE; + bool use_a = true; + bool use_b = true; float lambda; PyObject *ret = PyTuple_New(2); switch (isect_line_sphere_v2(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) { case 1: - if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE; + if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = false; use_b = FALSE; break; case 2: - if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE; - if (!(!clip || (((lambda = line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE; + if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = false; + if (!(!clip || (((lambda = line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = false; break; default: - use_a = FALSE; - use_b = FALSE; + use_a = false; + use_b = false; } if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 2, Py_NEW, NULL)); } |