nalgebra_glm/aliases.rs
1use na::{
2 Matrix2, Matrix2x3, Matrix2x4, Matrix3, Matrix3x2, Matrix3x4, Matrix4, Matrix4x2, Matrix4x3,
3 Quaternion, SMatrix, SVector,
4};
5
6/// A matrix with components of type `T`. It has `R` rows, and `C` columns.
7///
8/// In this library, vectors, represented as [`TVec`] and
9/// friends, are also matrices. Operations that operate on a matrix will
10/// also work on a vector.
11///
12/// # See also:
13///
14/// * [`TMat2`]
15/// * [`TMat2x2`]
16/// * [`TMat2x3`]
17/// * [`TMat2x4`]
18/// * [`TMat3`]
19/// * [`TMat3x2`]
20/// * [`TMat3x3`]
21/// * [`TMat3x4`]
22/// * [`TMat4`]
23/// * [`TMat4x2`]
24/// * [`TMat4x3`]
25/// * [`TMat4x4`]
26/// * [`TVec`]
27pub type TMat<T, const R: usize, const C: usize> = SMatrix<T, R, C>;
28/// A column vector with components of type `T`. It has `D` rows (and one column).
29///
30/// In this library, vectors are represented as a single column matrix, so
31/// operations on [`TMat`] are also valid on vectors.
32///
33/// # See also:
34///
35/// * [`TMat`]
36/// * [`TVec1`]
37/// * [`TVec2`]
38/// * [`TVec3`]
39/// * [`TVec4`]
40pub type TVec<T, const R: usize> = SVector<T, R>;
41/// A quaternion with components of type `T`.
42pub type Qua<T> = Quaternion<T>;
43
44/// A 1D vector with components of type `T`.
45///
46/// # See also:
47///
48/// ## Constructors:
49///
50/// * [`make_vec1()`](crate::make_vec1)
51/// * [`vec1()`](crate::vec1)
52/// * [`vec2_to_vec1()`](crate::vec2_to_vec1)
53/// * [`vec3_to_vec1()`](crate::vec3_to_vec1)
54/// * [`vec4_to_vec1()`](crate::vec4_to_vec1)
55///
56/// ## Related types:
57///
58/// * [`BVec1`]
59/// * [`DVec1`]
60/// * [`IVec1`]
61/// * [`I16Vec1`]
62/// * [`I32Vec1`]
63/// * [`I64Vec1`]
64/// * [`I8Vec1`]
65/// * [`TVec`]
66/// * [`UVec1`]
67/// * [`U16Vec1`]
68/// * [`U32Vec1`]
69/// * [`U64Vec1`]
70/// * [`U8Vec1`]
71/// * [`Vec1`]
72pub type TVec1<T> = TVec<T, 1>;
73/// A 2D vector with components of type `T`.
74///
75/// # See also:
76///
77/// ## Constructors:
78///
79/// * [`make_vec2()`](crate::make_vec2)
80/// * [`vec2()`](crate::vec2)
81/// * [`vec1_to_vec2()`](crate::vec1_to_vec2)
82/// * [`vec3_to_vec2()`](crate::vec3_to_vec2)
83/// * [`vec4_to_vec2()`](crate::vec4_to_vec2)
84///
85/// ## Related types:
86///
87/// * [`BVec2`]
88/// * [`DVec2`]
89/// * [`IVec2`]
90/// * [`I16Vec2`]
91/// * [`I32Vec2`]
92/// * [`I64Vec2`]
93/// * [`I8Vec2`]
94/// * [`TVec`]
95/// * [`UVec2`]
96/// * [`U16Vec2`]
97/// * [`U32Vec2`]
98/// * [`U64Vec2`]
99/// * [`U8Vec2`]
100/// * [`Vec2`]
101pub type TVec2<T> = TVec<T, 2>;
102/// A 3D vector with components of type `T`.
103///
104/// # See also:
105///
106/// ## Constructors:
107///
108/// * [`make_vec3()`](crate::make_vec3)
109/// * [`vec3()`](crate::vec3)
110/// * [`vec1_to_vec3()`](crate::vec1_to_vec3)
111/// * [`vec2_to_vec3()`](crate::vec2_to_vec3)
112/// * [`vec4_to_vec3()`](crate::vec4_to_vec3)
113///
114/// ## Related types:
115///
116/// * [`BVec3`]
117/// * [`DVec3`]
118/// * [`IVec3`]
119/// * [`I16Vec3`]
120/// * [`I32Vec3`]
121/// * [`I64Vec3`]
122/// * [`I8Vec3`]
123/// * [`TVec`]
124/// * [`UVec3`]
125/// * [`U16Vec3`]
126/// * [`U32Vec3`]
127/// * [`U64Vec3`]
128/// * [`U8Vec3`]
129/// * [`Vec3`]
130pub type TVec3<T> = TVec<T, 3>;
131/// A 4D vector with components of type `T`.
132///
133/// # See also:
134///
135/// ## Constructors:
136///
137/// * [`make_vec4()`](crate::make_vec4)
138/// * [`vec4()`](crate::vec4)
139/// * [`vec1_to_vec4()`](crate::vec1_to_vec4)
140/// * [`vec2_to_vec4()`](crate::vec2_to_vec4)
141/// * [`vec3_to_vec4()`](crate::vec3_to_vec4)
142///
143/// ## Related types:
144///
145/// * [`BVec4`]
146/// * [`DVec4`]
147/// * [`IVec4`]
148/// * [`I16Vec4`]
149/// * [`I32Vec4`]
150/// * [`I64Vec4`]
151/// * [`I8Vec4`]
152/// * [`UVec4`]
153/// * [`U16Vec4`]
154/// * [`U32Vec4`]
155/// * [`U64Vec4`]
156/// * [`U8Vec4`]
157/// * [`Vec4`]
158pub type TVec4<T> = TVec<T, 4>;
159/// A 1D vector with boolean components.
160pub type BVec1 = TVec1<bool>;
161/// A 2D vector with boolean components.
162pub type BVec2 = TVec2<bool>;
163/// A 3D vector with boolean components.
164pub type BVec3 = TVec3<bool>;
165/// A 4D vector with boolean components.
166pub type BVec4 = TVec4<bool>;
167/// A 1D vector with `f64` components.
168pub type DVec1 = TVec1<f64>;
169/// A 2D vector with `f64` components.
170pub type DVec2 = TVec2<f64>;
171/// A 3D vector with `f64` components.
172pub type DVec3 = TVec3<f64>;
173/// A 4D vector with `f64` components.
174pub type DVec4 = TVec4<f64>;
175/// A 1D vector with `i32` components.
176pub type IVec1 = TVec1<i32>;
177/// A 2D vector with `i32` components.
178pub type IVec2 = TVec2<i32>;
179/// A 3D vector with `i32` components.
180pub type IVec3 = TVec3<i32>;
181/// A 4D vector with `i32` components.
182pub type IVec4 = TVec4<i32>;
183/// A 1D vector with `u32` components.
184pub type UVec1 = TVec1<u32>;
185/// A 2D vector with `u32` components.
186pub type UVec2 = TVec2<u32>;
187/// A 3D vector with `u32` components.
188pub type UVec3 = TVec3<u32>;
189/// A 4D vector with `u32` components.
190pub type UVec4 = TVec4<u32>;
191/// A 1D vector with `f32` components.
192pub type Vec1 = TVec1<f32>;
193/// A 2D vector with `f32` components.
194pub type Vec2 = TVec2<f32>;
195/// A 3D vector with `f32` components.
196pub type Vec3 = TVec3<f32>;
197/// A 4D vector with `f32` components.
198pub type Vec4 = TVec4<f32>;
199
200/// A 1D vector with `u64` components.
201pub type U64Vec1 = TVec1<u64>;
202/// A 2D vector with `u64` components.
203pub type U64Vec2 = TVec2<u64>;
204/// A 3D vector with `u64` components.
205pub type U64Vec3 = TVec3<u64>;
206/// A 4D vector with `u64` components.
207pub type U64Vec4 = TVec4<u64>;
208/// A 1D vector with `i64` components.
209pub type I64Vec1 = TVec1<i64>;
210/// A 2D vector with `i64` components.
211pub type I64Vec2 = TVec2<i64>;
212/// A 3D vector with `i64` components.
213pub type I64Vec3 = TVec3<i64>;
214/// A 4D vector with `i64` components.
215pub type I64Vec4 = TVec4<i64>;
216
217/// A 1D vector with `u32` components.
218pub type U32Vec1 = TVec1<u32>;
219/// A 2D vector with `u32` components.
220pub type U32Vec2 = TVec2<u32>;
221/// A 3D vector with `u32` components.
222pub type U32Vec3 = TVec3<u32>;
223/// A 4D vector with `u32` components.
224pub type U32Vec4 = TVec4<u32>;
225/// A 1D vector with `i32` components.
226pub type I32Vec1 = TVec1<i32>;
227/// A 2D vector with `i32` components.
228pub type I32Vec2 = TVec2<i32>;
229/// A 3D vector with `i32` components.
230pub type I32Vec3 = TVec3<i32>;
231/// A 4D vector with `i32` components.
232pub type I32Vec4 = TVec4<i32>;
233
234/// A 1D vector with `u16` components.
235pub type U16Vec1 = TVec1<u16>;
236/// A 2D vector with `u16` components.
237pub type U16Vec2 = TVec2<u16>;
238/// A 3D vector with `u16` components.
239pub type U16Vec3 = TVec3<u16>;
240/// A 4D vector with `u16` components.
241pub type U16Vec4 = TVec4<u16>;
242/// A 1D vector with `i16` components.
243pub type I16Vec1 = TVec1<i16>;
244/// A 2D vector with `i16` components.
245pub type I16Vec2 = TVec2<i16>;
246/// A 3D vector with `i16` components.
247pub type I16Vec3 = TVec3<i16>;
248/// A 4D vector with `i16` components.
249pub type I16Vec4 = TVec4<i16>;
250
251/// A 1D vector with `u8` components.
252pub type U8Vec1 = TVec1<u8>;
253/// A 2D vector with `u8` components.
254pub type U8Vec2 = TVec2<u8>;
255/// A 3D vector with `u8` components.
256pub type U8Vec3 = TVec3<u8>;
257/// A 4D vector with `u8` components.
258pub type U8Vec4 = TVec4<u8>;
259/// A 1D vector with `i8` components.
260pub type I8Vec1 = TVec1<i8>;
261/// A 2D vector with `i8` components.
262pub type I8Vec2 = TVec2<i8>;
263/// A 3D vector with `i8` components.
264pub type I8Vec3 = TVec3<i8>;
265/// A 4D vector with `i8` components.
266pub type I8Vec4 = TVec4<i8>;
267
268/// A 2x2 matrix with components of type `T`.
269pub type TMat2<T> = Matrix2<T>;
270/// A 2x2 matrix with components of type `T`.
271pub type TMat2x2<T> = Matrix2<T>;
272/// A 2x3 matrix with components of type `T`.
273pub type TMat2x3<T> = Matrix2x3<T>;
274/// A 2x4 matrix with components of type `T`.
275pub type TMat2x4<T> = Matrix2x4<T>;
276/// A 3x3 matrix with components of type `T`.
277pub type TMat3<T> = Matrix3<T>;
278/// A 3x2 matrix with components of type `T`.
279pub type TMat3x2<T> = Matrix3x2<T>;
280/// A 3x3 matrix with components of type `T`.
281pub type TMat3x3<T> = Matrix3<T>;
282/// A 3x4 matrix with components of type `T`.
283pub type TMat3x4<T> = Matrix3x4<T>;
284/// A 4x4 matrix with components of type `T`.
285pub type TMat4<T> = Matrix4<T>;
286/// A 4x2 matrix with components of type `T`.
287pub type TMat4x2<T> = Matrix4x2<T>;
288/// A 4x3 matrix with components of type `T`.
289pub type TMat4x3<T> = Matrix4x3<T>;
290/// A 4x4 matrix with components of type `T`.
291pub type TMat4x4<T> = Matrix4<T>;
292/// A 2x2 matrix with components of type `T`.
293pub type DMat2 = Matrix2<f64>;
294/// A 2x2 matrix with `f64` components.
295pub type DMat2x2 = Matrix2<f64>;
296/// A 2x3 matrix with `f64` components.
297pub type DMat2x3 = Matrix2x3<f64>;
298/// A 2x4 matrix with `f64` components.
299pub type DMat2x4 = Matrix2x4<f64>;
300/// A 3x3 matrix with `f64` components.
301pub type DMat3 = Matrix3<f64>;
302/// A 3x2 matrix with `f64` components.
303pub type DMat3x2 = Matrix3x2<f64>;
304/// A 3x3 matrix with `f64` components.
305pub type DMat3x3 = Matrix3<f64>;
306/// A 3x4 matrix with `f64` components.
307pub type DMat3x4 = Matrix3x4<f64>;
308/// A 4x4 matrix with `f64` components.
309pub type DMat4 = Matrix4<f64>;
310/// A 4x2 matrix with `f64` components.
311pub type DMat4x2 = Matrix4x2<f64>;
312/// A 4x3 matrix with `f64` components.
313pub type DMat4x3 = Matrix4x3<f64>;
314/// A 4x4 matrix with `f64` components.
315pub type DMat4x4 = Matrix4<f64>;
316/// A 2x2 matrix with `f32` components.
317pub type Mat2 = Matrix2<f32>;
318/// A 2x2 matrix with `f32` components.
319pub type Mat2x2 = Matrix2<f32>;
320/// A 2x3 matrix with `f32` components.
321pub type Mat2x3 = Matrix2x3<f32>;
322/// A 2x4 matrix with `f32` components.
323pub type Mat2x4 = Matrix2x4<f32>;
324/// A 3x3 matrix with `f32` components.
325pub type Mat3 = Matrix3<f32>;
326/// A 3x2 matrix with `f32` components.
327pub type Mat3x2 = Matrix3x2<f32>;
328/// A 3x3 matrix with `f32` components.
329pub type Mat3x3 = Matrix3<f32>;
330/// A 3x4 matrix with `f32` components.
331pub type Mat3x4 = Matrix3x4<f32>;
332/// A 4x2 matrix with `f32` components.
333pub type Mat4x2 = Matrix4x2<f32>;
334/// A 4x3 matrix with `f32` components.
335pub type Mat4x3 = Matrix4x3<f32>;
336/// A 4x4 matrix with `f32` components.
337pub type Mat4x4 = Matrix4<f32>;
338/// A 4x4 matrix with `f32` components.
339pub type Mat4 = Matrix4<f32>;
340
341/// A quaternion with f32 components.
342pub type Quat = Qua<f32>;
343/// A quaternion with f64 components.
344pub type DQuat = Qua<f64>;