clbarnes / ncollpyde

Mesh containment and line segment intersection queries in Python (over rust)
MIT License
9 stars 0 forks source link

Signed distance to mesh #17

Closed clbarnes closed 3 years ago

clbarnes commented 3 years ago

From @schlegelp

PointQuery.distance_to_point should do this. Then we'd need to do a normal containment check (i.e. ray casts) to determine whether to make any distances negative. It might be nice to allow users to enable/disable the second stage. This would simplify the underlying implementation - in the first instance, we can just deal with the python-rust bridge twice and do

points = np.asarray(points)
distance = self._impl.distance(points)  # to be implemented
if signed:
    is_inside = self._impl.contains_many(points)
    distance[is_inside] *= -1
return distance

If this proves to be a bottleneck, we can do it all in rust.

clbarnes commented 3 years ago

Implemented in v0.17.0!