22notes: matrices are printed in raw in-memory order, four scalars per line
33
44== matrix constructors and composition ==
5- identity:
6- [
7- +001.000 +000.000 +000.000 +000.000
8- +000.000 +001.000 +000.000 +000.000
9- +000.000 +000.000 +001.000 +000.000
10- +000.000 +000.000 +000.000 +001.000
11- ]
125matrix_a:
136[
147 +001.000 +005.000 +009.000 +013.000
@@ -18,287 +11,22 @@ matrix_a:
1811]
1912matrix_b:
2013[
21- +000.500 +001.500 -003.000 +000.000
22- -001.000 +000.750 +004.000 +001.000
23- +002.000 -000.500 +001.250 -001.500
24- +000.250 +002.000 -002.500 +003.000
25- ]
26- scale:
27- [
28- +002.000 +000.000 +000.000 +000.000
29- +000.000 +003.000 +000.000 +000.000
30- +000.000 +000.000 +004.000 +000.000
31- +000.000 +000.000 +000.000 +001.000
32- ]
33- translate:
34- [
35- +001.000 +000.000 +000.000 +000.000
36- +000.000 +001.000 +000.000 +000.000
37- +000.000 +000.000 +001.000 +000.000
38- +010.000 +020.000 +030.000 +001.000
39- ]
40- rotate_x:
41- [
42- +001.000 +000.000 +000.000 +000.000
43- +000.000 +000.799 +000.602 +000.000
44- +000.000 -000.602 +000.799 +000.000
45- +000.000 +000.000 +000.000 +001.000
46- ]
47- rotate_y:
48- [
49- +000.921 +000.000 +000.391 +000.000
50- +000.000 +001.000 +000.000 +000.000
51- -000.391 +000.000 +000.921 +000.000
52- +000.000 +000.000 +000.000 +001.000
53- ]
54- rotate_z:
55- [
56- +000.326 +000.946 +000.000 +000.000
57- -000.946 +000.326 +000.000 +000.000
58- +000.000 +000.000 +001.000 +000.000
59- +000.000 +000.000 +000.000 +001.000
60- ]
61- pure_rotation = rotate_z * rotate_y * rotate_x:
62- [
63- +000.300 +000.870 +000.391 +000.000
64- -000.832 +000.038 +000.554 +000.000
65- +000.467 -000.491 +000.735 +000.000
66- +000.000 +000.000 +000.000 +001.000
67- ]
68- transform = translate * rotate_z * rotate_y * rotate_x * scale:
69- [
70- +000.599 +001.741 +000.781 +000.000
71- -002.495 +000.113 +001.662 +000.000
72- +001.870 -001.964 +002.941 +000.000
73- +010.000 +020.000 +030.000 +001.000
74- ]
75-
76- == matrix multiply ==
77- lhs:
78- [
79- +001.000 +005.000 +009.000 +013.000
80- +002.000 +006.000 +010.000 +014.000
81- +003.000 +007.000 +011.000 +015.000
82- +004.000 +008.000 +012.000 +016.000
83- ]
84- rhs:
85- [
86- +000.500 +001.500 -003.000 +000.000
87- -001.000 +000.750 +004.000 +001.000
88- +002.000 -000.500 +001.250 -001.500
89- +000.250 +002.000 -002.500 +003.000
90- ]
91- lhs * rhs:
92- [
93- -005.500 -009.500 -013.500 -017.500
94- +016.500 +035.500 +054.500 +073.500
95- -001.250 +003.750 +008.750 +013.750
96- +008.750 +019.750 +030.750 +041.750
97- ]
98- rhs * lhs:
99- [
100- +016.750 +026.750 -004.250 +030.500
101- +018.500 +030.500 -004.500 +033.000
102- +020.250 +034.250 -004.750 +035.500
103- +022.000 +038.000 -005.000 +038.000
104- ]
105-
106- == matrix vector multiply ==
107- vec3_input: <+001.250, -002.500, +003.750>
108- vec4_input: <+001.250, -002.500, +003.750, +001.000>
109- transform * vec3: <+023.998, +014.529, +037.849>
110- transform * vec4: <+023.998, +014.529, +037.849, +001.000>
111- rotate_z * vec3: <+002.771, +000.368, +003.750>
112- translate * vec3: <+011.250, +017.500, +033.750>
113-
114- == quaternion constructors ==
115- quat_identity: <+000.000, +000.000, +000.000, +001.000>
116- quat_rotate_x: <+000.317, +000.000, +000.000, +000.948>
117- quat_rotate_y: <+000.000, -000.199, +000.000, +000.980>
118- quat_rotate_z: <+000.000, +000.000, +000.581, +000.814>
119- axis_normalized: <+000.267, +000.535, -000.802>
120- axis_angle_radians: +000.838
121- from_axis_angle: <+000.109, +000.217, -000.326, +000.914>
122- from_axis_angle.mat4:
123- [
124- +000.693 -000.549 -000.468 +000.000
125- +000.643 +000.764 +000.057 +000.000
126- +000.326 -000.340 +000.882 +000.000
127- +000.000 +000.000 +000.000 +001.000
128- ]
129-
130- == quaternion multiply ==
131- quat_x: <+000.317, +000.000, +000.000, +000.948>
132- quat_y: <+000.000, -000.199, +000.000, +000.980>
133- quat_z: <+000.000, +000.000, +000.581, +000.814>
134- quat_multiply(quat_x, quat_y): <+000.311, -000.189, -000.063, +000.929>
135- quat_multiply(quat_multiply(quat_x, quat_y), quat_z): <+000.143, -000.334, +000.488, +000.793>
136- quat_xy.mat4:
137- [
138- +000.921 -000.235 +000.312 +000.000
139- +000.000 +000.799 +000.602 +000.000
140- -000.391 -000.554 +000.735 +000.000
141- +000.000 +000.000 +000.000 +001.000
142- ]
143- quat_xyz.mat4:
144- [
145- +000.300 +000.679 +000.671 +000.000
146- -000.870 +000.482 -000.099 +000.000
147- -000.391 -000.554 +000.735 +000.000
148- +000.000 +000.000 +000.000 +001.000
149- ]
150-
151- == quaternion vector rotate ==
152- input: <+001.250, -002.500, +003.750>
153- quat_rotate(quat_x, input): <+001.250, -004.253, +001.490>
154- quat_rotate(quat_y, input): <-000.315, -002.500, +003.940>
155- quat_rotate(quat_z, input): <+002.771, +000.368, +003.750>
156- quat_rotate(from_axis_angle, input): <+000.482, -003.871, +002.580>
157- quat_z * input: <+002.771, +000.368, +003.750>
158-
159- == matrix quaternion roundtrip ==
160- pure_rotation.quat: <+000.363, +000.027, +000.591, +000.720>
161- pure_rotation:
162- [
163- +000.300 +000.870 +000.391 +000.000
164- -000.832 +000.038 +000.554 +000.000
165- +000.467 -000.491 +000.735 +000.000
166- +000.000 +000.000 +000.000 +001.000
167- ]
168- pure_rotation.quat.mat4:
169- [
170- +000.300 +000.870 +000.391 +000.000
171- -000.832 +000.038 +000.554 +000.000
172- +000.467 -000.491 +000.735 +000.000
173- +000.000 +000.000 +000.000 +001.000
14+ -010.000 +050.000 +090.000 +130.000
15+ -020.000 +060.000 +100.000 +140.000
16+ -030.000 +070.000 +110.000 +150.000
17+ -040.000 +080.000 +120.000 +160.000
17418]
175- transform.rotation_only :
19+ matrix_a * matrix_b :
17620[
177- +000.599 +001.741 +000.781 +000 .000
178- -002.495 +000.113 +001.662 +000 .000
179- +001.870 -001.964 +002.941 + 000.000
180- +000 .000 +000 .000 +000 .000 +001 .000
21+ -900.000 +2020.000 +3140.000 +4260 .000
22+ -1000.000 +2280.000 +3560.000 +4840 .000
23+ -1100.000 +2540.000 +3980. 000 +5420 .000
24+ -1200 .000 +2800 .000 +4400 .000 +6000 .000
18125]
182- transform.rotation_only.quat: <+000.840, +000.252, +000.982, +001.079>
183- axis_mat.quat: <+000.109, +000.217, -000.326, +000.914>
184- axis_mat.quat.mat4:
26+ matrix_b * matrix_a:
18527[
186- +000.693 - 000.549 -000.468 + 000.000
187- +000.643 +000.764 +000.057 +000 .000
188- +000.326 - 000.340 +000.882 + 000.000
189- +000 .000 +000 .000 +000 .000 +001 .000
28+ +880. 000 +1920.000 +2960. 000 +4000 .000
29+ +960.000 +2080.000 +3200.000 +4320 .000
30+ +1040. 000 +2240.000 +3440. 000 +4640 .000
31+ +1120 .000 +2400 .000 +3680 .000 +4960 .000
19032]
191- hard_decomp.note: 170 degrees around (1,-2,3) normalized - w near zero
192- hard_decomp.quat_original: <+000.266, -000.532, +000.799, +000.087>
193- hard_decomp.quat_from_mat: <+000.266, -000.532, +000.799, +000.087>
194- hard_decomp.mat4:
195- [
196- -000.843 -000.144 +000.518 +000.000
197- -000.423 -000.418 -000.804 +000.000
198- +000.332 -000.897 +000.291 +000.000
199- +000.000 +000.000 +000.000 +001.000
200- ]
201- hard_decomp.quat_from_mat.mat4:
202- [
203- -000.843 -000.144 +000.518 +000.000
204- -000.423 -000.418 -000.804 +000.000
205- +000.332 -000.897 +000.291 +000.000
206- +000.000 +000.000 +000.000 +001.000
207- ]
208-
209- == perspective matrix ==
210- notes: fovy=60 degrees, aspect=1.5, near=0.1, far=100.0
211- perspective:
212- [
213- +001.155 +000.000 +000.000 +000.000
214- +000.000 +001.732 +000.000 +000.000
215- +000.000 +000.000 -001.002 -001.000
216- +000.000 +000.000 -000.200 +000.000
217- ]
218-
219- == ortho matrix ==
220- notes: left=-10, right=10, bottom=-7.5, top=7.5, near=0.1, far=100.0
221- ortho:
222- [
223- +000.100 +000.000 +000.000 +000.000
224- +000.000 +000.133 +000.000 +000.000
225- +000.000 +000.000 -000.020 +000.000
226- +000.000 +000.000 -001.002 +001.000
227- ]
228-
229- == lookAt matrix ==
230- notes: eye=(5,5,5), center=(0,0,0), up=(0,1,0)
231- lookAt:
232- [
233- +000.707 -000.408 +000.577 +000.000
234- +000.000 +000.816 +000.577 +000.000
235- -000.707 -000.408 +000.577 +000.000
236- +000.000 +000.000 -008.660 +001.000
237- ]
238-
239- == euler angle decomposition ==
240- notes: euler angles as vec3(pitch/x, yaw/y, roll/z) in radians
241- pure_rotation.quat.euler: <+000.646, -000.401, +001.239>
242- from_axis_angle.euler: <+000.064, +000.487, -000.670>
243-
244- == matrix inverse ==
245- transform.inverse:
246- [
247- +000.150 -000.277 +000.117 +000.000
248- +000.435 +000.013 -000.123 +000.000
249- +000.195 +000.185 +000.184 +000.000
250- -016.063 -003.019 -004.227 +001.000
251- ]
252- pure_rotation.inverse:
253- [
254- +000.300 -000.832 +000.467 +000.000
255- +000.870 +000.038 -000.491 +000.000
256- +000.391 +000.554 +000.735 +000.000
257- +000.000 +000.000 +000.000 +001.000
258- ]
259-
260- == cross product ==
261- notes: cross(a, b) where a and b are vec3
262- cross(x_axis, y_axis): <+000.000, +000.000, +001.000>
263- cross(y_axis, x_axis): <+000.000, +000.000, -001.000>
264- cross(c, d): <+000.292, -000.583, +000.292>
265-
266- == slerp ==
267- notes: slerp(a, b, t) between quat_x and quat_z
268- slerp(quat_x, quat_z, 0.25): <+000.247, +000.000, +000.157, +000.956>
269- slerp(quat_x, quat_z, 0.5): <+000.169, +000.000, +000.308, +000.936>
270- slerp(quat_x, quat_z, 0.75): <+000.086, +000.000, +000.451, +000.888>
271-
272- == fromTwoVectors ==
273- notes: quaternion that rotates vector a to vector b
274- notes: GLM has no native fromTwoVectors, implemented inline
275- from_x_to_y: <+000.000, +000.000, +000.707, +000.707>
276- from_c_to_d: <+000.707, -000.157, +000.393, +000.567>
277- verify_x_to_y: <+000.000, +001.000, +000.000>
278- verify_c_to_d: <-000.436, +000.218, +000.873>
279-
280- == quaternion inverse ==
281- from_axis_angle.inverse: <-000.109, -000.217, +000.326, +000.914>
282- verify_q_mul_qinv: <+000.000, +000.000, +000.000, +001.000>
283-
284- == quaternion to axis-angle ==
285- from_axis_angle.axis: <+000.267, +000.535, -000.802>
286- from_axis_angle.angle: +000.838
287- quat_xyz.axis: <+000.235, -000.549, +000.802>
288- quat_xyz.angle: +001.309
289-
290- == basis directions ==
291- N/A
292-
293- == element access [row,col] ==
294- notes: [row,col] in math convention, element (i,j) = row i, col j
295- notes: GLM uses [col,row], so element (r,c) = value[c,r]
296- transform[0,0]: +000.599
297- transform[0,1]: -002.495
298- transform[0,2]: +001.870
299- transform[0,3]: +010.000
300- transform[1,0]: +001.741
301- transform[1,3]: +020.000
302- transform[2,0]: +000.781
303- transform[2,3]: +030.000
304- transform[3,3]: +001.000
0 commit comments