4 Replies Latest reply on Sep 16, 2012 2:36 AM by David_Entwistle

    Isometric transformation

    David_Entwistle Level 1

      In the hope that this will be a considerable boon to mankind, I'm trying to write a script to convert orthogonal ('normal-looking') artwork into any of four isometric views.

       

      The sequence to achieve any of the four views is:

       

      • vertical scale (86.602%)

      • shear (30° or –30°)

      • rotate (30° or –30°)

       

      The vertical scale and rotate operations look straightforward enough; but the shear needs a transform matrix that is nowhere to be found in Adobe's Javascript documentation. (Or indeed anywhere on the web, so it seems.)

       

      I am not much of a mathematician, and (in England, at any rate) a shear transform matrix would come under the heading of Very Hard Sums.

       

      Can someone with more acquaintance with math help out?

       

      Many thanks.

        • 1. Re: Isometric transformation
          W_J_T Level 4

          I have been at odds with the matrix as well. ;-)

          David_Entwistle wrote:

           

          transform matrix that is nowhere to be found in Adobe's Javascript documentation. (Or indeed anywhere on the web, so it seems.)

          Maybe this will help? Its concerning Flash but its dealing with Transform Matrix and should be quite relative to illustrators matrix I think? http://www.senocular.com/flash/tutorials/transformmatrix/

          • 2. Re: Isometric transformation
            David_Entwistle Level 1

            Thank you - that reference looks very comprehensive. I'll look through it and see if I can apply it. (But neither of us should hold their breath meanwhile!)

            • 3. Re: Isometric transformation
              Muppet Mark Level 5

              Matrix are quite weird I must admit… The app does however give you some built-in methods to obtaining this math… Here is an example of a couple that may help you get your head around it… each matrix's values are wrote to the console so you can see the values… Try with a simple rectangle… Unfortunatly these are not live but applied…

               

              #target illustrator
              
              transformStuff();
              
              function transformStuff() {
                
                        var doc, i, p, m, sM,rM, srM;
              
                        doc = app.activeDocument;
              
                        p = doc.pageItems[0];
              
                        m = app.getIdentityMatrix();
              
                        for ( i in m ) { $.writeln( m[i] ); }
              
                        p.transform( m ); app.redraw();
                
                        alert( 'Does Nothing…' ); app.undo();
              
                        sM = app.getScaleMatrix( 100, 86.602 );
              
                        for ( i in sM ) { $.writeln( sM[i] ); }
                
                        p.transform( sM ); app.redraw();
                
                        alert( 'Scaled…' ); app.undo();
              
                        rM = app.getRotationMatrix( 30 );
              
                        for ( i in rM ) { $.writeln( rM[i] ); }
                
                        p.transform( rM ); app.redraw();
                
                        alert( 'Rotated…' ); app.undo();
              
                        srM = concatenateMatrix( sM, rM );
              
                        for ( i in srM ) { $.writeln( srM[i] ); }
                
                        p.transform( srM ); app.redraw();
                
                        alert( 'Scaled & Rotated…' );
                
              };
              
              1 person found this helpful
              • 4. Re: Isometric transformation
                David_Entwistle Level 1

                Hi Mark

                 

                Thank you - that welcome chunk of code promises to be very helpful. Since I last wrote I've learned that it's possible to carry out a shear by combining a rotation with a non-uniform scale, both of which are covered by your code. The question I now need to address is how much rotation and scale add up to a shear of 30°! Will write again when I've made progress.

                 

                Thanks again for your generosity.