11== dump ==
2- notes: matrices are printed in raw in-memory order, four scalars per line
2+ notes: matrices are printed in common column-major order
33
4- == matrix constructors and composition ==
4+ == matrix basics ==
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+ ]
512matrix_a:
613[
714 +001.000 +005.000 +009.000 +013.000
@@ -16,6 +23,8 @@ matrix_b:
1623 -030.000 +070.000 +110.000 +150.000
1724 -040.000 +080.000 +120.000 +160.000
1825]
26+
27+ == matrix multiply ==
1928matrix_a * matrix_b:
2029[
2130 -900.000 +2020.000 +3140.000 +4260.000
@@ -30,3 +39,258 @@ matrix_b * matrix_a:
3039 +1040.000 +2240.000 +3440.000 +4640.000
3140 +1120.000 +2400.000 +3680.000 +4960.000
3241]
42+
43+ == element access [row, col] ==
44+ transform[0, 0]: +001.000
45+ transform[0, 1]: +002.000
46+ transform[0, 2]: +003.000
47+ transform[0, 3]: +004.000
48+ transform[1, 0]: +005.000
49+ transform[1, 1]: +006.000
50+ transform[1, 2]: +007.000
51+ transform[1, 3]: +008.000
52+ transform[2, 0]: +009.000
53+ transform[2, 1]: +010.000
54+ transform[2, 2]: +011.000
55+ transform[2, 3]: +012.000
56+ transform[3, 0]: +013.000
57+ transform[3, 1]: +014.000
58+ transform[3, 2]: +015.000
59+ transform[3, 3]: +016.000
60+
61+ == matrix constructors and composition ==
62+ scale:
63+ [
64+ +002.000 +000.000 +000.000 +000.000
65+ +000.000 +003.000 +000.000 +000.000
66+ +000.000 +000.000 +004.000 +000.000
67+ +000.000 +000.000 +000.000 +001.000
68+ ]
69+ translate:
70+ [
71+ +001.000 +000.000 +000.000 +010.000
72+ +000.000 +001.000 +000.000 +020.000
73+ +000.000 +000.000 +001.000 +030.000
74+ +000.000 +000.000 +000.000 +001.000
75+ ]
76+ rotate_x:
77+ [
78+ +001.000 +000.000 +000.000 +000.000
79+ +000.000 +000.799 -000.602 +000.000
80+ +000.000 +000.602 +000.799 +000.000
81+ +000.000 +000.000 +000.000 +001.000
82+ ]
83+ rotate_y:
84+ [
85+ +000.921 +000.000 -000.391 +000.000
86+ +000.000 +001.000 +000.000 +000.000
87+ +000.391 +000.000 +000.921 +000.000
88+ +000.000 +000.000 +000.000 +001.000
89+ ]
90+ rotate_z:
91+ [
92+ +000.326 -000.946 +000.000 +000.000
93+ +000.946 +000.326 +000.000 +000.000
94+ +000.000 +000.000 +001.000 +000.000
95+ +000.000 +000.000 +000.000 +001.000
96+ ]
97+ pure_rotation = rotate_z * rotate_y * rotate_x:
98+ [
99+ +000.300 -000.832 +000.467 +000.000
100+ +000.870 +000.038 -000.491 +000.000
101+ +000.391 +000.554 +000.735 +000.000
102+ +000.000 +000.000 +000.000 +001.000
103+ ]
104+ transform = translate * rotate_z * rotate_y * rotate_x * scale:
105+ [
106+ +000.599 -002.495 +001.870 +010.000
107+ +001.741 +000.113 -001.964 +020.000
108+ +000.781 +001.662 +002.941 +030.000
109+ +000.000 +000.000 +000.000 +001.000
110+ ]
111+
112+ == matrix vector multiply ==
113+ vec3_input: <+001.250, -002.500, +003.750>
114+ vec4_input: <+001.250, -002.500, +003.750, +001.000>
115+ transform * vec3: <+023.998, +014.529, +037.849>
116+ transform * vec4: <+023.998, +014.529, +037.849, +001.000>
117+ rotate_z * vec3: <+002.771, +000.368, +003.750>
118+ translate * vec3: <+011.250, +017.500, +033.750>
119+
120+ == quaternion constructors ==
121+ quat_identity: <+000.000, +000.000, +000.000, +001.000>
122+ quat_rotate_x: <+000.317, +000.000, +000.000, +000.948>
123+ quat_rotate_y: <+000.000, -000.199, +000.000, +000.980>
124+ quat_rotate_z: <+000.000, +000.000, +000.581, +000.814>
125+ axis_normalized: <+000.267, +000.535, -000.802>
126+ axis_angle_radians: +000.838
127+ from_axis_angle: <+000.109, +000.217, -000.326, +000.914>
128+ from_axis_angle.mat4:
129+ [
130+ +000.693 +000.643 +000.326 +000.000
131+ -000.549 +000.764 -000.340 +000.000
132+ -000.468 +000.057 +000.882 +000.000
133+ +000.000 +000.000 +000.000 +001.000
134+ ]
135+
136+ == quaternion multiply ==
137+ quat_x: <+000.317, +000.000, +000.000, +000.948>
138+ quat_y: <+000.000, -000.199, +000.000, +000.980>
139+ quat_z: <+000.000, +000.000, +000.581, +000.814>
140+ quat_multiply(quat_x, quat_y): <+000.311, -000.189, -000.063, +000.929>
141+ quat_multiply(quat_multiply(quat_x, quat_y), quat_z): <+000.143, -000.334, +000.488, +000.793>
142+ quat_xy.mat4:
143+ [
144+ +000.921 +000.000 -000.391 +000.000
145+ -000.235 +000.799 -000.554 +000.000
146+ +000.312 +000.602 +000.735 +000.000
147+ +000.000 +000.000 +000.000 +001.000
148+ ]
149+ quat_xyz.mat4:
150+ [
151+ +000.300 -000.870 -000.391 +000.000
152+ +000.679 +000.482 -000.554 +000.000
153+ +000.671 -000.099 +000.735 +000.000
154+ +000.000 +000.000 +000.000 +001.000
155+ ]
156+
157+ == quaternion vector rotate ==
158+ input: <+001.250, -002.500, +003.750>
159+ quat_rotate(quat_x, input): <+001.250, -004.253, +001.490>
160+ quat_rotate(quat_y, input): <-000.315, -002.500, +003.940>
161+ quat_rotate(quat_z, input): <+002.771, +000.368, +003.750>
162+ quat_rotate(from_axis_angle, input): <+000.482, -003.871, +002.580>
163+ quat_z * input: <+002.771, +000.368, +003.750>
164+
165+ == matrix quaternion roundtrip ==
166+ pure_rotation.quat: <+000.363, +000.027, +000.591, +000.720>
167+ pure_rotation:
168+ [
169+ +000.300 -000.832 +000.467 +000.000
170+ +000.870 +000.038 -000.491 +000.000
171+ +000.391 +000.554 +000.735 +000.000
172+ +000.000 +000.000 +000.000 +001.000
173+ ]
174+ pure_rotation.quat.mat4:
175+ [
176+ +000.300 -000.832 +000.467 +000.000
177+ +000.870 +000.038 -000.491 +000.000
178+ +000.391 +000.554 +000.735 +000.000
179+ +000.000 +000.000 +000.000 +001.000
180+ ]
181+ transform.rotation_only:
182+ [
183+ +000.599 -002.495 +001.870 +000.000
184+ +001.741 +000.113 -001.964 +000.000
185+ +000.781 +001.662 +002.941 +000.000
186+ +000.000 +000.000 +000.000 +001.000
187+ ]
188+ transform.rotation_only.quat: <+000.840, +000.252, +000.982, +001.079>
189+ axis_mat.quat: <+000.109, +000.217, -000.326, +000.914>
190+ axis_mat.quat.mat4:
191+ [
192+ +000.693 +000.643 +000.326 +000.000
193+ -000.549 +000.764 -000.340 +000.000
194+ -000.468 +000.057 +000.882 +000.000
195+ +000.000 +000.000 +000.000 +001.000
196+ ]
197+ hard_decomp.note: 170 degrees around (1,-2,3) normalized - w near zero
198+ hard_decomp.quat_original: <+000.266, -000.532, +000.799, +000.087>
199+ hard_decomp.quat_from_mat: <+000.266, -000.532, +000.799, +000.087>
200+ hard_decomp.mat4:
201+ [
202+ -000.843 -000.423 +000.332 +000.000
203+ -000.144 -000.418 -000.897 +000.000
204+ +000.518 -000.804 +000.291 +000.000
205+ +000.000 +000.000 +000.000 +001.000
206+ ]
207+ hard_decomp.quat_from_mat.mat4:
208+ [
209+ -000.843 -000.423 +000.332 +000.000
210+ -000.144 -000.418 -000.897 +000.000
211+ +000.518 -000.804 +000.291 +000.000
212+ +000.000 +000.000 +000.000 +001.000
213+ ]
214+
215+ == perspective matrix ==
216+ notes: fovy=60 degrees, aspect=1.5, near=0.1, far=100.0
217+ perspective:
218+ [
219+ +001.155 +000.000 +000.000 +000.000
220+ +000.000 +001.732 +000.000 +000.000
221+ +000.000 +000.000 -001.002 -000.200
222+ +000.000 +000.000 -001.000 +000.000
223+ ]
224+
225+ == ortho matrix ==
226+ notes: left=-10, right=10, bottom=-7.5, top=7.5, near=0.1, far=100.0
227+ ortho:
228+ [
229+ +000.100 +000.000 +000.000 +000.000
230+ +000.000 +000.133 +000.000 +000.000
231+ +000.000 +000.000 -000.020 -001.002
232+ +000.000 +000.000 +000.000 +001.000
233+ ]
234+
235+ == lookAt matrix ==
236+ notes: eye=(5,5,5), center=(0,0,0), up=(0,1,0)
237+ lookAt:
238+ [
239+ +000.707 +000.000 -000.707 +000.000
240+ -000.408 +000.816 -000.408 +000.000
241+ +000.577 +000.577 +000.577 -008.660
242+ +000.000 +000.000 +000.000 +001.000
243+ ]
244+
245+ == euler angle decomposition ==
246+ notes: euler angles as vec3(pitch/x, yaw/y, roll/z) in radians
247+ pure_rotation.quat.euler: <+000.646, -000.401, +001.239>
248+ from_axis_angle.euler: <+000.064, +000.487, -000.670>
249+
250+ == matrix inverse ==
251+ transform.inverse:
252+ [
253+ +000.150 +000.435 +000.195 -016.063
254+ -000.277 +000.013 +000.185 -003.019
255+ +000.117 -000.123 +000.184 -004.227
256+ +000.000 +000.000 +000.000 +001.000
257+ ]
258+ pure_rotation.inverse:
259+ [
260+ +000.300 +000.870 +000.391 +000.000
261+ -000.832 +000.038 +000.554 +000.000
262+ +000.467 -000.491 +000.735 +000.000
263+ +000.000 +000.000 +000.000 +001.000
264+ ]
265+
266+ == cross product ==
267+ notes: cross(a, b) where a and b are vec3
268+ cross(x_axis, y_axis): <+000.000, +000.000, +001.000>
269+ cross(y_axis, x_axis): <+000.000, +000.000, -001.000>
270+ cross(c, d): <+000.292, -000.583, +000.292>
271+
272+ == slerp ==
273+ notes: slerp(a, b, t) between quat_x and quat_z
274+ slerp(quat_x, quat_z, 0.25): <+000.247, +000.000, +000.157, +000.956>
275+ slerp(quat_x, quat_z, 0.5): <+000.169, +000.000, +000.308, +000.936>
276+ slerp(quat_x, quat_z, 0.75): <+000.086, +000.000, +000.451, +000.888>
277+
278+ == fromTwoVectors ==
279+ notes: quaternion that rotates vector a to vector b
280+ from_x_to_y: <+000.000, +000.000, +000.707, +000.707>
281+ from_c_to_d: <+000.707, -000.157, +000.393, +000.567>
282+ verify_x_to_y: <+000.000, +001.000, +000.000>
283+ verify_c_to_d: <-000.436, +000.218, +000.873>
284+
285+ == quaternion inverse ==
286+ from_axis_angle.inverse: <-000.109, -000.217, +000.326, +000.914>
287+ verify_q_mul_qinv: <+000.000, +000.000, +000.000, +001.000>
288+
289+ == quaternion to axis-angle ==
290+ from_axis_angle.axis: <+000.267, +000.535, -000.802>
291+ from_axis_angle.angle: +000.838
292+ quat_xyz.axis: <+000.235, -000.549, +000.802>
293+ quat_xyz.angle: +001.309
294+
295+ == basis directions ==
296+ N/A
0 commit comments