1 (* Content-type: application/vnd.wolfram.mathematica *)
3 (*** Wolfram Notebook File ***)
4 (* http://www.wolfram.com/nb *)
6 (* CreatedBy='Mathematica 9.0' *)
9 (* Internal cache information:
10 NotebookFileLineBreakTest
11 NotebookFileLineBreakTest
12 NotebookDataPosition[ 157, 7]
13 NotebookDataLength[ 8384, 285]
14 NotebookOptionsPosition[ 7404, 248]
15 NotebookOutlinePosition[ 7739, 263]
16 CellTagsIndexPosition[ 7696, 260]
19 (* Beginning of Notebook Content *)
22 "The view \[OpenCurlyDoubleQuote]scale about point\[CloseCurlyDoubleQuote] \
23 transformation\nmx, my is mouse coordinates ",
24 StyleBox["relative to the view",
26 "\nx, y, w, h are current view coordinates ",
27 StyleBox["relative to the document",
29 "\nX, Y, W, H are transformed coordinates\nThis operation cannot be \
30 represented as a 2D matrix operation..."
32 CellChangeTimes->{{3.621645547391625*^9, 3.621645590446886*^9}, {
33 3.621645788609687*^9, 3.621645803583606*^9}}],
37 RowBox[{"vx", " ", "=", " ",
39 RowBox[{"w", " ", "*", "mx"}], " ", "+", " ", "x"}]}],
40 ";"}], "\[IndentingNewLine]",
42 RowBox[{"vy", " ", "=", " ",
44 RowBox[{"h", " ", "*", " ", "my"}], " ", "+", " ", "y"}]}],
45 ";"}], "\[IndentingNewLine]",
47 RowBox[{"top", " ", "=", " ",
48 RowBox[{"vy", " ", "-", " ", "y"}]}], ";"}], "\[IndentingNewLine]",
50 RowBox[{"left", " ", "=", " ",
51 RowBox[{"vx", " ", "-", " ", "x"}]}], ";"}], "\[IndentingNewLine]",
53 RowBox[{"top", " ", "=", " ",
54 RowBox[{"top", "*", "s"}]}], ";"}], "\[IndentingNewLine]",
56 RowBox[{"left", " ", "=", " ",
57 RowBox[{"left", " ", "*", " ", "s"}]}], ";"}], "\[IndentingNewLine]",
59 RowBox[{"X", " ", "=", " ",
60 RowBox[{"vx", " ", "-", " ", "left"}]}], ";"}], "\[IndentingNewLine]",
62 RowBox[{"Y", " ", "=", " ",
63 RowBox[{"vy", " ", "-", " ", "top"}]}], ";"}], "\[IndentingNewLine]",
65 RowBox[{"W", " ", "=", " ",
66 RowBox[{"w", "*", "s"}]}], ";"}], "\[IndentingNewLine]",
68 RowBox[{"H", " ", "=", " ",
69 RowBox[{"h", "*", "s"}]}], ";"}]}], "Input",
70 CellChangeTimes->{{3.621644450038117*^9, 3.621644517724819*^9}, {
71 3.6216455001839314`*^9, 3.6216455061448193`*^9}}],
76 RowBox[{"xy1", " ", "=", " ",
80 RowBox[{"x", ",", "y"}], "}"}], ",",
82 RowBox[{"x", "+", "w"}], "}"}], ",",
84 RowBox[{"y", "+", "h"}], "}"}]}], "}"}]}]], "Input",
85 CellChangeTimes->{{3.621645646537537*^9, 3.621645677183116*^9}}],
91 RowBox[{"x", ",", "y"}], "}"}], ",",
93 RowBox[{"w", "+", "x"}], "}"}], ",",
95 RowBox[{"h", "+", "y"}], "}"}]}], "}"}]], "Output",
96 CellChangeTimes->{3.62164567753369*^9}]
102 RowBox[{"xy2", " ", "=", " ",
103 RowBox[{"FullSimplify", "[",
105 RowBox[{"X", ",", " ", "Y", ",", " ",
106 RowBox[{"X", "+", "W"}], ",", " ",
107 RowBox[{"Y", "+", "H"}]}], "}"}], "]"}]}]], "Input",
108 CellChangeTimes->{{3.62164452159755*^9, 3.621644525242661*^9}, {
109 3.621645606946629*^9, 3.621645623731018*^9}, {3.6216456891302*^9,
110 3.621645689867572*^9}}],
119 RowBox[{"s", " ", "w"}]}], ")"}]}], "+", "x"}], ",",
124 RowBox[{"my", " ", "s"}]}], ")"}]}], "+", "y"}], ",",
128 RowBox[{"mx", "+", "s", "-",
129 RowBox[{"mx", " ", "s"}]}], ")"}], " ", "w"}], "+", "x"}], ",",
133 RowBox[{"my", "+", "s", "-",
134 RowBox[{"my", " ", "s"}]}], ")"}]}], "+", "y"}]}], "}"}]], "Output",
136 3.621644525784692*^9, {3.621645598921043*^9, 3.62164562472651*^9}, {
137 3.621645679592589*^9, 3.6216456913785887`*^9}}]
143 RowBox[{"xywh2", " ", "=", " ",
144 RowBox[{"FullSimplify", "[",
146 RowBox[{"X", ",", " ", "Y", ",", " ", "W", ",", "H"}], "}"}],
148 CellChangeTimes->{{3.621645929284232*^9, 3.621645939176342*^9}}],
157 RowBox[{"s", " ", "w"}]}], ")"}]}], "+", "x"}], ",",
162 RowBox[{"my", " ", "s"}]}], ")"}]}], "+", "y"}], ",",
163 RowBox[{"s", " ", "w"}], ",",
164 RowBox[{"h", " ", "s"}]}], "}"}]], "Output",
165 CellChangeTimes->{3.621645939693961*^9}]
169 "For primitives in document,\nV X \[Rule] V X + S[V X - ",
173 SubscriptBox["X", "0"], "]"}], TraditionalForm]],
174 FormatType->"TraditionalForm"],
175 "\nV is view matrix, S is scale matrix"
177 CellChangeTimes->{{3.62164641213169*^9, 3.62164647339319*^9}}],
182 RowBox[{"TODO", ":", " ",
183 RowBox[{"Express", " ", "as", " ", "a", " ", "matrix", " ",
184 RowBox[{"operation", "?"}]}]}], "*)"}], "\[IndentingNewLine]"}]], "Input",\
186 CellChangeTimes->{{3.6216459415176992`*^9, 3.621645948934423*^9}, {
187 3.6216463980527067`*^9, 3.6216464053607597`*^9}}],
190 RowBox[{"ClearAll", "[",
191 RowBox[{"Evaluate", "[",
193 RowBox[{"Context", "[", "]"}], "<>", "\"\<*\>\""}], "]"}], "]"}]], "Input"],
195 Cell["Floating point operations", "Text",
196 CellChangeTimes->{{3.621665522093079*^9, 3.6216655239496813`*^9}}],
199 RowBox[{"FullSimplify", "[",
201 SuperscriptBox["B", "e1"], " ", "*", " ", "m2", " ",
202 SuperscriptBox["B", "e2"]}], "]"}]], "Input",
203 CellChangeTimes->{{3.621665107840431*^9, 3.6216651376842957`*^9}}],
208 RowBox[{"e1", "+", "e2"}]], " ", "m1", " ", "m2"}]], "Input",
209 CellChangeTimes->{{3.62166519824517*^9, 3.62166520820506*^9}}],
214 RowBox[{"e1", "+", "e2"}]], " ", "m1", " ", "m2"}]], "Output",
215 CellChangeTimes->{{3.621665204836622*^9, 3.621665208534109*^9}}],
220 RowBox[{"FullSimplify", "[",
221 RowBox[{"Solve", "[",
226 SuperscriptBox["B", "e1"]}], " ", "+", " ",
228 SuperscriptBox["B", "e2"]}]}], " ", "\[Equal]", " ",
230 SuperscriptBox["B", "e1"]}]}], ",", " ", "m3"}], "]"}], "]"}]], "Input",\
233 3.621665148857037*^9, {3.621665392367518*^9, 3.62166542126152*^9}}],
238 RowBox[{"m3", "\[Rule]",
243 RowBox[{"-", "e1"}], "+", "e2"}]], " ", "m2"}]}]}], "}"}],
246 3.621665149470646*^9, {3.621665400108696*^9, 3.621665421774309*^9}}]
249 WindowSize->{740, 575},
250 WindowMargins->{{Automatic, 79}, {Automatic, 0}},
251 FrontEndVersion->"9.0 for Linux x86 (64-bit) (February 7, 2013)",
252 StyleDefinitions->"Default.nb"
254 (* End of Notebook Content *)
256 (* Internal cache information *)
263 (*NotebookFileOutline
265 Cell[557, 20, 546, 12, 110, "Text"],
266 Cell[1106, 34, 1309, 36, 231, "Input"],
268 Cell[2440, 74, 337, 10, 32, "Input"],
269 Cell[2780, 86, 271, 9, 32, "Output"]
272 Cell[3088, 100, 397, 9, 32, "Input"],
273 Cell[3488, 111, 782, 25, 32, "Output"]
276 Cell[4307, 141, 251, 6, 32, "Input"],
277 Cell[4561, 149, 446, 15, 32, "Output"]
279 Cell[5022, 167, 318, 9, 71, "Text"],
280 Cell[5343, 178, 338, 8, 55, "Input"],
281 Cell[5684, 188, 160, 4, 32, "Input"],
282 Cell[5847, 194, 109, 1, 30, "Text"],
283 Cell[5959, 197, 240, 5, 35, "Input"],
284 Cell[6202, 204, 175, 4, 32, "Input"],
285 Cell[6380, 210, 178, 4, 32, "Output"],
287 Cell[6583, 218, 469, 14, 35, "Input"],
288 Cell[7055, 234, 333, 11, 35, "Output"]
294 (* End of internal cache information *)