3 Replies Latest reply on Feb 18, 2014 9:49 AM by W_J_T

    Shear / Skew using shear angle and axis angle

    mCharlesrk

      Hi,

       

      I want to skew/shear the selected object using shear angle and axis angle.

       

      I am using below code for shear the object,

       

      var skewMatrix = app.getIdentityMatrix();

      skewMatrix..mValueB = .5

       

      But i dont know how to apply the axis angle with this matrix.

       

      any hints?

        • 1. Re: Shear / Skew using shear angle and axis angle
          pixxxel schubser Level 5

          Searching for "shear" gives you the answer.

           

           

           

          You can find a script snippet, written by CarlosCanto

          http://forums.adobe.com/message/5477878#5477878

           

          // skew or shear selection, carlos canto 07/04/13
          // http://forums.adobe.com/message/5475881#5475881
           
          var idoc = app.activeDocument;
          var sel = idoc.selection[0];
           
           
          var im = app.getIdentityMatrix();
           
          //im.mValueB = .5; // skew y 50%
          im.mValueC = .5; // skew x 50%
           
           
          sel.transform (im, true, true, true, true, 1, undefined);
          

           

           

          Have fun

           

          • 2. Re: Shear / Skew using shear angle and axis angle
            mCharlesrk Level 1

            Thanks for your response....

             

            This will shear the object horizantaly/Verticaly , but i need to know how to apply axis angle to shear the object.

             

             

            Update the matrix value c ( im.mValueC ) to Shear the object horizantaly

             

            Update the matrix value b ( im.mValueB) to Shear the object verticaly

             

            But, How to shear the object using axis angle. for example i want to skew the object by shear angle 147 degree with axis angle 18 degree.

             

             

            shear.jpg

             

            Thanks in advance.

            • 3. Re: Shear / Skew using shear angle and axis angle
              W_J_T Level 4

              mCharlesrk wrote:

               

              How to shear the object using axis angle.

               

              Perhaps you want: concatenateRotationMatrix

               

              var doc = app.activeDocument;
              var sel = doc.selection[0];
              var m = app.getIdentityMatrix();
              m.mValueC = .5
              var m2 = concatenateRotationMatrix(m, 25);
              sel.transform(m2, true, true, true, true, 1, Transformation.CENTER);
              

               

              concatenateRotationMatrix.png

               

              Hopefully that helps towards your desired end result?