
1. Re: [rotation at idml]
John Hawkinson Mar 13, 2012 9:41 PM (in response to Alfred Angkasa)You need to read the IDML Specification.
This is a bit tricky, though, because you are asking how you find the rotation angle in an affine transformation. What if there is not only rotation but also other transformations? Given an IDML transformation matrix of the form [a b c d e f ], then:
If there is only rotation, then a rotation by angle theta is given as [ cos(theta) sin(theta) sin(theta) cos(theta) 0 0 ] and if there is only translation then it is [ 1 0 0 1 x y ]. So in your case since a=b=c=d, that's a very special case since that only happens at theta=45 degrees. That is cos(45)=sin(45)=sin(45).
The more general case is if a=d and arccos(a)=arcsin(b)=arcsine(c) then you have a pure rotation by arccos(a) degrees (or arcsin(b) if you prefer).
If you have more complicated transformations (i.e. scaling or shearing in addition to rotation), then you'll need more math than I am able to easily summon right now.
Edit: Oops, I wrote 90 degrees where I meant 45 degrees. Sorry.

2. Re: [rotation at idml]
Alfred Angkasa Mar 13, 2012 11:14 PM (in response to John Hawkinson)Hi John,
thanks for your answer. how do i calculate it John?
let's say if i also want to have the scaling, skewing, and translation. how could i calculate?
can you give me an example?
thanks.

3. Re: [rotation at idml]
[Jongware] Mar 14, 2012 3:23 AM (in response to Alfred Angkasa)Look up Transformation Matrix. Scaling, skewing, and translation are exactly the three members (in pairs of x,y) of a matrix, as John already told you.

4. Re: [rotation at idml]
John Hawkinson Mar 14, 2012 8:24 AM (in response to Alfred Angkasa)Jongware wrote:
Look up Transformation Matrix. Scaling, skewing, and translation are exactly the three members (in pairs of x,y) of a matrix, as John already told you.
Unfortunately this is not helpful. Because if you have these operations going on at the same time, it's necessary to decompose the matrix into the product of the scaling matrix, the skewing matrix, the translation matrix, and the rotation matrix. And that is not explained by the IDML spec.
Alfred:
thanks for your answer. how do i calculate it John?
I'm sorry, I thought I was clear. After verifying that it is solely a rotation, you take the arc cosine of the first number (or the arc sine of the second number).
The arcsine of .707 is 45 degrees.
let's say if i also want to have the scaling, skewing, and translation. how could i calculate?
I think you probably need to go take a class in linear algebra, matrices, and computer graphics and come back.
I asked some colleagues who understand this stuff this question last night and after 2 and a half hours and several edits to Wikipedia, they came back with a closedform expression for the rotation. Unfortunately their answer seems to be wrong.
Maybe you should tell us why you thnk you need this.

5. Re: [rotation at idml]
[Jongware] Mar 14, 2012 12:03 PM (in response to John Hawkinson)Uh, wait. Isn't this thekind of math problem where there may be more than one possible answer?

6. Re: [rotation at idml]
John Hawkinson Mar 14, 2012 12:43 PM (in response to [Jongware])They gave me a different answer this morning, but that one was wrong too [sigh], btw.
[Jongware] wrote:
Uh, wait. Isn't this thekind of math problem where there may be more than one possible answer?
Well, yes and no. I think there are multiple answers, but there is an easy rule to choose between them, or there is a "canonical representation" or "normal form."
This is not solely because: "Transformations are applied in the following order: scale, shear, rotate, translate."

7. Re: [rotation at idml]
John Hawkinson Mar 14, 2012 2:36 PM (in response to John Hawkinson)Hmm. Well, I think one of the simpler answers you'll get is for an IDML transform of [a b c d e f], you can expect the rotation angle to be given by the arctangent((cb)/(a+d)).
That's about 5 times simpler than the expresison I tried before.
But in the presence of skew (shear) some of the skew will make it into the rotation, and that might not give you waht you want.

8. Re: [rotation at idml]
Alfred Angkasa Mar 14, 2012 10:56 PM (in response to Alfred Angkasa)Hi John & [Jongware], sorry for the late reply..
i need that to calculate the angle. but now i just tried to get the first matrix (m11) to calculate the angle.
and now, how about the center point?
i have a spread. inside a spread, i have 3 pages. can i know where is the center point? is it (0,0) in the middle? i mean by calculate the total width of the page and divide by pages count, total height divide by pages count.. is that true?? or still false?? thanks.

9. Re: [rotation at idml]
John Hawkinson Mar 14, 2012 11:02 PM (in response to Alfred Angkasa)i need that to calculate the angle. but now i just tried to get the first matrix (m11) to calculate the angle.
I'm sorry, I do not understand the question.
and now, how about the center point?
IDML does not deal with the center point, only the boundary corners. You will have to determine the center point yourself. This may be difficult for nonpolygons.
i have a spread. inside a spread, i have 3 pages. can i know where is the center point? is it (0,0) in the middle? i mean by calculate the total width of the page and divide by pages count, total height divide by pages count.. is that true?? or still false?? thanks.
I don't know offhand. This is trivial to test. So test it!!
The IDML spec reads:
The origin of the spread coordinate system is located at center of the spread. The left edge of the
first right hand page in the spread aligns with the horizontal center of the spread; the right edge of
the first left hand page in the spread appears to the left. The vertical centers of the pages align with
the vertical center of the spread. Each spread has its own coordinate system origin.
Did you read it before posting?

10. Re: [rotation at idml]
Alfred Angkasa Mar 14, 2012 11:19 PM (in response to John Hawkinson)John Hawkinson wrote:
i need that to calculate the angle. but now i just tried to get the first matrix (m11) to calculate the angle.
I'm sorry, I do not understand the question.
and now, how about the center point?
IDML does not deal with the center point, only the boundary corners. You will have to determine the center point yourself. This may be difficult for nonpolygons.
i have a spread. inside a spread, i have 3 pages. can i know where is the center point? is it (0,0) in the middle? i mean by calculate the total width of the page and divide by pages count, total height divide by pages count.. is that true?? or still false?? thanks.
I don't know offhand. This is trivial to test. So test it!!
The IDML spec reads:
The origin of the spread coordinate system is located at center of the spread. The left edge of the
first right hand page in the spread aligns with the horizontal center of the spread; the right edge of
the first left hand page in the spread appears to the left. The vertical centers of the pages align with
the vertical center of the spread. Each spread has its own coordinate system origin.
Did you read it before posting?
btw read in where?? in the specification document??
i'm new with indesign, so i'm still confused about itu.
that's mean the spread coordiante system is located at the center of the spread.
for example. i have 1 spread with 2 pages.
page no 1, width = 111 and height = 333
page no 2, width = 222 and height = 444
so the center of the spread is (111+222)/2 and (333+444)/2)?
(111+222)/2 for x,
(333+444)/2) for y?

11. Re: [rotation at idml]
John Hawkinson Mar 14, 2012 11:30 PM (in response to Alfred Angkasa)btw read in where?? in the specification document??
Yes.
that's mean the spread coordiante system is located at the center of the spread.
for example. i have 1 spread with 2 pages.
It certainly means that for a single page spread or a 2page spread, such as your example. For a 3page spread I am less certain, but I would expect it means the center of the center page. But again, it is trivial to test. So please test it!

12. Re: [rotation at idml]
Alfred Angkasa Mar 15, 2012 12:09 AM (in response to John Hawkinson)John Hawkinson wrote:
btw read in where?? in the specification document??
Yes.
that's mean the spread coordiante system is located at the center of the spread.
for example. i have 1 spread with 2 pages.
It certainly means that for a single page spread or a 2page spread, such as your example. For a 3page spread I am less certain, but I would expect it means the center of the center page. But again, it is trivial to test. So please test it!
okay.. thanks John..