summaryrefslogtreecommitdiff
path: root/src/cairo-pen.c
diff options
context:
space:
mode:
authorBertram Felgenhauer <int-e@gmx.de>2005-08-22 16:29:56 +0000
committerBertram Felgenhauer <int-e@gmx.de>2005-08-22 16:29:56 +0000
commitc7a35fbd3121f728ff40706cdf2a1ef8ac8e18a6 (patch)
tree881d1f166d99b1ce669d8d0da62fd01de24c9dbf /src/cairo-pen.c
parent46dd21e795549481d9db8d90c399e683ef1205c7 (diff)
downloadcairo-c7a35fbd3121f728ff40706cdf2a1ef8ac8e18a6.tar.gz
use correctly transposed version of the matrix and fix up the comments above to use row vector notation.
Diffstat (limited to 'src/cairo-pen.c')
-rw-r--r--src/cairo-pen.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/cairo-pen.c b/src/cairo-pen.c
index 18b9ddb59..cad09fa6a 100644
--- a/src/cairo-pen.c
+++ b/src/cairo-pen.c
@@ -192,7 +192,7 @@ The letter t is used to represent the greek letter theta.
2. The question has been posed: What is the maximum expansion factor
achieved by the linear transformation
-X' = _R_ X
+X' = X _R_
where _R_ is a real-valued 2x2 matrix with entries:
@@ -246,7 +246,9 @@ circle on which X is constrained is to be parameterized by t:
Thus
- X'(t) = (a*cos(t) + b*sin(t), c*cos(t) + d*sin(t)) .
+ X'(t) = X(t) * _R_ = (cos(t), sin(t)) * [a b]
+ [c d]
+ = (a*cos(t) + c*sin(t), b*cos(t) + d*sin(t)).
Define
@@ -254,22 +256,22 @@ Define
Thus
- r^2(t) = (a*cos(t) + b*sin(t))^2 + (c*cos(t) + d*sin(t))^2
- = (a^2 + c^2)*cos^2(t) + (b^2 + d^2)*sin^2(t)
- + 2*(a*b + c*d)*cos(t)*sin(t)
+ r^2(t) = (a*cos(t) + c*sin(t))^2 + (b*cos(t) + d*sin(t))^2
+ = (a^2 + b^2)*cos^2(t) + (c^2 + d^2)*sin^2(t)
+ + 2*(a*c + b*d)*cos(t)*sin(t)
Now apply the double angle formulae (A) to (C) from above:
r^2(t) = (a^2 + b^2 + c^2 + d^2)/2
- + (a^2 - b^2 + c^2 - d^2)*cos(2*t)/2
- + (a*b + c*d)*sin(2*t)
+ + (a^2 + b^2 - c^2 - d^2)*cos(2*t)/2
+ + (a*c + b*d)*sin(2*t)
= f + g*cos(u) + h*sin(u)
Where
f = (a^2 + b^2 + c^2 + d^2)/2
- g = (a^2 - b^2 + c^2 - d^2)/2
- h = (a*b + c*d)
+ g = (a^2 + b^2 - c^2 - d^2)/2
+ h = (a*c + b*d)
u = 2*t
It is clear that MAX[ |X'| ] = sqrt(MAX[ r^2 ]). Here we determine MAX[ r^2 ]
@@ -377,12 +379,12 @@ _cairo_pen_vertices_needed (double tolerance,
double a = matrix->xx, b = matrix->yx;
double c = matrix->xy, d = matrix->yy;
- double i = a*a + c*c;
- double j = b*b + d*d;
+ double i = a*a + b*b;
+ double j = c*c + d*d;
double f = 0.5 * (i + j);
double g = 0.5 * (i - j);
- double h = a*b + c*d;
+ double h = a*c + b*d;
/*
* compute major and minor axes lengths for