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

Jacob Merrill blueprintrandom1 at gmail.com
Fri Mar 18 02:20:25 CET 2016


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#


More information about the Bf-committers mailing list