mat4x3
On this page

mat4x3

Function

mat4x3 builds a matrix with 4 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 1mat4x3()
000000000000
Matrix displayed by rows. Constructor arguments run down each column.
Result
[[0,0,0,0],[0,0,0,0],[0,0,0,0]]
Example 2mat4x3(1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12.)
147102581136912
Matrix displayed by rows. Constructor arguments run down each column.
Result
[[1,4,7,10],[2,5,8,11],[3,6,9,12]]
Example 3mat4x3(1., 0., 0., 0., 1., 0., 0., 0., 1., 0., 0., 0.)
100001000010
Matrix displayed by rows. Constructor arguments run down each column.
Result
[[1,0,0,0],[0,1,0,0],[0,0,1,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.

The signature, the sentence and any message are the compiler's own text at commit af54ddad5.

Builds a mat4x3, 4 columns of 3 components in column-major order, from 4 vec3 columns, from 12 components column by column, from a larger matrix by truncation, or with no arguments for the zero matrix (§40).

Syntax

declare function mat4x3(): mat4x3
declare function mat4x3(c0: vec3, c1: vec3, c2: vec3, c3: vec3): mat4x3
declare function mat4x3(e0: number, e1: number, e2: number, e3: number, e4: number, e5: number, e6: number, e7: number, e8: number, e9: number, e10: number, e11: number): mat4x3
declare function mat4x3(m: mat4x3): mat4x3
declare function mat4x3(m: mat4x4): mat4x3

A 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

  • c0 optional vec3
  • e0 optional number
  • m optional mat4x3mat4x4
  • c1 optional vec3
  • e1 optional number
  • c2 optional vec3
  • e2 optional number
  • c3 optional vec3
  • e3 optional number
  • e4 optional number
  • e5 optional number
  • e6 optional number
  • e7 optional number
  • e8 optional number
  • e9 optional number
  • e10 optional number
  • e11 optional number

Return value

mat4x3

Description

It is not square, so it has no determinant and transpose gives a mat3x4.

See also

Edit this page Report a problem