Grasshopper

algorithmic modeling for Rhino

Hello.

Is there a method for calculating distance from a point to a triangular face?

Thanks

Views: 1396

Replies to This Discussion

Look at the rtree class in rhinocommon

Wow...I had no idea!  You don't know how helpful this thread is going to be for me.  Thanks!

I think you can do it like this (and then check the value in the distance):

I was thinking of avoiding the overhead of creating a trimmed surface.

This is for a component and it must be calculated fast.

I was thinking of making a mesh with that single triangular face, the use the intersect class to intersect a ray passing throught point having the face normal direction.

If it intersects the face then a simple plane.distanceto could be used.

If not, I would get the minimum distance from point to each of the face edges.

Is there a faster way? I'm fairly new to grasshopper and rhino api so I might be missing a lot of useful functions.

steve: I don't think rtree would be of much use in the distance calculation itself the point is already identified  but since I'm calculating this against a potentially large pointset to find the nearest one the nest step would be to use rtree to pre-filter points.I never used rtree but it seams it just selects points based on a sphere or box, I'm I right?

I don't work with meshes myself, but there seems to be a Mesh CP too.
Then after you measure the distance between these points (be sure you graft it properly to avoid unwanted values)

Thanks...thats even better :-)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service