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

Maruan Sahyoun commented on PDFBOX-1960:
----------------------------------------

Hi John,

the result of the PDFBox Matrix is correct calculating it by hand and using
http://www.wolframalpha.com/input/?i=%7B%7B2%2C0%2C0%7D%2C%7B0%2C2%2C0%7D%2C%7B1.251%5E-12%2C1684%2C1%7D%7D.%7B%7B0.6%2C0%2C0%7D%2C%7B0%2C0.6%2C0%7D%2C%7B302.6%2C1091.38%2C1%7D%7D
which is m1 is multiplied with m2.

Interestingly if you multiply m2 with m1 (so change the order) you’ll get the 
result of the AffineTransform version. Checked by hand and with 
http://www.wolframalpha.com/input/?i=%7B%7B0.6%2C0%2C0%7D%2C%7B0%2C0.6%2C0%7D%2C%7B302.6%2C1091.38%2C1%7D%7D.%7B%7B2%2C0%2C0%7D%2C%7B0%2C2%2C0%7D%2C%7B1.251%5E-12%2C1684%2C1%7D%7D

So the order is different. You’ll get the same result from AffineTransform if 
you use at1.preConcatenate(at2) instead.

> Matrix is wrong
> ---------------
>
>                 Key: PDFBOX-1960
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1960
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 1.8.4, 2.0.0
>            Reporter: John Hewson
>            Assignee: Maruan Sahyoun
>            Priority: Critical
>
> I've been driven insane recently by trying to get pattern fills to render 
> correctly. Patterns have their own matrix which is concatenated to the CTM 
> and no matter how I applied the transformation, the results were wrong.
> It turns out that org.apache.pdfbox.util.Matrix is not behaving as expected, 
> here's an example from a pattern I'm working on. I performed the same 
> concatenation (i.e. multiplication) using our Matrix and Java's 
> AffineTransform, the results are as follows:
> Java AffineTransform:
> [[2.0, 0.0, 1.251E-12], [0.0, 2.0, 1684.0]] *
> [[0.6, 0.0, 302.6], [0.0, 0.6, 1091.38]] =
> [[1.2, 0.0, 605.2000000000013], [0.0, 1.2, 3866.76]]
> PDFBox Matrix:
> [[2.0,0.0,0.0][0.0,2.0,0.0][1.251E-12,1684.0,1.0]] *
> [[0.6,0.0,0.0][0.0,0.6,0.0][302.6,1091.38,1.0]] =
> [[1.2,0.0,0.0][0.0,1.2,0.0][302.6,2101.78,1.0]]
> I suggest that we remove Matrix and replace it with AffineTransform.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to