开发者

How to find out the coordinates of rotated textframe

With the help of (idml) itemtransform horizontal / vertical distances and path point arrays, I can find out the coordinates of text frame (x1,y1), (x2,y2), (x3,y3), (x4,y4). If the textframe is rotated then item transform values are getting changed, but the path point array values are same. I can find rotation angle by the matrix [cos(θ) sin(θ) -sin(θ) cos(θ) 0 0], But I could not get the exact coordinates of rotated textframe. The textframes are given below.

Normal Text frame

  <TextFrame Self="u136" ParentStory="u124" ItemTransform="1 0 0 1 101.72727272727272 -349.41818181818184">
        <Properties>
            <PathGeometry>
                <GeometryPathType PathOpen="false">
                    <PathPointArray>
                        <PathPointType Anchor="-101.72727272727272 -46.581818181818164" LeftDirection="-101.72727272727272 -46.581818181818164" RightDirection="-101.72727272727272 -46.581818181818164"/>
                        <PathPointType Anchor="-101.72727272727272 -0.3272727272727103" LeftDirection="-101.72727272727272 -0.3272727272727103" RightDirection="-101.72727272727272 -0.3272727272727103"/>
                        <PathPointType Anchor="115.9090909090909 -0.3272727272727103" LeftDirection="115.9090909090909 -0.3272727272727103" RightDirection="115.9090909090909 -0.3272727272727103"/>
                        <PathPointType Anchor="115.9090909090909 -46.581818181818164" LeftDirection="115.9090909090909 -46.581818181818164" RightDirection="115.9090909090909 -46.581818181818164"/>
                    </PathPointArray>
                </GeometryPathType>
            </PathGeometry>
        </Properties>         

Rotated textframe

 <TextFrame Self="u136" ParentStory="u124" ItemTransform="0 1 -1 0 320.3805483338268 -125.07900895050204">
        <Properties>
            <PathGeometry>
                <GeometryPathType PathOpen="false">
                    <PathPointArray>
                        <PathPointType Anchor="-101.72727272727272 -46.581818181818164" LeftDirection="-101.72727272727272 -46.581818181818164" RightDirection="-101.72727272727272 -46.581818181818164"/>
                        <PathPointType Anchor="-101.72727272727272 -0.3272727272727103" LeftDirection="-101.72727272727272 -0.3272727272727103" RightDirection="-101.72727272727272 -0.3272727272727103"/>
           开发者_Python百科             <PathPointType Anchor="115.9090909090909 -0.3272727272727103" LeftDirection="115.9090909090909 -0.3272727272727103" RightDirection="115.9090909090909 -0.3272727272727103"/>
                        <PathPointType Anchor="115.9090909090909 -46.581818181818164" LeftDirection="115.9090909090909 -46.581818181818164" RightDirection="115.9090909090909 -46.581818181818164"/>
                    </PathPointArray>
                </GeometryPathType>
            </PathGeometry>
        </Properties>        

When I converted the values of rotated textframe in to coordinates and drawn in a screen then I am not getting the exact position where it drawn in the original.

Can anyone help me to find out the cordinates of rotated textframe.

Thanks in advance.


The values in the TextFrame's ItemTransform property (a b c d e f) represent a 2D-space transformation matrix for transforming from the TextFrame's inner coordinate system back to the parent coordinate system according to the following matrix multiplication formula:

| Xparent |   | a  c  e |   | X |
| Yparent | = | b  d  f | * | Y |
| 1       |   | 0  0  1 |   | 1 |

Where X, Y are the coordinates in the TextFrame's inner coordinate system and Xparent and Yparent are the corresponding ones in the parent (Spread, etc.) coordinate system.

For more information see 7 Coordinate Systems, Transformations and Units

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜