• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

Confusing method !

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 4 Posters 656 Views 4 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    Didier Bur
    last edited by 1 Feb 2008, 15:44

    Hi all,
    I've coded a method to test if a Point3d lies within a face. This method returns a wrong result sometimes 👿

    class 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 ?

    DB

    1 Reply Last reply Reply Quote 0
    • A Offline
      azuby
      last edited by 1 Feb 2008, 15:53

      The first thing I think about is: Calculations with Float type. Maybe in the background.

      azuby

      *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

      Bad English? PM me, correct me. :smile:**

      1 Reply Last reply Reply Quote 0
      • D Offline
        daiku
        last edited by 1 Feb 2008, 16:45

        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...
        

        Clark Bremer
        http://www.northernlightstimberframing.com

        1 Reply Last reply Reply Quote 0
        • D Offline
          Didier Bur
          last edited by 1 Feb 2008, 19:37

          Thanx, interesting !
          The doc at classify_point is empty 😡

          DB

          1 Reply Last reply Reply Quote 0
          • T Offline
            TIG Moderator
            last edited by 1 Feb 2008, 20:28

            Todd Burch did something on it a while ago...

            http://www.sketchucation.com/forums/scf/viewtopic.php?f=57&t=2927&p=13928&hilit=face#p13928

            TIG

            1 Reply Last reply Reply Quote 0
            • D Offline
              Didier Bur
              last edited by 1 Feb 2008, 23:03

              Thanx a bunch TIG 👍

              DB

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              1 / 1
              • First post
                6/6
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement