[Bf-committers] Add sphere radius check to mathutils.bvhtree

Jacob Merrill blueprintrandom1 at gmail.com
Sat Mar 19 21:57:23 CET 2016


Thank you!
that was quick!

On Sat, Mar 19, 2016 at 12:46 AM, Campbell Barton <ideasman42 at gmail.com>
wrote:

> Useful functionality to have, something we already supported for KD-Trees:
>
> Committed BVHTree.find_nearest_range(), [0], see API doc [1] and
> example script [2].
>
> [0]:
> https://developer.blender.org/rB26f2fe9528250d8935ded4957da34b5bcc58cf00
> [1]:
> https://www.blender.org/api/blender_python_api_2_77_0/mathutils.bvhtree.html#mathutils.bvhtree.BVHTree.find_nearest_range
> [2]: https://developer.blender.org/P340
>
> On Fri, Mar 18, 2016 at 12:20 PM, Jacob Merrill
> <blueprintrandom1 at gmail.com> wrote:
> > would it be possible to add a command to get all faces that intersect a
> > sphere to mathutils bvhtree?
> >
> > this would expose additional functionality to python based tools.
> >
> > from this command, a user could also then get all vertices involved in
> the
> > faces returned by the sphere radius command, and then iterate against the
> > small list to get all vertices in a radius,
> >
> > example code
> >
> > FaceList = mathutils.bvhtree.sphereCheck(point,radius)
> >
> > vertices =[]
> > for Face in FaceList:
> >    faceV = [Face.v1,Face.v2,Face.v3]
> >    if Face.v4:
> >        faceV.append(Face.v4)
> >
> >    vertices.append(faceV)
> >
> > VinR = []
> > for Vert in vecticies:
> >     if (Vert.XYZ-point).magnitude<radius:
> >         VinR.append(Vert)
> >
> >
> > #VinR = verts in radius#
> > _______________________________________________
> > Bf-committers mailing list
> > Bf-committers at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-committers
>
>
>
> --
> - Campbell
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list