sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Confusing method !

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 696 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.
    • Didier BurD Offline
      Didier Bur
      last edited by

      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

        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
        • daikuD Offline
          daiku
          last edited by

          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
          • Didier BurD Offline
            Didier Bur
            last edited by

            Thanx, interesting !
            The doc at classify_point is empty 😡

            DB

            1 Reply Last reply Reply Quote 0
            • TIGT Online
              TIG Moderator
              last edited by

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

              301 Moved Permanently

              favicon

              (www.sketchucation.com)

              TIG

              1 Reply Last reply Reply Quote 0
              • Didier BurD Offline
                Didier Bur
                last edited by

                Thanx a bunch TIG 👍

                DB

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

                Advertisement