f32

package
v0.0.0-...-e77de60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2020 License: Zlib Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mat3

type Mat3 f32.Mat3

func Ident3

func Ident3() Mat3

Ident3 returns the 3x3 identity matrix.

func Rotate3DY

func Rotate3DY(angle float32) Mat3

Rotate3DY returns a 3x3 (non-homogeneous) Matrix that rotates by angle about the Y-axis

Where c is cos(angle) and s is sin(angle)

[c 0 s]
[0 1 0]
[s 0 c ]

func Rotate3DZ

func Rotate3DZ(angle float32) Mat3

Rotate3DZ returns a 3x3 (non-homogeneous) Matrix that rotates by angle about the Z-axis

Where c is cos(angle) and s is sin(angle)

[c -s 0]
[s c 0]
[0 0 1 ]

func Translate2D

func Translate2D(Tx, Ty float32) Mat3

Translate2D returns a homogeneous (3x3 for 2D-space) Translation matrix that moves a point by Tx units in the x-direction and Ty units in the y-direction

[[1, 0, Tx]]
[[0, 1, Ty]]
[[0, 0, 1 ]]

func (Mat3) Diag

func (m Mat3) Diag() Vec3

Diag returns main diagonal (meaning all elements such that row==col).

func (*Mat3) Initialize

func (m *Mat3) Initialize(x, y, angle, sx, sy, ox, oy, kx, ky float32)

Initialize defines a 3-D Matrix.

| x |
| y |
| 1 |

| e0 e3 e6 | | e1 e4 e7 | | e2 e5 e8 |

func (*Mat3) InitializeScale1

func (m *Mat3) InitializeScale1(x, y, angle, ox, oy float32)

func (*Mat3) SetCol

func (m *Mat3) SetCol(col int, v Vec3)

SetCol sets a Column within the Matrix, so it mutates the calling matrix.

func (*Mat3) SetRow

func (m *Mat3) SetRow(row int, v Vec3)

SetRow sets a Row within the Matrix, so it mutates the calling matrix.

func (Mat3) Transform

func (m Mat3) Transform(x, y float32) (x1, y1 float32)

Transform transforms (x, y) to (x1, y).

matrix multiplication carried out on paper: |1 x| |c -s | |sx | | 1 ky | |1 -ox| | 1 y| |s c | | sy | |kx 1 | | 1 -oy| | 1| | 1| | 1| | 1| | 1 |

move    rotate    scale     skew      origin

type Mat4

type Mat4 f32.Mat4

func Frustum

func Frustum(left, right, bottom, top, near, far float32) Mat4

func Ident4

func Ident4() Mat4

Ident4 returns the 4x4 identity matrix.

func Ortho

func Ortho(left, right, bottom, top, near, far float32) Mat4

func Ortho2D

func Ortho2D(left, right, bottom, top float32) Mat4

Equivalent to Ortho with the near and far planes being -1 and 1, respectively

func Perspective

func Perspective(fovy, aspect, near, far float32) Mat4

func Translate3D

func Translate3D(Tx, Ty, Tz float32) Mat4

Translate3D returns a homogeneous (4x4 for 3D-space) Translation matrix that moves a point by Tx units in the x-direction, Ty units in the y-direction, and Tz units in the z-direction

[[1, 0, 0, Tx]]
[[0, 1, 0, Ty]]
[[0, 0, 1, Tz]]
[[0, 0, 0, 1 ]]

func (Mat4) At

func (m Mat4) At(row, col int) float32

At returns the matrix element at the given row and column.

func (Mat4) Diag

func (m Mat4) Diag() Vec4

Diag returns main diagonal (meaning all elements such that row==col).

func (*Mat4) Set

func (m *Mat4) Set(row, col int, value float32)

Set sets the corresponding matrix element at the given row and column.

func (*Mat4) SetCol

func (m *Mat4) SetCol(col int, v Vec4)

SetCol sets a Column within the Matrix.

func (*Mat4) SetRow

func (m *Mat4) SetRow(row int, v Vec4)

SetRow sets a Row within the Matrix.

type Vec2

type Vec2 f32.Vec2

func (Vec2) Add

func (v1 Vec2) Add(v2 Vec2) Vec2

func (Vec2) Cross

func (v1 Vec2) Cross(v2 Vec2) float32

func (Vec2) Dot

func (v1 Vec2) Dot(v2 Vec2) float32

func (Vec2) IsZero

func (v1 Vec2) IsZero() bool

func (Vec2) Len

func (v1 Vec2) Len() float32

func (Vec2) Mul

func (v1 Vec2) Mul(c float32) Vec2

func (Vec2) Norm

func (v1 Vec2) Norm() Vec2

func (Vec2) Sub

func (v1 Vec2) Sub(v2 Vec2) Vec2

type Vec3

type Vec3 f32.Vec3

func (Vec3) Add

func (v1 Vec3) Add(v2 Vec3) Vec3

func (Vec3) Mul

func (v1 Vec3) Mul(c float32) Vec3

func (Vec3) Sub

func (v1 Vec3) Sub(v2 Vec3) Vec3

type Vec4

type Vec4 f32.Vec4

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL