sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Finding new rotated 3d coordinate points?

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 136 Views 3 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.
    • T Offline
      tomot
      last edited by

      I have a defined face which is made up of four 3d points such as:
      base = entities.add_face(pt1, pt2, pt3, pt4)
      I now rotate that face 45 degrees by:
      t = Geom::Transformation.rotation(pt0,Geom::Vector3d.new(0,0,1), 45.degrees) group.move!(t)
      The original face has now been rotated about a some point pt0. I can determine using math the new pt1new, pt2new, pt3new, pt4new co-ordinates of that rotated face, but is there a more direct and less tedious method I'm not aware that will allow me to determine those new 3d points?

      TIA!

      [my plugins](http://thingsvirtual.blogspot.ca/)
      tomot

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

        I think there was a recent topic on this...

        lets see, perhaps:

        grpdefn = grp.entities.parent
        pts = []
        grpdefn.entities.each {|e|
          if e.is_a?(Sketchup;;Face)
            e.vertices.each{|v| pts << v.postion }
          end
        }
        pts.uniq!
        

        I'm not here much anymore.

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

          Also if the face is the only thing in the group, you may use group.local_bounds

          I'm not here much anymore.

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

            Using
            group.move!(t)
            will miss the 'undo stack' [typically used in animations], whereas using
            group.transform!(t)
            won't.
            You can apply a transformation to a 3d point [and vector] too, to make a new reference use
            pt1new=pt1.transform(t)
            or
            pt1.transform!(t)
            to 'reuse' pt1 which is '!' changed to its matching vertex's current value
            https://developers.google.com/sketchup/docs/ourdoc/point3d#transform

            TIG

            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