Hi,
I recently encountered an issue with the following code:
pole.entities.grep(Sketchup::Face) do |f|
result = f.classify_point(pt1)
if result == Sketchup::Face::PointInside
face1 = f
break
end
end
The point is always classified as outside the faces, likely due to minor precision errors in the calculations. Is there a method to determine the smallest distance between a point and the faces to make a more accurate decision?
Thank you in advance
If you want to increase the tolerances at which you believe that a point belongs to a face, make a projection of the point onto a face plane.
And already consider this point as belonging to a face.
And the second step is to measure the distance from the starting point to the plane and compare it with your tolerances.
But it seems to me that this is not the right way, because you artificially equate a point on the face that is not actually such. Not understanding why you need this, I cannot speak about the correctness of such actions
I check if the point belongs to a face, from the reverse
if result != Sketchup::Face::PointUnknown &&
result !=Sketchup::Face::PointOutside &&
result !=Sketchup::Face::PointNotOnPlane
...
end