geom

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RotationOrderXYZ = iota
	RotationOrderYXZ
	RotationOrderZXY
	RotationOrderZYX
)

Variables

This section is empty.

Functions

func IsInTriangle added in v0.3.5

func IsInTriangle(p, a, b, c *Vector3) bool

func Triangulate added in v0.3.5

func Triangulate(poly []*Vector3) [][3]int

Types

type Element

type Element = float32

type EulerAngles added in v0.3.5

type EulerAngles struct {
	Vector3
	Order RotationOrder
}

func NewEuler added in v0.3.5

func NewEuler(x, y, z float32, order RotationOrder) *EulerAngles

func NewEulerFromMatrix4 added in v0.3.5

func NewEulerFromMatrix4(mat *Matrix4, order RotationOrder) *EulerAngles

func NewEulerFromQuaternion added in v0.3.5

func NewEulerFromQuaternion(q *Quaternion, order RotationOrder) *EulerAngles

func (*EulerAngles) ToQuaternion added in v0.3.5

func (v *EulerAngles) ToQuaternion() *Quaternion

type Matrix4

type Matrix4 [16]Element

column-major matrix

func NewMatrix4

func NewMatrix4() *Matrix4

func NewMatrix4FromSlice

func NewMatrix4FromSlice(a []Element) *Matrix4

func NewRotationMatrix4FromQuaternion added in v0.3.2

func NewRotationMatrix4FromQuaternion(q *Quaternion) *Matrix4

func NewScaleMatrix4

func NewScaleMatrix4(x, y, z Element) *Matrix4

func NewTRSMatrix4 added in v0.3.5

func NewTRSMatrix4(t *Vector3, r *Quaternion, s *Vector3) *Matrix4

func NewTranslateMatrix4

func NewTranslateMatrix4(x, y, z Element) *Matrix4

func (*Matrix4) ApplyTo

func (mat *Matrix4) ApplyTo(v *Vector3) *Vector3

func (*Matrix4) Clone added in v0.3.2

func (m *Matrix4) Clone() *Matrix4

func (*Matrix4) Decompose added in v0.3.5

func (mat *Matrix4) Decompose() (translate *Vector3, rotation *Quaternion, scale *Vector3)

func (*Matrix4) Det added in v0.3.4

func (m *Matrix4) Det() Element

func (*Matrix4) Inverse added in v0.3.2

func (m *Matrix4) Inverse() *Matrix4

func (*Matrix4) Mul

func (b *Matrix4) Mul(a *Matrix4) *Matrix4

func (*Matrix4) ToArray

func (mat *Matrix4) ToArray(a []Element)

func (*Matrix4) Transposed added in v0.3.2

func (m *Matrix4) Transposed() *Matrix4

type Quaternion added in v0.3.5

type Quaternion = Vector4

type RotationOrder added in v0.3.5

type RotationOrder int

type Vector2

type Vector2 struct {
	X Element
	Y Element
}

func NewVector2 added in v0.3.5

func NewVector2(x, y float32) *Vector2

func (*Vector2) Add

func (v *Vector2) Add(v2 *Vector2) *Vector2

func (*Vector2) Cross

func (v *Vector2) Cross(v2 *Vector2) Element

func (*Vector2) Dot

func (v *Vector2) Dot(v2 *Vector2) Element

func (*Vector2) Len

func (v *Vector2) Len() Element

func (*Vector2) LenSqr

func (v *Vector2) LenSqr() Element

func (*Vector2) Normalize

func (v *Vector2) Normalize() *Vector2

func (*Vector2) Sub

func (v *Vector2) Sub(v2 *Vector2) *Vector2

type Vector3

type Vector3 struct {
	X Element
	Y Element
	Z Element
}

func NewVector3 added in v0.3.5

func NewVector3(x, y, z float32) *Vector3

func NewVector3FromArray

func NewVector3FromArray(arr [3]Element) *Vector3

func NewVector3FromSlice

func NewVector3FromSlice(arr []Element) *Vector3

func (*Vector3) Add

func (v *Vector3) Add(v2 *Vector3) *Vector3

func (*Vector3) Cross

func (v *Vector3) Cross(v2 *Vector3) *Vector3

func (*Vector3) Dot

func (v *Vector3) Dot(v2 *Vector3) Element

func (*Vector3) Len

func (v *Vector3) Len() Element

func (*Vector3) LenSqr

func (v *Vector3) LenSqr() Element

func (*Vector3) Normalize

func (v *Vector3) Normalize() *Vector3

func (*Vector3) Scale added in v0.3.1

func (v *Vector3) Scale(s Element) *Vector3

func (*Vector3) Sub

func (v *Vector3) Sub(v2 *Vector3) *Vector3

func (*Vector3) ToArray

func (v *Vector3) ToArray(array []Element)

type Vector4

type Vector4 struct {
	X Element
	Y Element
	Z Element
	W Element
}

func NewQuaternion added in v0.3.5

func NewQuaternion(x, y, z, w float32) *Vector4

func NewQuaternionFromArray added in v0.3.5

func NewQuaternionFromArray(arr [4]Element) *Vector4

func (*Vector4) Add added in v0.3.2

func (v *Vector4) Add(v2 *Vector4) *Vector4

func (*Vector4) Dot

func (v *Vector4) Dot(v2 *Vector4) Element

func (*Vector4) Inverse

func (v *Vector4) Inverse() *Vector4

func (*Vector4) Len

func (v *Vector4) Len() Element

func (*Vector4) LenSqr

func (v *Vector4) LenSqr() Element

func (*Vector4) Mul

func (a *Vector4) Mul(b *Vector4) *Vector4

Returns Hamilton product

func (*Vector4) Normalize

func (v *Vector4) Normalize() *Vector4

func (*Vector4) Sub added in v0.3.2

func (v *Vector4) Sub(v2 *Vector4) *Vector4

Jump to

Keyboard shortcuts

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