sketchucation logo sketchucation
    • Login
    ๐Ÿ›ฃ๏ธ Road Profile Builder | Generate roads, curbs and pavements easily Download

    [Request] Transformation rotation for animation help

    Scheduled Pinned Locked Moved Plugins
    15 Posts 4 Posters 3.7k 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.
    • T Offline
      tomasz
      last edited by

      @chrisglasier said:

      My idea is to kind of sneak up on namesets from the rear, as opposed to previous full frontal assault!

      ๐Ÿ˜„ ๐Ÿ‘

      Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        @chrisglasier said:

        Can anyone help me to translate the x-, y- and zaxis results to degrees for each axis?

        Vector3d.angle_between will get you part of the way there.

        
        angle = t.zaxis.angle_between(Z_AXIS).degrees
        
        

        However, angle_between always gives a result between 0 and 180 (or more accurately between zero and ฯ€).

        Hi

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

          @jim said:

          
          > angle = t.zaxis.angle_between(Z_AXIS).degrees
          > 
          

          However, angle_between always gives a result between 0 and 180 (or more accurately between zero and ฯ€).

          What..?! All you need to do to convert radians to degrees is appending .degrees? ๐Ÿ˜ฎ doh! ๐Ÿ˜ณ

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

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            @thomthom said:

            What..?! All you need to do to convert radians to degrees is appending .degrees? ๐Ÿ˜ฎ doh! ๐Ÿ˜ณ

            Heh, see the Numeric documentation for the SketchUp-specific additions.

            Hi

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

              @jim said:

              @thomthom said:

              What..?! All you need to do to convert radians to degrees is appending .degrees? ๐Ÿ˜ฎ doh! ๐Ÿ˜ณ

              Heh, see the Numeric documentation for the SketchUp-specific additions.

              Meh,... I've seen that page, taking note of the unit conversion, but completely missed the ones relating to radians and degrees. goes of to clean up some scripts...

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

              1 Reply Last reply Reply Quote 0
              • chrisglasierC Offline
                chrisglasier
                last edited by

                @jim said:

                
                > angle = t.zaxis.angle_between(Z_AXIS).degrees
                > 
                

                However, angle_between always gives a result between 0 and 180 (or more accurately between zero and ฯ€).

                A quick pre-dinner try I get this with 90 deg rotation around X :

                Transformation report2.jpg

                Now off to eat!

                Chris

                With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                1 Reply Last reply Reply Quote 0
                • chrisglasierC Offline
                  chrisglasier
                  last edited by

                  @chrisglasier said:

                  @jim said:

                  
                  > > angle = t.zaxis.angle_between(Z_AXIS).degrees
                  > > 
                  

                  However, angle_between always gives a result between 0 and 180 (or more accurately between zero and ฯ€).

                  A quick pre-dinner try ...

                  ... failed because I made
                  t = selection.transformation, when it should be something related to vector3D ??
                  Also I don't understand the difference/relationship/source of zaxis and (Z_AXIS).

                  Perhaps I have made it too confusing both here and also in this previous topic.

                  All I want to do is iterate through model entities to make each component and group a javascript array element, each with its own array of name/value couplets at least for xPos, yPos, zPos, xRot, yRot, zRot. The xyz business seems OK, where in an animation, for example, I can compare one entity's position with a new position to determine the translation. I want to do the same with rotations around each of the axes.

                  Sorry if I'm being rather painful, but I am sure a good result will help the mantra below.

                  Chris

                  With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    Jim
                    last edited by

                    Chris,

                    Z_AXIS, X_AXIS, and Y_AXIS are constants that are the vectors of SketchUp's global axes.

                    Here's a screenshot of a cube rotated 45 deg around the Z axis.

                    And I just noticed I said to use .degrees in an earlier post, sorry; it's .radians.


                    2009-02-26_221659.jpg

                    Hi

                    1 Reply Last reply Reply Quote 0
                    • chrisglasierC Offline
                      chrisglasier
                      last edited by

                      @jim said:

                      Chris,

                      Z_AXIS, X_AXIS, and Y_AXIS are constants that are the vectors of SketchUp's global axes.

                      Here's a screenshot of a cube rotated 45 deg around the Z axis.

                      And I just noticed I said to use .degrees in an earlier post, sorry; it's .radians.

                      Jim I think the fog maybe clearing ... many thanks ... chris

                      With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                      1 Reply Last reply Reply Quote 0
                      • chrisglasierC Offline
                        chrisglasier
                        last edited by

                        I made a skp, rb, html set to test what I understand so far about transformations on a 3x4x5 metre group. If you want to try it out temporarily unzip the files to your plugin directory.

                        transformations.zip

                        Here is a clip of it showing a group rotating around each of the axes in turn:

                        [flash=425,344:32q3oq38]http://www.youtube.com/v/aXxkHu7gSv4[/flash:32q3oq38]

                        The rotations are made with:

                        tr = Geom::Transformation.rotation(Geom::Point3d.new(ent.bounds.center), rv, theDegrees), where rv is the axis,

                        and the angle_between values with:

                        (t.xaxis.angle_between X_AXIS).radians

                        • same for y and z.

                        From this, I gather if the angle_between values returned are 0-180-180, the group has been turned by 180 deg on the X_AXIS; and if 0_90_90, the group could have been turned 90 or 270 (-90) degs on the X_AXIS; and the same for the angle_between values for the other axis rotations.

                        The second clip shows the application of different series of rotations:

                        [flash=425,344:32q3oq38]http://www.youtube.com/v/TFAnDrHXaIg[/flash:32q3oq38]

                        Screenshots of rotations providing angle_between values of 90-90-90 shows there is either something fundamental missing or perhaps that an entirely different method is appropriate.

                        angle_between 90 90 90.jpg

                        Any suggestions about this most welcome...

                        Chris

                        With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                        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