💡 LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
Confusing method !
-
Hi all,
I've coded a method to test if a Point3d lies within a face. This method returns a wrong result sometimesclass Geom;;Point3d def on_face?(f) points3d=[] f.vertices.each { |v| points3d.push(v.position) } i = self.project_to_plane f.plane if self.on_plane?(f.plane) and i == self and Geom.point_in_polygon_2D(self,points3d,true) puts "in !" return true else puts "out !" return false end end
As you can see, 3 different tests are made to ensure that the point is on the face and within the boundaries of the face, but this is not working !
Help anyone ? -
The first thing I think about is: Calculations with Float type. Maybe in the background.
azuby
-
I needed a "point_on_face" method a while back. I can't remember who gave me this tip, but here it is:
if face.classify_point(pt) >= 1 and face.classify_point(pt) <= 4 then...
-
Thanx, interesting !
The doc at classify_point is empty -
Todd Burch did something on it a while ago...
-
Thanx a bunch TIG
Advertisement