Page MenuHome

mathutils.bvhtree crashes with distance input
Closed, ResolvedPublic

Description

System Information
Windows 7 64 bit
Nvidia Quadro 600

Blender Version
Broken: bfdb420

Short description of error
Trying to use the distance input of this function crashes Blender: http://www.blender.org/api/blender_python_api_2_76_1/mathutils.bvhtree.html?highlight=bvh#mathutils.bvhtree.BVHTree.ray_cast

To reproduce the error just copy this script into the text editor and run it:

from mathutils import Vector
from mathutils.bvhtree import BVHTree

bvh = BVHTree.FromPolygons(vertices = [], polygons = [])
bvh.ray_cast(Vector((0, 0, 0)), Vector((1, 0, 0)), 5)

when I try this without ", 5" it does not crash.

I know this is not the place for feature requests, but is it possible to have a minimum distance? That would be helpful when I want to spawn another ray from the location a first ray_cast gave me. Otherwise the function always gives me the same point. Yes I could offset the ray start vector in the direction of the normal but maybe a Min Distance would be better :)

Event Timeline

Jacques Lucke (JacquesLucke) updated the task description. (Show Details)
Jacques Lucke (JacquesLucke) raised the priority of this task from to Needs Triage by Developer.
Bastien Montagne (mont29) triaged this task as Confirmed, Medium priority.Oct 18 2015, 12:08 PM

Confirmed, dummy typo in code ;)

Re minimum distance, as far as I have understood BVH process, not sure this is really possible - not without breaking the whole purpose of BVH, which is being able to only check a very small subset of items, instead of all of them…