mat3

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package mat3 is still in progress and will documented after its finished

Index

Constants

This section is empty.

Variables

View Source
var IM = Mat{
	Vec{1, 0, 0},
	Vec{0, 1, 0},
	Vec{0, 0, 1},
	Vec{0, 0, 0},
}

Functions

This section is empty.

Types

type Mat

type Mat struct {
	X, Y, Z, C Vec
}

Mat is 3D matrix

layout:

	| m.X.X m.Y.X m.Z.X m.C.X |
	| m.X.Y m.Y.Y m.Z.Y m.C.Y |
	| m.X.Z m.Y.Z m.Z.Z m.C.Z |
 |   0     0     0     1   |

func (Mat) Approx

func (m Mat) Approx(o Mat, precision int) bool

func (Mat) Moved

func (m Mat) Moved(v Vec) Mat

func (Mat) Mul

func (m Mat) Mul(o Mat) Mat

Mul performs matrix multiplication (m by o)

func (*Mat) Project

func (m *Mat) Project(v Vec) Vec

Project performs projection on point and returns a projected result

func (Mat) ScaleComp

func (m Mat) ScaleComp(v Vec) Mat

func (*Mat) Unproject

func (m *Mat) Unproject(u Vec) (v Vec)

Unproject performs reverse action of Project

type Plane

type Plane struct {
	O, N Vec
}

func (Plane) Formula

func (p Plane) Formula(pos Vec) float64

Formula returns 0 if point belongs to Plane

type Vec

type Vec struct {
	X, Y, Z float64
}

func V

func V(x, y, z float64) Vec

func (Vec) Add

func (v Vec) Add(o Vec) Vec

func (*Vec) AddE

func (v *Vec) AddE(o Vec)

func (Vec) Approx

func (v Vec) Approx(o Vec, precision int) bool

func (Vec) Cross

func (v Vec) Cross(o Vec) Vec

func (Vec) Divided

func (v Vec) Divided(scalar float64) Vec

func (Vec) Dot

func (v Vec) Dot(o Vec) float64

func (Vec) Inv

func (v Vec) Inv() Vec

func (Vec) Len

func (v Vec) Len() float64

func (Vec) Mul

func (v Vec) Mul(o Vec) Vec

func (*Vec) MulE

func (v *Vec) MulE(o Vec)

func (Vec) Normalized

func (v Vec) Normalized() Vec

func (Vec) Rotated

func (v Vec) Rotated(angle float64, pivot Vec) Vec

Rotated rotates vector around pivot by angle with a right hand rule so tongue is pivot and curved fingers point to the direction of rotation

func (Vec) Scaled

func (v Vec) Scaled(scalar float64) Vec

func (Vec) Sub

func (v Vec) Sub(o Vec) Vec

Jump to

Keyboard shortcuts

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