Skip to main content
Participant
September 27, 2011
Question

Return value from ITransform::GetItemRotationAngle() and ITransform::GetItemSkewAngle()

  • September 27, 2011
  • 1 reply
  • 779 views

Hi,

To figure out the ratation and skew angle of a page item, I used the ITransform interface on the page item, and call GetItemRatationAngle() and GetItemSkewAngle().

InterfacePtr<ITransform> itransform(pageItemUIDRef, UseDefaultIID());

PMReal rotation = itransform->GetItemRatationAngle();

PMReal skew = itransform->GetItemSkewAngle();

However, these API calls are not returning the values I expect. For example, if I make these calls on a box rotated by 30 degrees and then skewed by 10 degree, Instead of 30 and 10, the GetItemRatationAngle() returns 330, and the GetItemSkewAngle() returns -10.

Can someone confirm this and offer an explanation on this behavior?

Thanks,

Mingjian Song

This topic has been closed for replies.

1 reply

Inspiring
September 28, 2011

I am using as follow, y-axis is down.

double angle = 360.0 - ToDouble (transform->GetItemRotationAngle());

if (angle >= 360.0) angle -= 360.0;

double skewAngle = 360.0 - ToDouble(transform->GetItemSkewAngle());

if (skewAngle >= 360.0) skewAngle -= 360.0;

M_J_SongAuthor
Participant
September 28, 2011

Norio,

Thank you for the reply. It is certainly helpful. I have modified your algorithm so the eventual values will always match what are visible in the UI.

     PMReal angle = 360.0 - transform->GetItemRotationAngle();

     if(angle > 180.0)

         angle -= 360;

     PMReal skew = - transform->GetItemSkewAngle();

Still, I am curious to know what is the explanation for such behavior in these two APIs. If they are actual bugs, the client code will break once the fix comes in. I would have to monitor their behavior in future SDK upgrades.

Inspiring
September 28, 2011

Your code is same as result.

I am using this algorithm from InDesign 2.0 to InDesign CS5.5.

I think this is API spec.