• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Transformation.to_a array definition

Scheduled Pinned Locked Moved Developers' Forum
9 Posts 5 Posters 641 Views
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.
  • A Offline
    amanzi
    last edited by 20 May 2009, 18:37

    Sorry if I have missed it in the API documentation but could someone point me to where the definition is for each of the 16-elements in the transformation array created by Transformation.to_a (http://code.google.com/apis/sketchup/docs/ourdoc/transformation.html )? I have discovered elements 12,13,14 => x,y,z and was hoping to get the rest without trial and error.

    Thanks for your help.

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 20 May 2009, 19:52

      As far as I know the 16 things aren't [well] documented...

      TIG

      1 Reply Last reply Reply Quote 0
      • A Offline
        amanzi
        last edited by 20 May 2009, 20:18

        Pity - maybe Jim can help?

        What I really need for now is to determine the unit vectors for the local axis of a group or component instance entity. Anyone know if this is in the transformation array or of an easier way?

        1 Reply Last reply Reply Quote 0
        • C Offline
          Chris Fullmer
          last edited by 20 May 2009, 21:05

          the 16 unit array is a 4 by 4 grid of numbers. There are resources on the internet that begin to explain hot to work with it directly. So far I've gotten around it for the most part by using methods offered in the API.

          To get the unit vectors for a componentinstance (or group), use this

          comp_x_axis = component_instance.transformation.xaxis comp_y_axis = component_instance.transformation.yaxis comp_z_axis = component_instance.transformation.zaxis

          That will return a unitvector for each axis of the group or component.

          Hope that helps,

          Chris

          Lately you've been tan, suspicious for the winter.
          All my Plugins I've written

          1 Reply Last reply Reply Quote 0
          • A Offline
            amanzi
            last edited by 20 May 2009, 21:24

            Thank you!

            1 Reply Last reply Reply Quote 0
            • R Offline
              remus
              last edited by 20 May 2009, 22:04

              not having looked at it much myself i cant say for sure, but its likely the numbers are the elements of a 4x4 transformation matrix.

              Lots of info through google: http://www.google.co.uk/search?rlz=1C1CHMG_enGB291GB303&sourceid=chrome&ie=UTF-8&q=4x4+matrix+transformation although it can be a bit tricky to wrap your head around if you havent done much matrices stuff before.

              http://remusrendering.wordpress.com/

              1 Reply Last reply Reply Quote 0
              • P Offline
                Pixero
                last edited by 21 May 2009, 16:59

                Some years ago I wrote a plugin shader for MentalRay that uses the transformation matrix for different modifications like translation, rotation, scale, shear, rotation order, rotation axis, rotation pivot and scale pivot.
                If you're interested in looking at the source code for it (C++) to see "what does what" you can find it here: http://www.pixero.com/files/JS_Place3dTexture.zip

                1 Reply Last reply Reply Quote 0
                • A Offline
                  amanzi
                  last edited by 21 May 2009, 17:44

                  Thanks guys. My math is so rusty that I did not realize that a 4x4 transformation matrix had a "standard" mathematical definition.

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    Chris Fullmer
                    last edited by 22 May 2009, 04:35

                    Don't worry, nether did I. I found it on Wikipedia, but the math involved is a bit over my head for the time being. But in time I hope to get it figured out. Glad you got it working though,

                    Chris

                    Lately you've been tan, suspicious for the winter.
                    All my Plugins I've written

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

                    Advertisement