space

package
v0.0.0-...-d322e89 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: BSD-2-Clause Imports: 2 Imported by: 3

Documentation

Overview

Package space implements mathematical objets and operations in three-dimensional euclidean space.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(m Matrix, v coord.XYZW) coord.XYZW

Apply a tranformation matrix to a vector (i.e. returns matrix multiplied by column vector).

Types

type Matrix

type Matrix [4][4]float32

Matrix represents a transformation matrix.

func EulerXYZ

func EulerXYZ(angleX, angleY, angleZ float32) Matrix

EulerXYZ returns a transformation matrix corresponding to a sequence of three intrinsic rotations around the (local) axis X, Y, Z, in that order.

func EulerXZY

func EulerXZY(angleX, angleY, angleZ float32) Matrix

EulerXZY returns a transformation matrix corresponding to a sequence of three intrinsic rotations around the (local) axis X, Z, Y, in that order.

func EulerYXZ

func EulerYXZ(angleX, angleY, angleZ float32) Matrix

EulerYXZ returns a transformation matrix corresponding to a sequence of three intrinsic rotations around the (local) axis Y, X, Z, in that order.

func EulerYZX

func EulerYZX(angleX, angleY, angleZ float32) Matrix

EulerYZX returns a transformation matrix corresponding to a sequence of three intrinsic rotations around the (local) axis Y, Z, X, in that order.

func EulerZXY

func EulerZXY(angleX, angleY, angleZ float32) Matrix

EulerZXY returns a transformation matrix corresponding to a sequence of three intrinsic rotations around the (local) axis Z, X, Y, in that order.

func EulerZYX

func EulerZYX(angleX, angleY, angleZ float32) Matrix

EulerZYX returns a transformation matrix corresponding to a sequence of three intrinsic rotations around the (local) axis Z, Y, X, in that order.

func Identity

func Identity() Matrix

Identity returns the identity matrix.

func LookAt

func LookAt(eye, target, up coord.XYZ) Matrix

LookAt returns a transformation matrix which put eye at origin and target along negative Z. In other words, if a projection matrix is applied to the result, target will be in the center of the viewport.

func Orthographic

func Orthographic(zoom, aspectRatio, near, far float32) Matrix

Orthographic returns an orthographic (parallel) projection matrix. (zoom is the height of the projection plane).

func OrthographicFrustum

func OrthographicFrustum(left, right, bottom, top, near, far float32) Matrix

OrthographicFrustum returns an orthographic (parallel) projection matrix.

func Perspective

func Perspective(fieldOfView, aspectRatio, near, far float32) Matrix

Perspective returns a perspective projection matrix.

func PerspectiveFrustum

func PerspectiveFrustum(left, right, bottom, top, near, far float32) Matrix

PerspectiveFrustum returns a perspective projection matrix.

func Rotation

func Rotation(angle float32, axis coord.XYZ) Matrix

Rotation around an axis.

func Scaling

func Scaling(s coord.XYZ) Matrix

Scaling along the 3 axis.

func Translation

func Translation(t coord.XYZ) Matrix

Translation by a vector.

func (Matrix) Times

func (m Matrix) Times(o Matrix) Matrix

Times returns the matrix product with another matrix.

func (Matrix) Translation

func (m Matrix) Translation() coord.XYZ

Translation returns the translation vector of the transformation matrix.

func (Matrix) Transpose

func (m Matrix) Transpose() Matrix

Transpose of the matrix.

func (Matrix) WithoutTranslation

func (m Matrix) WithoutTranslation() Matrix

WithoutTranslation returns the transformation matrix with the translation part removed.

Jump to

Keyboard shortcuts

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