mat2x3
Function
mat2x3 builds a matrix with 2 columns and 3 rows. Each column describes the image of one input basis direction.
Compare examples
Compare the zero matrix with distinct columns and a diagonal pattern. Read the displayed matrix across rows and the constructor down columns.
Example 1mat2x3()
000000 - Result
[[0,0],[0,0],[0,0]]
Example 2mat2x3(1., 2., 3., 4., 5., 6.)
142536 - Result
[[1,4],[2,5],[3,6]]
Example 3mat2x3(1., 0., 0., 0., 1., 0.)
100100 - Result
[[1,0],[0,1],[0,0]]
The examples are calculation models and do not run GPU work. The reference below gives the complete call signatures. Decimal results are rounded for display. The stated assumptions determine each example; actual shader results follow the target precision and execution rules.
When to use it
Use a matrix to represent a linear transformation. Reading it by columns makes the constructor order visible.
Inputs and limits
Components are supplied in column-major order. An argument-free constructor makes a zero matrix. Rectangular matrices do not have a determinant.
For shader input rules and precision, consult WGSL and GLSL ES 3.00.
Related functions
The signature, the sentence and any message are the compiler's own text at commit af54ddad5.
Builds a mat2x3, 2 columns of 3 components in column-major order, from 2 vec3 columns, from 6 components column by column, from a larger matrix by truncation, or with no arguments for the zero matrix (§40).
Syntax
declare function mat2x3(): mat2x3declare function mat2x3(c0: vec3, c1: vec3): mat2x3declare function mat2x3(e0: number, e1: number, e2: number, e3: number, e4: number, e5: number): mat2x3declare function mat2x3(m: mat2x3): mat2x3declare function mat2x3(m: mat2x4): mat2x3declare function mat2x3(m: mat3x3): mat2x3declare function mat2x3(m: mat3x4): mat2x3declare function mat2x3(m: mat4x3): mat2x3declare function mat2x3(m: mat4x4): mat2x3A number in a parameter or a return position is the scalar slot. The ambient file declares a GPU scalar as a branded number whose brand is optional, so a literal and any branded scalar both fill it.
type f32 = number & { readonly [f32Tag]?: true }
A number you write as a type is inferred from its uses, and f32, i32 and u32 fix a width; the TypeScript constructs page carries that row with the compiler's emit.
Parameters
Return value
mat2x3
Description
It is not square, so it has no determinant and transpose gives a mat3x2.