Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Retrieve/Modify the transformation matrix of an object

Community Beginner ,
Aug 17, 2009 Aug 17, 2009

Hi,

I'm new to this, so I have a lot of questions.

Here is what I am trying to do.

I know the designer I work with will draw some paths on an isometric grid (30 degrees )

I am interested in the paths that get skewed 30 degrees vertically.

I will need to create a 'bottom' plane for the selected path, that means I will need to copy

the object and shear/skew it.

As far as I can tell I need to:

1.retrieve the selected PathItem

2.clone it

3.transform it ( skew/shear ) it.

I've to create a scaleMatrix using

app.getScaleMatrix(Math.atan(30 * Math.PI / 180) * 100,Math.atan(60 * Math.PI/180) * 100);

then transforming my path, but the skew looks pretty random.

I know that in theory

skewX = Math.atan( matrix.c * angleInRadians);

skewY = Math.atan( matrix.b * angleInRadians);

but things aren't as easy to do in Illustrator as they are in Flash

Is it possible to retrieve the transformation matrix of a PathItem ? (I've looked in the docs and found nothing of use )

Any hints ?

TOPICS
Scripting
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
LEGEND ,
Aug 23, 2009 Aug 23, 2009

What exactly is it that you are trying to accomplish with the ScaleMatrix? Are you trying to merely skew a selection by 30 degrees?

If so, do you understand that merely skewing something will not yield the sides of an object drawn in isometric?

For example:

Assume two 1" squares, normally oriented and abutting each other side by side.

Skew the right side of the rightmost square vertically upward 30 degrees.

Skew the left side of the leftmost square vertically upward 30 degrees.

I hope you understand that does not yield the left and right visible sides of a 1" isometric cube. In an isometric cube, all the visible edges are the same length. (In an isometric drawing of a 1" cube, each edge measures 1". In an isometric projection of the same cube, each edge measures approximately .82" [cosine of the isometric angle, 35'16"]).

By merely skewing the squares, you are effectively lengthening their top and bottom edges. The vertical edges are now out of proportion.

You can draw the "bottom" or "top" of a 1" isometric cube by rotating a normally-oriented 1" square 45 degrees and then scaling it vertically by 58% (sine of the iso angle). Then rotate two copies of that about the resulting bottom-most point to complete the cube.

Maybe you know this and I'm misunderstanding what you are trying to do.

JET

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 24, 2009 Aug 24, 2009
LATEST

Thanks!

You mostly understood what I'm trying to do.

The idea is that if I have a rectangle that is skewed ( the left side of an isometrix box for example )

I want to make a copy, unskew it to its original, skew it to turn it into a 'bottom' plane, then scale, position, etc.

I'm trying to make a 'bottom' or 'top' side of an isometric box.

at the moment I'm doing guess work mostly:

var skewMatrix = app.getIdentityMatrix();

skewMatrix.mValueA = 1;
skewMatrix..mValueB = 0.5;
skewMatrix..mValueC = -1;
skewMatrix..mValueD = 0.5;
if(topObject) topObject.transform (skewMatrix.,true,false,false,false,1);

I will do as you advised and try to move the skewed copies in the right place.

Once again, thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines