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!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Turning 3d points on a plane to 2d co-ords?

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 4 Posters 2.3k 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.
    • thomthomT Offline
      thomthom
      last edited by

      I got a set of 3d points, and I would like to compare their relative position to each other on the plane. Any ideas?

      Thomas Thomassen β€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

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

        If the plane is z=0 flat them simply make the point.z=0 for each point.
        If it's an arbitrary plane then project the point to the plane using the plane's normal - or normal.reverse depending which way it's facing - as the 'line's' vector.
        http://code.google.com/apis/sketchup/docs/ourdoc/geom.html#intersect_line_plane
        intersecting the line with the plane returns a point where the vector hits the plane... nil if not - so you can use that if you are unsure on the vector's direction - simply do one test for an intersecting point if no point then use the reversed vector it must then intersect the plane...

        TIG

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          @tig said:

          If it's an arbitrary plane then project the point to the plane using the plane's normal

          ?
          the points are already on the plane.

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            I'll try to spesify:

            I have an arbitrary plane.
            I have a set of 3d point that all lie on that plane

            I would like to work with them in their relative 2D co-ordinates on that plane. (I have a point that acts as origin.)

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • C Offline
              cjthompson
              last edited by

              if you have x and y vectors:
              model2plane = Geom::Transformation.axes(point,x,y,normal).inverse (untested)

              otherwise you can either use vector.cross if you have one vector, or vector.axes if you have neither.

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                Ah1 I've overlooked that transformation method! Thanks, I'll see if I can make this work.

                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  Thank you Chris! It worked like a charm! So glad you pointed that method out, as I was about to embark on a dreadful DIY reinvent the wheel journey.

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • Dan RathbunD Offline
                    Dan Rathbun
                    last edited by

                    Hopefully in some future version we'll have a Geom::Axes class that let's us instantiate as many UCS' as we need and GC them when they're no longer needed. (There would be a world WCS preset by SU of course.)

                    I'm not here much anymore.

                    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