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

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 27 Feb 2012, 02:31

    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
    • D Offline
      Dan Rathbun
      last edited by 27 Feb 2012, 03:40

      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
      • D Offline
        Dan Rathbun
        last edited by 27 Feb 2012, 04:06

        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
        • T Offline
          TIG Moderator
          last edited by 27 Feb 2012, 11:35

          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
          1 / 1
          • First post
            1/4
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement