Yes - all geometry in PDF is Cartesian.  It makes more sense that way :).

Leonard

From: FDnC Red <fdnc...@yahoo.com<mailto:fdnc...@yahoo.com>>
Reply-To: FDnC Red <fdnc...@yahoo.com<mailto:fdnc...@yahoo.com>>, Post here 
<itext-questions@lists.sourceforge.net<mailto:itext-questions@lists.sourceforge.net>>
Date: Thursday, September 18, 2014 at 12:42 PM
To: Post here 
<itext-questions@lists.sourceforge.net<mailto:itext-questions@lists.sourceforge.net>>
Subject: Re: [iText-questions] [SPAM] Re: CTM + re

Thanks Michael.  I guess another way of saying what you said is that the points 
returned from the content stream are Cartesian points.  I keep forgetting PDF 
puts 0,0 in the BL instead of TL.

So in order to calculate all four points for the rectangle I should be able to 
do something like this, right?

41.906 201.086 0.936 -69.448 re

Top Left X = x = 41.906
Top Left Y = y + height = 201.086 + -69.448  (yes, i'm a bit confused by the 
negative height)
Bottom Right X = x + width = 41.906 + 0.936
Bottom Right Y = y = 201.086

Then do the matrix math on the TL points then the BR points.

Thanks,
Darren




On Thursday, September 18, 2014 9:42 AM, mkl 
<m...@wir-sind-cool.org<mailto:m...@wir-sind-cool.org>> wrote:


Darren,

FDnC Red wrote
> 1) Am I transforming this rectangle by the matrix correctly?

Well, you are not transforming the rectangle but merely the two corner
points on one diagonal (rectXPt, rectYPt) and (tempEndXPt, tempEndYPt).

In case you merely want to consider transformations like the one in your
message, i.e.

> 1.1342565 0 0 1.199793 0 0 cm

only transforming those two points suffices because this transformation
matrix only scales but neither rotates nor skews. Thus, you know the
transformed rectangle will have edges parallel to the x and y axis
respectively.

If you want to consider generic transformations which may rotate or skew,
though, you'll have to transform all four points (well, it actually suffices
to transform three because the image of the rectangle will still be some
parallelogram which allows you to calculate the fourth point using the other
three points).


> 2) Is there an easier way?


It depends on your definition of "easier". If you are well acquainted with
linear algebra, writing it using the iText Vector and Matrix classes might
look more intuitive. The calculations behind the scenes are the same,
though.

Regards,  Michael



--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/CTM-re-tp4660398p4660401.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net<mailto:iText-questions@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php



------------------------------------------------------------------------------
Slashdot TV.  Video for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to