[ 
https://issues.apache.org/jira/browse/PDFBOX-4597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16890124#comment-16890124
 ] 

Michael Klink edited comment on PDFBOX-4597 at 7/22/19 1:53 PM:
----------------------------------------------------------------

{quote}[~tilman] (to add to the mystery, results for non quadrant rotations are 
undefined).
{quote}
Well, an attempt is made to treat transformations that dominantly are scaled 
rotations (scaling in x and y directions may differ) as the underlying 
rotation. This intends to select the multiple of 90° nearest to the actual 
direction as long as the result is not mirrored or too badly skewed. Otherwise 
there is a default of 0°.

Thus, the results are not _undefined_. For some borderline values, though, the 
result might not really be intuitive...

IMO a better implementation would have been to calculate the actual text 
direction angle (i.e. apply the matrix to (1,0,1) and (0,0,1) and calculate the 
atan of the difference), select the nearest multiple of 90°; then calculate the 
determinant; if it is negative, add 180° (mod 360°).

But now changing it might break some applications.


was (Author: mkl):
{quote}[~tilman] (to add to the mystery, results for non quadrant rotations are 
undefined).
{quote}
Well, an attempt is made to treat transformations that dominantly are scaled 
rotations (scaling in x and y directions may differ) as the underlying 
rotation. This intends to select the multiple of 90° nearest to the actual 
direction as long as the result is not mirrored or too badly skewed. Otherwise 
there is a default of 0°.

Thus, the results are not _undefined_. For some borderline values, though, the 
result might not really be intuitive...

IMO a better implementation would have been to calculate the actual text 
direction angle (i.e. apply the matrix to (1,0,1) and calculate the atan), 
select the nearest multiple of 90°; then calculate the determinant; if it is 
negative, add 180° (mod 360°).

But now changing it might break some applications.

> TextPosition.getX() vs getXDirAdj()
> -----------------------------------
>
>                 Key: PDFBOX-4597
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4597
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Documentation, Text extraction
>    Affects Versions: 2.0.15
>            Reporter: Gili
>            Priority: Major
>         Attachments: rot90.pdf
>
>
> Please explain the difference between "page rotation adjusted coordinates" 
> and "text direction adjusted coordinates" as referenced by the TextPosition 
> class. You can add an explanation (ideally a visual one) to the class or 
> method Javadoc.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to