2150 |
mathias |
1 |
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
|
|
|
2 |
<head>
|
|
|
3 |
<title>Dojo 3D Matrix</title>
|
|
|
4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
5 |
<style type="text/css">
|
|
|
6 |
@import "../../../dojo/resources/dojo.css";
|
|
|
7 |
@import "../../../dijit/tests/css/dijitTests.css";
|
|
|
8 |
</style>
|
|
|
9 |
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
|
|
|
10 |
<script type="text/javascript">
|
|
|
11 |
|
|
|
12 |
dojo.require("dojox.gfx3d");
|
|
|
13 |
|
|
|
14 |
mdebug = function(matrix){
|
|
|
15 |
var m = dojox.gfx3d.matrix.normalize(matrix);
|
|
|
16 |
console.debug("xx: " + m.xx + ", xy: " + m.xy + " | xz:" + m.xz + " | dx:" + m.dx);
|
|
|
17 |
console.debug("yx: " + m.yx + ", yy: " + m.yy + " | yz:" + m.yz + " | dy:" + m.dy);
|
|
|
18 |
console.debug("zx: " + m.zx + ", zy: " + m.zy + " | zz:" + m.zz + " | dz:" + m.dz);
|
|
|
19 |
};
|
|
|
20 |
|
|
|
21 |
pdebug = function(point){
|
|
|
22 |
console.debug("x: " + point.x + ", y: " + point.y + ", z: " + point.z);
|
|
|
23 |
};
|
|
|
24 |
|
|
|
25 |
dojo.addOnLoad(function(){
|
|
|
26 |
var m = dojox.gfx3d.matrix;
|
|
|
27 |
var a = new m.Matrix3D();
|
|
|
28 |
console.debug("identity");
|
|
|
29 |
mdebug(a);
|
|
|
30 |
a = m.rotateXg(30);
|
|
|
31 |
console.debug("rotateXg(30);");
|
|
|
32 |
mdebug(a);
|
|
|
33 |
a = m.rotateYg(45);
|
|
|
34 |
console.debug("rotateYg(45);");
|
|
|
35 |
mdebug(a);
|
|
|
36 |
a = m.rotateZg(90);
|
|
|
37 |
console.debug("rotateZg(90);");
|
|
|
38 |
mdebug(a);
|
|
|
39 |
a = [new m.Matrix3D(), new m.Matrix3D(), new m.Matrix3D()];
|
|
|
40 |
console.debug("identity");
|
|
|
41 |
mdebug(a);
|
|
|
42 |
a = [m.rotateXg(30), m.rotateXg(-30)];
|
|
|
43 |
console.debug("identity");
|
|
|
44 |
mdebug(a);
|
|
|
45 |
var b = m.multiplyPoint(a, 10, 10, 10);
|
|
|
46 |
pdebug(b);
|
|
|
47 |
b = m.multiplyPoint(a, 10, 5, 10);
|
|
|
48 |
pdebug(b);
|
|
|
49 |
b = m.multiplyPoint(a, 10, 15, 5);
|
|
|
50 |
pdebug(b);
|
|
|
51 |
|
|
|
52 |
a = [m.scale(1,1,2), m.rotateXg(45)];
|
|
|
53 |
console.debug("a = [m.scale(1,1,2), m.rotateXg(45)];");
|
|
|
54 |
mdebug(a);
|
|
|
55 |
a = [m.rotateXg(45), m.scale(1,1,2)];
|
|
|
56 |
console.debug("a = [m.rotateXg(45), m.scale(1,1,2)];");
|
|
|
57 |
mdebug(a);
|
|
|
58 |
|
|
|
59 |
a = [m.scale(2,1,2), m.rotateYg(45)];
|
|
|
60 |
console.debug("a = [m.scale(2,1,2), m.rotateYg(45)];");
|
|
|
61 |
mdebug(a);
|
|
|
62 |
a = [m.rotateYg(45), m.scale(2,1,2)];
|
|
|
63 |
console.debug("a = [m.rotateYg(45), m.scale(2,1,2)];");
|
|
|
64 |
mdebug(a);
|
|
|
65 |
|
|
|
66 |
a = [m.scale(1,2,1), m.invert(m.rotateZg(45))];
|
|
|
67 |
console.debug("[m.scale(1,2,1), m.invert(m.rotateZg(45))];");
|
|
|
68 |
mdebug(a);
|
|
|
69 |
a = [m.invert(m.rotateZg(45)), m.scale(1,2,1)];
|
|
|
70 |
console.debug("a = [m.invert(m.rotateZg(45)), m.scale(1,2,1)];");
|
|
|
71 |
mdebug(a);
|
|
|
72 |
|
|
|
73 |
a = [a, m.invert(a)];
|
|
|
74 |
console.debug("identity");
|
|
|
75 |
mdebug(a);
|
|
|
76 |
|
|
|
77 |
a = 5;
|
|
|
78 |
mdebug(a);
|
|
|
79 |
a = [2, m.scale(2,1,3)];
|
|
|
80 |
mdebug(a);
|
|
|
81 |
});
|
|
|
82 |
|
|
|
83 |
</script>
|
|
|
84 |
</head>
|
|
|
85 |
<body>
|
|
|
86 |
<h1>dojox.gfx3d.matrix test</h1>
|
|
|
87 |
<p>Please check the debug console for test results.</p>
|
|
|
88 |
</body>
|
|
|
89 |
</html>
|