gpt4 book ai didi

PDF 1.7 - CTM(电流转换矩阵)究竟是如何工作的?

转载 作者:行者123 更新时间:2023-12-04 02:10:00 24 4
gpt4 key购买 nike

看完Adobe PDF 1.7 (ISO 32000-1:2008) specification ,我仍然无法理解如何正确创建我的转换矩阵。

第 4.2/4.3 节中的规范声明如下:

• Translations are specified as [ 1 0 0 1 tx ty ], where tx and ty are the distances to translate the origin of the coordinate system in the horizontal and vertical dimensions, respectively.
• Scaling is obtained by [ sx 0 0 sy 0 0 ]. This scales the coordinates so that 1 unit in the horizontal and vertical dimensions of the new coordinate system is the same size as sx and sy units, respectively, in the previous coordinate system.
• Rotations are produced by [ cos θ sin θ −sin θ cos θ 0 0 ], which has the effect of rotating the coordinate system axes by an angle θ counterclockwise.
• Skew is specified by [ 1 tan α tan β 1 0 0 ], which skews the x axis by an angle α and the y axis by an angle β.



鉴于此,人们究竟如何按顺序使用转换?

我可以成功使用 TranslationRotation在一起,但是当我尝试也使用 Scaling 时或 Skewing事情发生了严重的错误。也许我使用 CTM 不正确,或者甚至我的数学都关闭了。我试图在坐标位置 (50, 50) 处创建文本,旋转 45 度,缩放比例 2(按此顺序)。我之所以说“按那个顺序”是因为规范指出转换的顺序会有所不同(规范给出了基于转换顺序的差异的图形示例)。那么流对象会是什么样子和/或矩阵数学在这里如何应用?

工作((50, 50) + 45 度旋转的变换)
[ 1  0  0 ]   [  0.707 0.707 0 ]   [  0.707  0.707 0 ]
[ 0 1 0 ] x [ -0.707 0.707 0 ] = [ -0.707 0.707 0 ]
[ 50 50 1 ] [ 0 0 1 ] [ 50.000 50.000 1 ]

BT
0.707 0.707 -0.707 0.707 50 50 Tm
/F1 36 Tf
(Hello, World!) Tj
ET

当我尝试进行矩阵乘法以添加缩放时,它似乎不起作用:
[  0.707  0.707 0 ]   [ 2 0 0 ]   [   1.414   1.414 0 ]
[ -0.707 0.707 0 ] x [ 0 2 0 ] = [ -1.414 1.414 0 ]
[ 50.000 50.000 1 ] [ 0 0 1 ] [ 100.000 100.000 1 ]

数学似乎是正确的,除了现在文本从坐标 (100, 100) 而不是 (50, 50) 开始。这对我来说似乎不正确,因为我试图从 (50, 50) 开始,旋转 45 度,然后将其缩放 2。

最佳答案

The math seems correct, except now the text starts at coordinate (100, 100) instead of (50, 50). This just doesn't seem correct to me, since I'm trying to start at (50, 50), rotate by 45 degrees, then scale it by 2.



但是那个 有道理。如果先按 (50, 50) 进行平移,然后按 2 进行缩放,则可以有效地按 (50, 50) 乘以 2 进行平移,即 (100, 100)。

您似乎需要的是首先按比例缩放两倍(使大小增加两倍,但尚未移动或旋转),然后才进行旋转和平移(不缩放影响平移),即
[ 2 0 0 ]   [  0.707  0.707 0 ]   [   1.414   1.414 0 ]
[ 0 2 0 ] x [ -0.707 0.707 0 ] = [ -1.414 1.414 0 ]
[ 0 0 1 ] [ 50.000 50.000 1 ] [ 50.000 50.000 1 ]

一些挥手:你说的时候想到了什么

I am attempting to create text at coordinate position (50, 50) with a rotation of 45 degrees and a scaling of 2 (in that order).



可以肯定的是,在转换为 (50, 50) 之后,以下操作应该使 (50, 50) 点保持不变。但这不是其他操作所做的,它们保持原点 (0,0) 固定。因此,您应该首先在原点缩放和旋转对象,然后再进行平移,至少要符合您的想法......

关于PDF 1.7 - CTM(电流转换矩阵)究竟是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19908472/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com