mathgl

package module
Version: v0.0.0-...-791261b Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2017 License: BSD-3-Clause Imports: 3 Imported by: 31

README

Warning

This repository is no longer maintained. It has been included in the go-gl project and the new repository is kept here:

https://github.com/go-gl/mathgl

This repository is maintained because the new one has a sweeping API change. I will still process bug reports on this repository, but otherwise no development or features will be added.

MathGL

A code-generated 3D math library for the Go language.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clampd

func Clampd(a, t1, t2 float64) float64

func ClampdFunc

func ClampdFunc(t1, t2 float64) func(float64)

func Clampf

func Clampf(a, t1, t2 float32) float32

func ClampfFunc

func ClampfFunc(t1, t2 float32) func(float32)

func FloatEqual

func FloatEqual(a, b float64) bool

FloatEqual is a safe utility function to compare floats. It's Taken from http://floating-point-gui.de/errors/comparison/

It is slightly altered to not call Abs when not needed. Keep in mind that it expects float32s to be converted to float64s before being passed in, because they have to be converted for Abs anyway

func FloatEqual32

func FloatEqual32(a, b float32) bool

func FloatEqual32Func

func FloatEqual32Func(epsilon float32) func(float32, float32) bool

func FloatEqualFunc

func FloatEqualFunc(epsilon float64) func(float64, float64) bool

func FloatEqualThreshold

func FloatEqualThreshold(a, b, epsilon float64) bool

FloatEqualThreshold is a utility function to compare floats. It's Taken from http://floating-point-gui.de/errors/comparison/

It is slightly altered to not call Abs when not needed. Keep in mind that it expects float32s to be converted to float64s before being passed in, because they have to be converted for Abs anyway

This differs from FloatEqual in that it lets you pass in your comparison threshold, so that you can adjust the comparison value to your specific needs

func FloatEqualThreshold32

func FloatEqualThreshold32(a, b, epsilon float32) bool

func GLToScreenCoordsf

func GLToScreenCoordsf(x, y float32, screenWidth, screenHeight int) (xOut, yOut int)

Transform from GL's proportional system to pixel coordinates Assumes the pixel coordinate system has its origin in the top left corner. (GL's is in the bottom left)

GL's coordinate system maps [0,screenWidth] to [-1.0,1.0] and [0,screenHeight] to [1.0,-1.0]. If x and y are out of the range, they'll still be mapped correctly, just off the screen. (e.g. if y=-2.0, you'll get 2*screenHeight for yOut)

This is similar to Project, except for 2D cases and much simpler

func IsClampedd

func IsClampedd(a, t1, t2 float64) bool

func IsClampedf

func IsClampedf(a, t1, t2 float32) bool

func ReticulateSplinesf

func ReticulateSplinesf(ranges [][][2]float32, cPoints [][][]Vec2f, withLlamas bool)

Reticulates ALL the Splines

For the overly serious: the function is just for fun. It does nothing except prints a Maxis reference. Technically you could "reticulate splines" by joining a bunch of splines together, but that ruins the joke.

func ScreenToGLCoordsf

func ScreenToGLCoordsf(x, y int, screenWidth, screenHeight int) (xOut, yOut float32)

Transform from pixel coordinates to GL coordinates.

This assumes that your pixel coordinate system considers its origin to be in the top left corner (GL's is in the bottom left). The coordinates x and y may be out of the range [0,screenWidth] and [0,screeneHeight].

GL's coordinate system maps [0,screenWidth] to [-1.0,1.0] and [0,screenHeight] to [1.0,-1.0]. If x and y are out of the range, they'll still be mapped correctly, just off the screen. (e.g. if y = 2*screenHeight you'll get -2.0 for yOut)

This is similar to Unproject, except for 2D cases and much simpler (especially since an inverse may always be found)

func SetMaxd

func SetMaxd(a, b *float64)

func SetMaxf

func SetMaxf(a, b *float32)

func SetMind

func SetMind(a, b *float64)

func SetMinf

func SetMinf(a, b *float32)

Types

type Mat2d

type Mat2d [4]float64

func Ident2d

func Ident2d() Mat2d

func Rotate2Dd

func Rotate2Dd(angle float64) Mat2d

Rotate2D returns a rotation Matrix about a angle in 2-D space. Specifically about the origin. It is a 2x2 matrix, if you need a 3x3 for Homogeneous math (e.g. composition with a Translation matrix) see HomogRotate2D

func (Mat2d) Add

func (m1 Mat2d) Add(m2 Mat2d) Mat2d

func (Mat2d) ApproxEqual

func (m1 Mat2d) ApproxEqual(m2 Mat2d) bool

func (Mat2d) ApproxEqualThreshold

func (m1 Mat2d) ApproxEqualThreshold(m2 Mat2d, threshold float64) bool

func (Mat2d) ApproxFuncEqual

func (m1 Mat2d) ApproxFuncEqual(m2 Mat2d, eq func(float64, float64) bool) bool

func (Mat2d) Det

func (m Mat2d) Det() float64

func (Mat2d) Inv

func (m Mat2d) Inv() Mat2d

func (Mat2d) Mul

func (m1 Mat2d) Mul(c float64) Mat2d

func (Mat2d) Mul2

func (m1 Mat2d) Mul2(m2 Mat2d) Mat2d

func (Mat2d) Mul2x1

func (m1 Mat2d) Mul2x1(m2 Vec2d) Vec2d

func (Mat2d) Mul2x3

func (m1 Mat2d) Mul2x3(m2 Mat2x3d) Mat2x3d

func (Mat2d) Mul2x4

func (m1 Mat2d) Mul2x4(m2 Mat2x4d) Mat2x4d

func (Mat2d) Sub

func (m1 Mat2d) Sub(m2 Mat2d) Mat2d

func (Mat2d) Transpose

func (m1 Mat2d) Transpose() Mat2d

type Mat2f

type Mat2f [4]float32

func Ident2f

func Ident2f() Mat2f

func Rotate2D

func Rotate2D(angle float32) Mat2f

Rotate2D returns a rotation Matrix about a angle in 2-D space. Specifically about the origin. It is a 2x2 matrix, if you need a 3x3 for Homogeneous math (e.g. composition with a Translation matrix) see HomogRotate2D

func (Mat2f) Add

func (m1 Mat2f) Add(m2 Mat2f) Mat2f

func (Mat2f) ApproxEqual

func (m1 Mat2f) ApproxEqual(m2 Mat2f) bool

func (Mat2f) ApproxEqualThreshold

func (m1 Mat2f) ApproxEqualThreshold(m2 Mat2f, threshold float32) bool

func (Mat2f) ApproxFuncEqual

func (m1 Mat2f) ApproxFuncEqual(m2 Mat2f, eq func(float32, float32) bool) bool

func (Mat2f) Det

func (m Mat2f) Det() float32

func (Mat2f) Inv

func (m Mat2f) Inv() Mat2f

func (Mat2f) Mul

func (m1 Mat2f) Mul(c float32) Mat2f

func (Mat2f) Mul2

func (m1 Mat2f) Mul2(m2 Mat2f) Mat2f

func (Mat2f) Mul2x1

func (m1 Mat2f) Mul2x1(m2 Vec2f) Vec2f

func (Mat2f) Mul2x3

func (m1 Mat2f) Mul2x3(m2 Mat2x3f) Mat2x3f

func (Mat2f) Mul2x4

func (m1 Mat2f) Mul2x4(m2 Mat2x4f) Mat2x4f

func (Mat2f) Sub

func (m1 Mat2f) Sub(m2 Mat2f) Mat2f

func (Mat2f) Transpose

func (m1 Mat2f) Transpose() Mat2f

type Mat2x3d

type Mat2x3d [6]float64

func (Mat2x3d) Add

func (m1 Mat2x3d) Add(m2 Mat2x3d) Mat2x3d

func (Mat2x3d) ApproxEqual

func (m1 Mat2x3d) ApproxEqual(m2 Mat2x3d) bool

func (Mat2x3d) ApproxEqualThreshold

func (m1 Mat2x3d) ApproxEqualThreshold(m2 Mat2x3d, threshold float64) bool

func (Mat2x3d) ApproxFuncEqual

func (m1 Mat2x3d) ApproxFuncEqual(m2 Mat2x3d, eq func(float64, float64) bool) bool

func (Mat2x3d) Mul

func (m1 Mat2x3d) Mul(c float64) Mat2x3d

func (Mat2x3d) Mul3

func (m1 Mat2x3d) Mul3(m2 Mat3d) Mat2x3d

func (Mat2x3d) Mul3x1

func (m1 Mat2x3d) Mul3x1(m2 Vec3d) Vec2d

func (Mat2x3d) Mul3x2

func (m1 Mat2x3d) Mul3x2(m2 Mat3x2d) Mat2d

func (Mat2x3d) Mul3x4

func (m1 Mat2x3d) Mul3x4(m2 Mat3x4d) Mat2x4d

func (Mat2x3d) Sub

func (m1 Mat2x3d) Sub(m2 Mat2x3d) Mat2x3d

func (Mat2x3d) Transpose

func (m1 Mat2x3d) Transpose() Mat3x2d

type Mat2x3f

type Mat2x3f [6]float32

func (Mat2x3f) Add

func (m1 Mat2x3f) Add(m2 Mat2x3f) Mat2x3f

func (Mat2x3f) ApproxEqual

func (m1 Mat2x3f) ApproxEqual(m2 Mat2x3f) bool

func (Mat2x3f) ApproxEqualThreshold

func (m1 Mat2x3f) ApproxEqualThreshold(m2 Mat2x3f, threshold float32) bool

func (Mat2x3f) ApproxFuncEqual

func (m1 Mat2x3f) ApproxFuncEqual(m2 Mat2x3f, eq func(float32, float32) bool) bool

func (Mat2x3f) Mul

func (m1 Mat2x3f) Mul(c float32) Mat2x3f

func (Mat2x3f) Mul3

func (m1 Mat2x3f) Mul3(m2 Mat3f) Mat2x3f

func (Mat2x3f) Mul3x1

func (m1 Mat2x3f) Mul3x1(m2 Vec3f) Vec2f

func (Mat2x3f) Mul3x2

func (m1 Mat2x3f) Mul3x2(m2 Mat3x2f) Mat2f

func (Mat2x3f) Mul3x4

func (m1 Mat2x3f) Mul3x4(m2 Mat3x4f) Mat2x4f

func (Mat2x3f) Sub

func (m1 Mat2x3f) Sub(m2 Mat2x3f) Mat2x3f

func (Mat2x3f) Transpose

func (m1 Mat2x3f) Transpose() Mat3x2f

type Mat2x4d

type Mat2x4d [8]float64

func (Mat2x4d) Add

func (m1 Mat2x4d) Add(m2 Mat2x4d) Mat2x4d

func (Mat2x4d) ApproxEqual

func (m1 Mat2x4d) ApproxEqual(m2 Mat2x4d) bool

func (Mat2x4d) ApproxEqualThreshold

func (m1 Mat2x4d) ApproxEqualThreshold(m2 Mat2x4d, threshold float64) bool

func (Mat2x4d) ApproxFuncEqual

func (m1 Mat2x4d) ApproxFuncEqual(m2 Mat2x4d, eq func(float64, float64) bool) bool

func (Mat2x4d) Mul

func (m1 Mat2x4d) Mul(c float64) Mat2x4d

func (Mat2x4d) Mul4

func (m1 Mat2x4d) Mul4(m2 Mat4d) Mat2x4d

func (Mat2x4d) Mul4x1

func (m1 Mat2x4d) Mul4x1(m2 Vec4d) Vec2d

func (Mat2x4d) Mul4x2

func (m1 Mat2x4d) Mul4x2(m2 Mat4x2d) Mat2d

func (Mat2x4d) Mul4x3

func (m1 Mat2x4d) Mul4x3(m2 Mat4x3d) Mat2x3d

func (Mat2x4d) Sub

func (m1 Mat2x4d) Sub(m2 Mat2x4d) Mat2x4d

func (Mat2x4d) Transpose

func (m1 Mat2x4d) Transpose() Mat4x2d

type Mat2x4f

type Mat2x4f [8]float32

func (Mat2x4f) Add

func (m1 Mat2x4f) Add(m2 Mat2x4f) Mat2x4f

func (Mat2x4f) ApproxEqual

func (m1 Mat2x4f) ApproxEqual(m2 Mat2x4f) bool

func (Mat2x4f) ApproxEqualThreshold

func (m1 Mat2x4f) ApproxEqualThreshold(m2 Mat2x4f, threshold float32) bool

func (Mat2x4f) ApproxFuncEqual

func (m1 Mat2x4f) ApproxFuncEqual(m2 Mat2x4f, eq func(float32, float32) bool) bool

func (Mat2x4f) Mul

func (m1 Mat2x4f) Mul(c float32) Mat2x4f

func (Mat2x4f) Mul4

func (m1 Mat2x4f) Mul4(m2 Mat4f) Mat2x4f

func (Mat2x4f) Mul4x1

func (m1 Mat2x4f) Mul4x1(m2 Vec4f) Vec2f

func (Mat2x4f) Mul4x2

func (m1 Mat2x4f) Mul4x2(m2 Mat4x2f) Mat2f

func (Mat2x4f) Mul4x3

func (m1 Mat2x4f) Mul4x3(m2 Mat4x3f) Mat2x3f

func (Mat2x4f) Sub

func (m1 Mat2x4f) Sub(m2 Mat2x4f) Mat2x4f

func (Mat2x4f) Transpose

func (m1 Mat2x4f) Transpose() Mat4x2f

type Mat3d

type Mat3d [9]float64

func HomogRotate2Dd

func HomogRotate2Dd(angle float64) Mat3d

Same as Rotate2D, except homogeneous (3x3 with the extra row/col being all zeroes with a one in the bottom right)

func Ident3d

func Ident3d() Mat3d

func Rotate3DXd

func Rotate3DXd(angle float64) Mat3d

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

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

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

func Rotate3DYd

func Rotate3DYd(angle float64) Mat3d

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 Rotate3DZd

func Rotate3DZd(angle float64) Mat3d

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 Scale2Dd

func Scale2Dd(scaleX, scaleY float64) Mat3d

Scale2D creates a homogeneous 2D scaling matrix [[ scaleX, 0 , 0 ]] [[ 0 , scaleY, 0 ]] [[ 0 , 0 , 1 ]]

func ShearX2Dd

func ShearX2Dd(shear float64) Mat3d

ShearX2D creates a homogeneous 2D shear matrix along the X-axis

func ShearY2Dd

func ShearY2Dd(shear float64) Mat3d

ShearY2D creates a homogeneous 2D shear matrix along the Y-axis

func Translate2Dd

func Translate2Dd(Tx, Ty float64) Mat3d

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 (Mat3d) Add

func (m1 Mat3d) Add(m2 Mat3d) Mat3d

func (Mat3d) ApproxEqual

func (m1 Mat3d) ApproxEqual(m2 Mat3d) bool

func (Mat3d) ApproxEqualThreshold

func (m1 Mat3d) ApproxEqualThreshold(m2 Mat3d, threshold float64) bool

func (Mat3d) ApproxFuncEqual

func (m1 Mat3d) ApproxFuncEqual(m2 Mat3d, eq func(float64, float64) bool) bool

func (Mat3d) Det

func (m Mat3d) Det() float64

func (Mat3d) Inv

func (m Mat3d) Inv() Mat3d

func (Mat3d) Mul

func (m1 Mat3d) Mul(c float64) Mat3d

func (Mat3d) Mul3

func (m1 Mat3d) Mul3(m2 Mat3d) Mat3d

func (Mat3d) Mul3x1

func (m1 Mat3d) Mul3x1(m2 Vec3d) Vec3d

func (Mat3d) Mul3x2

func (m1 Mat3d) Mul3x2(m2 Mat3x2d) Mat3x2d

func (Mat3d) Mul3x4

func (m1 Mat3d) Mul3x4(m2 Mat3x4d) Mat3x4d

func (Mat3d) Sub

func (m1 Mat3d) Sub(m2 Mat3d) Mat3d

func (Mat3d) Transpose

func (m1 Mat3d) Transpose() Mat3d

type Mat3f

type Mat3f [9]float32

func HomogRotate2D

func HomogRotate2D(angle float32) Mat3f

Same as Rotate2D, except homogeneous (3x3 with the extra row/col being all zeroes with a one in the bottom right)

func Ident3f

func Ident3f() Mat3f

func Rotate3DX

func Rotate3DX(angle float32) Mat3f

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

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

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

func Rotate3DY

func Rotate3DY(angle float32) Mat3f

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) Mat3f

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 Scale2D

func Scale2D(scaleX, scaleY float32) Mat3f

Scale2D creates a homogeneous 2D scaling matrix [[ scaleX, 0 , 0 ]] [[ 0 , scaleY, 0 ]] [[ 0 , 0 , 1 ]]

func ShearX2D

func ShearX2D(shear float32) Mat3f

ShearX2D creates a homogeneous 2D shear matrix along the X-axis

func ShearY2D

func ShearY2D(shear float32) Mat3f

ShearY2D creates a homogeneous 2D shear matrix along the Y-axis

func Translate2D

func Translate2D(Tx, Ty float32) Mat3f

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 (Mat3f) Add

func (m1 Mat3f) Add(m2 Mat3f) Mat3f

func (Mat3f) ApproxEqual

func (m1 Mat3f) ApproxEqual(m2 Mat3f) bool

func (Mat3f) ApproxEqualThreshold

func (m1 Mat3f) ApproxEqualThreshold(m2 Mat3f, threshold float32) bool

func (Mat3f) ApproxFuncEqual

func (m1 Mat3f) ApproxFuncEqual(m2 Mat3f, eq func(float32, float32) bool) bool

func (Mat3f) Det

func (m Mat3f) Det() float32

func (Mat3f) Inv

func (m Mat3f) Inv() Mat3f

func (Mat3f) Mul

func (m1 Mat3f) Mul(c float32) Mat3f

func (Mat3f) Mul3

func (m1 Mat3f) Mul3(m2 Mat3f) Mat3f

func (Mat3f) Mul3x1

func (m1 Mat3f) Mul3x1(m2 Vec3f) Vec3f

func (Mat3f) Mul3x2

func (m1 Mat3f) Mul3x2(m2 Mat3x2f) Mat3x2f

func (Mat3f) Mul3x4

func (m1 Mat3f) Mul3x4(m2 Mat3x4f) Mat3x4f

func (Mat3f) Sub

func (m1 Mat3f) Sub(m2 Mat3f) Mat3f

func (Mat3f) Transpose

func (m1 Mat3f) Transpose() Mat3f

type Mat3x2d

type Mat3x2d [6]float64

func (Mat3x2d) Add

func (m1 Mat3x2d) Add(m2 Mat3x2d) Mat3x2d

func (Mat3x2d) ApproxEqual

func (m1 Mat3x2d) ApproxEqual(m2 Mat3x2d) bool

func (Mat3x2d) ApproxEqualThreshold

func (m1 Mat3x2d) ApproxEqualThreshold(m2 Mat3x2d, threshold float64) bool

func (Mat3x2d) ApproxFuncEqual

func (m1 Mat3x2d) ApproxFuncEqual(m2 Mat3x2d, eq func(float64, float64) bool) bool

func (Mat3x2d) Mul

func (m1 Mat3x2d) Mul(c float64) Mat3x2d

func (Mat3x2d) Mul2

func (m1 Mat3x2d) Mul2(m2 Mat2d) Mat3x2d

func (Mat3x2d) Mul2x1

func (m1 Mat3x2d) Mul2x1(m2 Vec2d) Vec3d

func (Mat3x2d) Mul2x3

func (m1 Mat3x2d) Mul2x3(m2 Mat2x3d) Mat3d

func (Mat3x2d) Mul2x4

func (m1 Mat3x2d) Mul2x4(m2 Mat2x4d) Mat3x4d

func (Mat3x2d) Sub

func (m1 Mat3x2d) Sub(m2 Mat3x2d) Mat3x2d

func (Mat3x2d) Transpose

func (m1 Mat3x2d) Transpose() Mat2x3d

type Mat3x2f

type Mat3x2f [6]float32

func (Mat3x2f) Add

func (m1 Mat3x2f) Add(m2 Mat3x2f) Mat3x2f

func (Mat3x2f) ApproxEqual

func (m1 Mat3x2f) ApproxEqual(m2 Mat3x2f) bool

func (Mat3x2f) ApproxEqualThreshold

func (m1 Mat3x2f) ApproxEqualThreshold(m2 Mat3x2f, threshold float32) bool

func (Mat3x2f) ApproxFuncEqual

func (m1 Mat3x2f) ApproxFuncEqual(m2 Mat3x2f, eq func(float32, float32) bool) bool

func (Mat3x2f) Mul

func (m1 Mat3x2f) Mul(c float32) Mat3x2f

func (Mat3x2f) Mul2

func (m1 Mat3x2f) Mul2(m2 Mat2f) Mat3x2f

func (Mat3x2f) Mul2x1

func (m1 Mat3x2f) Mul2x1(m2 Vec2f) Vec3f

func (Mat3x2f) Mul2x3

func (m1 Mat3x2f) Mul2x3(m2 Mat2x3f) Mat3f

func (Mat3x2f) Mul2x4

func (m1 Mat3x2f) Mul2x4(m2 Mat2x4f) Mat3x4f

func (Mat3x2f) Sub

func (m1 Mat3x2f) Sub(m2 Mat3x2f) Mat3x2f

func (Mat3x2f) Transpose

func (m1 Mat3x2f) Transpose() Mat2x3f

type Mat3x4d

type Mat3x4d [12]float64

func (Mat3x4d) Add

func (m1 Mat3x4d) Add(m2 Mat3x4d) Mat3x4d

func (Mat3x4d) ApproxEqual

func (m1 Mat3x4d) ApproxEqual(m2 Mat3x4d) bool

func (Mat3x4d) ApproxEqualThreshold

func (m1 Mat3x4d) ApproxEqualThreshold(m2 Mat3x4d, threshold float64) bool

func (Mat3x4d) ApproxFuncEqual

func (m1 Mat3x4d) ApproxFuncEqual(m2 Mat3x4d, eq func(float64, float64) bool) bool

func (Mat3x4d) Mul

func (m1 Mat3x4d) Mul(c float64) Mat3x4d

func (Mat3x4d) Mul4

func (m1 Mat3x4d) Mul4(m2 Mat4d) Mat3x4d

func (Mat3x4d) Mul4x1

func (m1 Mat3x4d) Mul4x1(m2 Vec4d) Vec3d

func (Mat3x4d) Mul4x2

func (m1 Mat3x4d) Mul4x2(m2 Mat4x2d) Mat3x2d

func (Mat3x4d) Mul4x3

func (m1 Mat3x4d) Mul4x3(m2 Mat4x3d) Mat3d

func (Mat3x4d) Sub

func (m1 Mat3x4d) Sub(m2 Mat3x4d) Mat3x4d

func (Mat3x4d) Transpose

func (m1 Mat3x4d) Transpose() Mat4x3d

type Mat3x4f

type Mat3x4f [12]float32

func (Mat3x4f) Add

func (m1 Mat3x4f) Add(m2 Mat3x4f) Mat3x4f

func (Mat3x4f) ApproxEqual

func (m1 Mat3x4f) ApproxEqual(m2 Mat3x4f) bool

func (Mat3x4f) ApproxEqualThreshold

func (m1 Mat3x4f) ApproxEqualThreshold(m2 Mat3x4f, threshold float32) bool

func (Mat3x4f) ApproxFuncEqual

func (m1 Mat3x4f) ApproxFuncEqual(m2 Mat3x4f, eq func(float32, float32) bool) bool

func (Mat3x4f) Mul

func (m1 Mat3x4f) Mul(c float32) Mat3x4f

func (Mat3x4f) Mul4

func (m1 Mat3x4f) Mul4(m2 Mat4f) Mat3x4f

func (Mat3x4f) Mul4x1

func (m1 Mat3x4f) Mul4x1(m2 Vec4f) Vec3f

func (Mat3x4f) Mul4x2

func (m1 Mat3x4f) Mul4x2(m2 Mat4x2f) Mat3x2f

func (Mat3x4f) Mul4x3

func (m1 Mat3x4f) Mul4x3(m2 Mat4x3f) Mat3f

func (Mat3x4f) Sub

func (m1 Mat3x4f) Sub(m2 Mat3x4f) Mat3x4f

func (Mat3x4f) Transpose

func (m1 Mat3x4f) Transpose() Mat4x3f

type Mat4d

type Mat4d [16]float64

func Frustumd

func Frustumd(left, right, bottom, top, near, far float64) Mat4d

func HomogRotate3DXd

func HomogRotate3DXd(angle float64) Mat4d

Same as Rotate3DX, except homogeneous (4x4 with the extra row/col being all zeroes with a one in the bottom right)

func HomogRotate3DYd

func HomogRotate3DYd(angle float64) Mat4d

Same as Rotate3DY, except homogeneous (4x4 with the extra row/col being all zeroes with a one in the bottom right)

func HomogRotate3DZd

func HomogRotate3DZd(angle float64) Mat4d

Same as Rotate3DZ, except homogeneous (4x4 with the extra row/col being all zeroes with a one in the bottom right)

func HomogRotate3Dd

func HomogRotate3Dd(angle float64, axis Vec3d) Mat4d

HomogRotate3D creates a 3D rotation Matrix that rotates by (radian) angle about some arbitrary axis given by a Vector. It produces a homogeneous matrix (4x4)

Where c is cos(angle) and s is sin(angle), and x, y, and z are the first, second, and third elements of the axis vector (respectively):

[[ x^2(c-1)+c, xy(c-1)-zs, xz(c-1)+ys, 0 ]]
[[ xy(c-1)+zs, y^2(c-1)+c, yz(c-1)-xs, 0 ]]
[[ xz(c-1)-ys, yz(c-1)+xs, z^2(c-1)+c, 0 ]]
[[ 0         , 0         , 0         , 1 ]]

func Ident4d

func Ident4d() Mat4d

func LookAtVd

func LookAtVd(eye, center, up Vec3d) Mat4d

func LookAtd

func LookAtd(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ float64) Mat4d

func Ortho2Dd

func Ortho2Dd(left, right, top, bottom float64) Mat4d

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

func Orthod

func Orthod(left, right, bottom, top, near, far float64) Mat4d

func Perspectived

func Perspectived(fovy, aspect, near, far float64) Mat4d

func Scale3Dd

func Scale3Dd(scaleX, scaleY, scaleZ float64) Mat4d

Scale3D creates a homogeneous 3D scaling matrix [[ scaleX, 0 , 0 , 0 ]] [[ 0 , scaleY, 0 , 0 ]] [[ 0 , 0 , scaleZ, 0 ]] [[ 0 , 0 , 0 , 1 ]]

func ShearX3Dd

func ShearX3Dd(shearY, shearZ float64) Mat4d

ShearX3D creates a homogeneous 3D shear matrix along the X-axis

func ShearY3Dd

func ShearY3Dd(shearX, shearZ float64) Mat4d

ShearY3D creates a homogeneous 3D shear matrix along the Y-axis

func ShearZ3Dd

func ShearZ3Dd(shearX, shearY float64) Mat4d

ShearZ3D creates a homogeneous 3D shear matrix along the Z-axis

func Translate3Dd

func Translate3Dd(Tx, Ty, Tz float64) Mat4d

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 (Mat4d) Add

func (m1 Mat4d) Add(m2 Mat4d) Mat4d

func (Mat4d) ApproxEqual

func (m1 Mat4d) ApproxEqual(m2 Mat4d) bool

func (Mat4d) ApproxEqualThreshold

func (m1 Mat4d) ApproxEqualThreshold(m2 Mat4d, threshold float64) bool

func (Mat4d) ApproxFuncEqual

func (m1 Mat4d) ApproxFuncEqual(m2 Mat4d, eq func(float64, float64) bool) bool

func (Mat4d) Det

func (m Mat4d) Det() float64

func (Mat4d) Inv

func (m Mat4d) Inv() Mat4d

func (Mat4d) Mul

func (m1 Mat4d) Mul(c float64) Mat4d

func (Mat4d) Mul4

func (m1 Mat4d) Mul4(m2 Mat4d) Mat4d

func (Mat4d) Mul4x1

func (m1 Mat4d) Mul4x1(m2 Vec4d) Vec4d

func (Mat4d) Mul4x2

func (m1 Mat4d) Mul4x2(m2 Mat4x2d) Mat4x2d

func (Mat4d) Mul4x3

func (m1 Mat4d) Mul4x3(m2 Mat4x3d) Mat4x3d

func (Mat4d) Sub

func (m1 Mat4d) Sub(m2 Mat4d) Mat4d

func (Mat4d) Transpose

func (m1 Mat4d) Transpose() Mat4d

type Mat4f

type Mat4f [16]float32

func Frustum

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

func HomogRotate3D

func HomogRotate3D(angle float32, axis Vec3f) Mat4f

HomogRotate3D creates a 3D rotation Matrix that rotates by (radian) angle about some arbitrary axis given by a Vector. It produces a homogeneous matrix (4x4)

Where c is cos(angle) and s is sin(angle), and x, y, and z are the first, second, and third elements of the axis vector (respectively):

[[ x^2(c-1)+c, xy(c-1)-zs, xz(c-1)+ys, 0 ]]
[[ xy(c-1)+zs, y^2(c-1)+c, yz(c-1)-xs, 0 ]]
[[ xz(c-1)-ys, yz(c-1)+xs, z^2(c-1)+c, 0 ]]
[[ 0         , 0         , 0         , 1 ]]

func HomogRotate3DX

func HomogRotate3DX(angle float32) Mat4f

Same as Rotate3DX, except homogeneous (4x4 with the extra row/col being all zeroes with a one in the bottom right)

func HomogRotate3DY

func HomogRotate3DY(angle float32) Mat4f

Same as Rotate3DY, except homogeneous (4x4 with the extra row/col being all zeroes with a one in the bottom right)

func HomogRotate3DZ

func HomogRotate3DZ(angle float32) Mat4f

Same as Rotate3DZ, except homogeneous (4x4 with the extra row/col being all zeroes with a one in the bottom right)

func Ident4f

func Ident4f() Mat4f

func LookAt

func LookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ float32) Mat4f

func LookAtV

func LookAtV(eye, center, up Vec3f) Mat4f

func Ortho

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

func Ortho2D

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

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

func Perspective

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

func Scale3D

func Scale3D(scaleX, scaleY, scaleZ float32) Mat4f

Scale3D creates a homogeneous 3D scaling matrix [[ scaleX, 0 , 0 , 0 ]] [[ 0 , scaleY, 0 , 0 ]] [[ 0 , 0 , scaleZ, 0 ]] [[ 0 , 0 , 0 , 1 ]]

func ShearX3D

func ShearX3D(shearY, shearZ float32) Mat4f

ShearX3D creates a homogeneous 3D shear matrix along the X-axis

func ShearY3D

func ShearY3D(shearX, shearZ float32) Mat4f

ShearY3D creates a homogeneous 3D shear matrix along the Y-axis

func ShearZ3D

func ShearZ3D(shearX, shearY float32) Mat4f

ShearZ3D creates a homogeneous 3D shear matrix along the Z-axis

func Translate3D

func Translate3D(Tx, Ty, Tz float32) Mat4f

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 (Mat4f) Add

func (m1 Mat4f) Add(m2 Mat4f) Mat4f

func (Mat4f) ApproxEqual

func (m1 Mat4f) ApproxEqual(m2 Mat4f) bool

func (Mat4f) ApproxEqualThreshold

func (m1 Mat4f) ApproxEqualThreshold(m2 Mat4f, threshold float32) bool

func (Mat4f) ApproxFuncEqual

func (m1 Mat4f) ApproxFuncEqual(m2 Mat4f, eq func(float32, float32) bool) bool

func (Mat4f) Det

func (m Mat4f) Det() float32

func (Mat4f) Inv

func (m Mat4f) Inv() Mat4f

func (Mat4f) Mul

func (m1 Mat4f) Mul(c float32) Mat4f

func (Mat4f) Mul4

func (m1 Mat4f) Mul4(m2 Mat4f) Mat4f

func (Mat4f) Mul4x1

func (m1 Mat4f) Mul4x1(m2 Vec4f) Vec4f

func (Mat4f) Mul4x2

func (m1 Mat4f) Mul4x2(m2 Mat4x2f) Mat4x2f

func (Mat4f) Mul4x3

func (m1 Mat4f) Mul4x3(m2 Mat4x3f) Mat4x3f

func (Mat4f) Sub

func (m1 Mat4f) Sub(m2 Mat4f) Mat4f

func (Mat4f) Transpose

func (m1 Mat4f) Transpose() Mat4f

type Mat4x2d

type Mat4x2d [8]float64

func (Mat4x2d) Add

func (m1 Mat4x2d) Add(m2 Mat4x2d) Mat4x2d

func (Mat4x2d) ApproxEqual

func (m1 Mat4x2d) ApproxEqual(m2 Mat4x2d) bool

func (Mat4x2d) ApproxEqualThreshold

func (m1 Mat4x2d) ApproxEqualThreshold(m2 Mat4x2d, threshold float64) bool

func (Mat4x2d) ApproxFuncEqual

func (m1 Mat4x2d) ApproxFuncEqual(m2 Mat4x2d, eq func(float64, float64) bool) bool

func (Mat4x2d) Mul

func (m1 Mat4x2d) Mul(c float64) Mat4x2d

func (Mat4x2d) Mul2

func (m1 Mat4x2d) Mul2(m2 Mat2d) Mat4x2d

func (Mat4x2d) Mul2x1

func (m1 Mat4x2d) Mul2x1(m2 Vec2d) Vec4d

func (Mat4x2d) Mul2x3

func (m1 Mat4x2d) Mul2x3(m2 Mat2x3d) Mat4x3d

func (Mat4x2d) Mul2x4

func (m1 Mat4x2d) Mul2x4(m2 Mat2x4d) Mat4d

func (Mat4x2d) Sub

func (m1 Mat4x2d) Sub(m2 Mat4x2d) Mat4x2d

func (Mat4x2d) Transpose

func (m1 Mat4x2d) Transpose() Mat2x4d

type Mat4x2f

type Mat4x2f [8]float32

func (Mat4x2f) Add

func (m1 Mat4x2f) Add(m2 Mat4x2f) Mat4x2f

func (Mat4x2f) ApproxEqual

func (m1 Mat4x2f) ApproxEqual(m2 Mat4x2f) bool

func (Mat4x2f) ApproxEqualThreshold

func (m1 Mat4x2f) ApproxEqualThreshold(m2 Mat4x2f, threshold float32) bool

func (Mat4x2f) ApproxFuncEqual

func (m1 Mat4x2f) ApproxFuncEqual(m2 Mat4x2f, eq func(float32, float32) bool) bool

func (Mat4x2f) Mul

func (m1 Mat4x2f) Mul(c float32) Mat4x2f

func (Mat4x2f) Mul2

func (m1 Mat4x2f) Mul2(m2 Mat2f) Mat4x2f

func (Mat4x2f) Mul2x1

func (m1 Mat4x2f) Mul2x1(m2 Vec2f) Vec4f

func (Mat4x2f) Mul2x3

func (m1 Mat4x2f) Mul2x3(m2 Mat2x3f) Mat4x3f

func (Mat4x2f) Mul2x4

func (m1 Mat4x2f) Mul2x4(m2 Mat2x4f) Mat4f

func (Mat4x2f) Sub

func (m1 Mat4x2f) Sub(m2 Mat4x2f) Mat4x2f

func (Mat4x2f) Transpose

func (m1 Mat4x2f) Transpose() Mat2x4f

type Mat4x3d

type Mat4x3d [12]float64

func (Mat4x3d) Add

func (m1 Mat4x3d) Add(m2 Mat4x3d) Mat4x3d

func (Mat4x3d) ApproxEqual

func (m1 Mat4x3d) ApproxEqual(m2 Mat4x3d) bool

func (Mat4x3d) ApproxEqualThreshold

func (m1 Mat4x3d) ApproxEqualThreshold(m2 Mat4x3d, threshold float64) bool

func (Mat4x3d) ApproxFuncEqual

func (m1 Mat4x3d) ApproxFuncEqual(m2 Mat4x3d, eq func(float64, float64) bool) bool

func (Mat4x3d) Mul

func (m1 Mat4x3d) Mul(c float64) Mat4x3d

func (Mat4x3d) Mul3

func (m1 Mat4x3d) Mul3(m2 Mat3d) Mat4x3d

func (Mat4x3d) Mul3x1

func (m1 Mat4x3d) Mul3x1(m2 Vec3d) Vec4d

func (Mat4x3d) Mul3x2

func (m1 Mat4x3d) Mul3x2(m2 Mat3x2d) Mat4x2d

func (Mat4x3d) Mul3x4

func (m1 Mat4x3d) Mul3x4(m2 Mat3x4d) Mat4d

func (Mat4x3d) Sub

func (m1 Mat4x3d) Sub(m2 Mat4x3d) Mat4x3d

func (Mat4x3d) Transpose

func (m1 Mat4x3d) Transpose() Mat3x4d

type Mat4x3f

type Mat4x3f [12]float32

func (Mat4x3f) Add

func (m1 Mat4x3f) Add(m2 Mat4x3f) Mat4x3f

func (Mat4x3f) ApproxEqual

func (m1 Mat4x3f) ApproxEqual(m2 Mat4x3f) bool

func (Mat4x3f) ApproxEqualThreshold

func (m1 Mat4x3f) ApproxEqualThreshold(m2 Mat4x3f, threshold float32) bool

func (Mat4x3f) ApproxFuncEqual

func (m1 Mat4x3f) ApproxFuncEqual(m2 Mat4x3f, eq func(float32, float32) bool) bool

func (Mat4x3f) Mul

func (m1 Mat4x3f) Mul(c float32) Mat4x3f

func (Mat4x3f) Mul3

func (m1 Mat4x3f) Mul3(m2 Mat3f) Mat4x3f

func (Mat4x3f) Mul3x1

func (m1 Mat4x3f) Mul3x1(m2 Vec3f) Vec4f

func (Mat4x3f) Mul3x2

func (m1 Mat4x3f) Mul3x2(m2 Mat3x2f) Mat4x2f

func (Mat4x3f) Mul3x4

func (m1 Mat4x3f) Mul3x4(m2 Mat3x4f) Mat4f

func (Mat4x3f) Sub

func (m1 Mat4x3f) Sub(m2 Mat4x3f) Mat4x3f

func (Mat4x3f) Transpose

func (m1 Mat4x3f) Transpose() Mat3x4f

type Quatd

type Quatd struct {
	W float64
	V Vec3d
}

func EulerToQuatd

func EulerToQuatd(xAngle, yAngle, zAngle float64) Quatd

func QuatIdentd

func QuatIdentd() Quatd

func QuatLerpd

func QuatLerpd(q1, q2 Quatd, amount float64) Quatd

func QuatNlerpd

func QuatNlerpd(q1, q2 Quatd, amount float64) Quatd

func QuatRotated

func QuatRotated(angle float64, axis Vec3d) Quatd

func QuatSlerpd

func QuatSlerpd(q1, q2 Quatd, amount float64) Quatd

func (Quatd) Add

func (q1 Quatd) Add(q2 Quatd) Quatd

func (Quatd) Conjugate

func (q1 Quatd) Conjugate() Quatd

func (Quatd) Dot

func (q1 Quatd) Dot(q2 Quatd) float64

func (Quatd) Inverse

func (q1 Quatd) Inverse() Quatd

func (Quatd) Len

func (q1 Quatd) Len() float64

func (Quatd) Mat4

func (q1 Quatd) Mat4() Mat4d

func (Quatd) Mul

func (q1 Quatd) Mul(q2 Quatd) Quatd

func (Quatd) Normalize

func (q1 Quatd) Normalize() Quatd

func (Quatd) Rotate

func (q1 Quatd) Rotate(v Vec3d) Vec3d

func (Quatd) Scale

func (q1 Quatd) Scale(c float64) Quatd

func (Quatd) Sub

func (q1 Quatd) Sub(q2 Quatd) Quatd

func (Quatd) X

func (q Quatd) X() float64

func (Quatd) Y

func (q Quatd) Y() float64

func (Quatd) Z

func (q Quatd) Z() float64

type Quatf

type Quatf struct {
	W float32
	V Vec3f
}

func EulerToQuatf

func EulerToQuatf(xAngle, yAngle, zAngle float32) Quatf

func QuatIdentf

func QuatIdentf() Quatf

func QuatLerpf

func QuatLerpf(q1, q2 Quatf, amount float32) Quatf

func QuatNlerpf

func QuatNlerpf(q1, q2 Quatf, amount float32) Quatf

func QuatRotatef

func QuatRotatef(angle float32, axis Vec3f) Quatf

func QuatSlerpf

func QuatSlerpf(q1, q2 Quatf, amount float32) Quatf

func (Quatf) Add

func (q1 Quatf) Add(q2 Quatf) Quatf

func (Quatf) Conjugate

func (q1 Quatf) Conjugate() Quatf

func (Quatf) Dot

func (q1 Quatf) Dot(q2 Quatf) float32

func (Quatf) Inverse

func (q1 Quatf) Inverse() Quatf

func (Quatf) Len

func (q1 Quatf) Len() float32

func (Quatf) Mat4

func (q1 Quatf) Mat4() Mat4f

func (Quatf) Mul

func (q1 Quatf) Mul(q2 Quatf) Quatf

func (Quatf) Normalize

func (q1 Quatf) Normalize() Quatf

func (Quatf) Rotate

func (q1 Quatf) Rotate(v Vec3f) Vec3f

func (Quatf) Scale

func (q1 Quatf) Scale(c float32) Quatf

func (Quatf) Sub

func (q1 Quatf) Sub(q2 Quatf) Quatf

func (Quatf) X

func (q Quatf) X() float32

func (Quatf) Y

func (q Quatf) Y() float32

func (Quatf) Z

func (q Quatf) Z() float32

type Vec2d

type Vec2d [2]float64

func (Vec2d) Add

func (v1 Vec2d) Add(v2 Vec2d) Vec2d

func (Vec2d) ApproxEqual

func (v1 Vec2d) ApproxEqual(v2 Vec2d) bool

func (Vec2d) ApproxEqualTheshold

func (v1 Vec2d) ApproxEqualTheshold(v2 Vec2d, threshold float64) bool

func (Vec2d) ApproxFuncEqual

func (v1 Vec2d) ApproxFuncEqual(v2 Vec2d, eq func(float64, float64) bool) bool

func (Vec2d) Dot

func (v1 Vec2d) Dot(v2 Vec2d) float64

func (Vec2d) Len

func (v1 Vec2d) Len() float64

func (Vec2d) Mul

func (v1 Vec2d) Mul(c float64) Vec2d

func (Vec2d) Normalize

func (v1 Vec2d) Normalize() Vec2d

func (Vec2d) Sub

func (v1 Vec2d) Sub(v2 Vec2d) Vec2d

type Vec2f

type Vec2f [2]float32

func BezierCurve2Df

func BezierCurve2Df(t float32, cPoints []Vec2f) Vec2f

Returns the point at point t along an n-control point Bezier curve

t must be in the range 0.0 and 1.0 or this function will panic. Consider [0.0,1.0] to be similar to a percentage, 0.0 is first control point, and the point at 1.0 is the last control point. Any point in between is how far along the path you are between 0 and 1.

This function is not sensative to the coordinate system of the control points. It will correctly interpolate regardless of whether they're in screen coords, gl coords, or something else entirely

func BezierSplineInterpolate2Df

func BezierSplineInterpolate2Df(t float32, ranges [][2]float32, cPoints [][]Vec2f) Vec2f

Does interpolation over a spline of several bezier curves. Each bezier curve must have a finite range, though the spline may be disjoint. The bezier curves are not required to be in any particular order.

If t is out of the range of all given curves, this function will panic

func Circlef

func Circlef(radiusX, radiusY float32, numSlices int) []Vec2f

Generates a circle centered at (0,0) with a given radius. The radii are assumed to be in GL's coordinate sizing.

Technically this draws an ellipse with two axes that match with the X and Y axes, the reason it has a radiusX and radiusY is because GL's coordinate system is proportional to screen width and screen height. So if you have a non-square viewport, a single radius will appear to "squash" the circle in one direction (usually the Y direction), so the X and Y radius allow for a circle to be made. A good way to get the correct radii is with mathgl.ScreenToGLCoords(radius, radius, screenWidth, screenHeight) which will get you the correct proportional GL coords.

The numSlices argument specifies how many triangles you want your circle divided into, setting this number to too low a value may cause problem (and too high will cause it to take a lot of memory and time to compute without much gain in resolution).

This uses discrete triangles, not a triangle fan

func CubicBezierCurve2Df

func CubicBezierCurve2Df(t float32, cPoint1, cPoint2, cPoint3, cPoint4 Vec2f) Vec2f

func MakeBezierCurve2Df

func MakeBezierCurve2Df(numPoints int, cPoints []Vec2f) (line []Vec2f)

Generates a bezier curve with controlPoints cPoints. The numPoints argument determines how many "samples" it makes along the line. For instance, a call to this with numPoints 2 will have exactly two points: the start and end points For any points above 2 it will divide it into numPoints-1 chunks (which means it will generate numPoints-2 vertices other than the beginning and end). So for 3 points it will divide it in half, 4 points into thirds, and so on.

This is likely to get rather expensive for anything over perhaps a cubic curve.

func QuadraticBezierCurve2Df

func QuadraticBezierCurve2Df(t float32, cPoint1, cPoint2, cPoint3 Vec2f) Vec2f

func Rectf

func Rectf(width, height float32) []Vec2f

Generates a 2-triangle rectangle for use with GL_TRIANGLES. The width and height should use GL's proportions (that is, where a width of 1.0 is equivalent to half of the width of the render target); however, the y-coordinates grow downwards, not upwards. That is, it assumes you want the origin of the rectangle with the top-left corner at (0.0,0.0).

Keep in mind that GL's coordinate system is proportional, so width=height will not result in a square unless your viewport is square. If you want to maintain proportionality regardless of screen size, use the results of w,h := ScreenToGLCoordsf(absoluteWidth, absoluteHeight, screenWidth, screenHeight); w=w+1;h-1 in the call to this function. (The w+1,h-1 step maps the coordinates to start at 0.0 rather than -1.0)

func (Vec2f) Add

func (v1 Vec2f) Add(v2 Vec2f) Vec2f

func (Vec2f) ApproxEqual

func (v1 Vec2f) ApproxEqual(v2 Vec2f) bool

func (Vec2f) ApproxEqualTheshold

func (v1 Vec2f) ApproxEqualTheshold(v2 Vec2f, threshold float32) bool

func (Vec2f) ApproxFuncEqual

func (v1 Vec2f) ApproxFuncEqual(v2 Vec2f, eq func(float32, float32) bool) bool

func (Vec2f) Dot

func (v1 Vec2f) Dot(v2 Vec2f) float32

func (Vec2f) Len

func (v1 Vec2f) Len() float32

func (Vec2f) Mul

func (v1 Vec2f) Mul(c float32) Vec2f

func (Vec2f) Normalize

func (v1 Vec2f) Normalize() Vec2f

func (Vec2f) Sub

func (v1 Vec2f) Sub(v2 Vec2f) Vec2f

type Vec3d

type Vec3d [3]float64

func Projectd

func Projectd(obj Vec3d, modelview, projection Mat4d, initialX, initialY, width, height int) (win Vec3d)

Transform a set of coordinates from object space (in obj) to window coordinates (with depth)

Window coordinates are continuous, not discrete (well, as continuous as an IEEE Floating Point can be), so you won't get exact pixel locations without rounding or similar

func UnProjectd

func UnProjectd(win Vec3d, modelview, projection Mat4d, initialX, initialY, width, height int) (obj Vec3d, err error)

Transform a set of window coordinates to object space. If your MVP (projection.Mul(modelview) matrix is not invertible, this will return an error

Note that the projection may not be perfect if you use strict pixel locations rather than the exact values given by Projectf. (It's still unlikely to be perfect due to precision errors, but it will be closer)

func (Vec3d) Add

func (v1 Vec3d) Add(v2 Vec3d) Vec3d

func (Vec3d) ApproxEqual

func (v1 Vec3d) ApproxEqual(v2 Vec3d) bool

func (Vec3d) ApproxEqualTheshold

func (v1 Vec3d) ApproxEqualTheshold(v2 Vec3d, threshold float64) bool

func (Vec3d) ApproxFuncEqual

func (v1 Vec3d) ApproxFuncEqual(v2 Vec3d, eq func(float64, float64) bool) bool

func (Vec3d) Cross

func (v1 Vec3d) Cross(v2 Vec3d) Vec3d

func (Vec3d) Dot

func (v1 Vec3d) Dot(v2 Vec3d) float64

func (Vec3d) Len

func (v1 Vec3d) Len() float64

func (Vec3d) Mul

func (v1 Vec3d) Mul(c float64) Vec3d

func (Vec3d) Normalize

func (v1 Vec3d) Normalize() Vec3d

func (Vec3d) Sub

func (v1 Vec3d) Sub(v2 Vec3d) Vec3d

type Vec3f

type Vec3f [3]float32

func BezierCurve3Df

func BezierCurve3Df(t float32, cPoints []Vec3f) Vec3f

Same as the 2D version, except the line is in 3D space

func BezierSplineInterpolate3Df

func BezierSplineInterpolate3Df(t float32, ranges [][2]float32, cPoints [][]Vec3f) Vec3f

Does interpolation over a spline of several bezier curves. Each bezier curve must have a finite range, though the spline may be disjoint. The bezier curves are not required to be in any particular order.

If t is out of the range of all given curves, this function will panic

func BezierSurfacef

func BezierSurfacef(u, v float32, cPoints [][]Vec3f) Vec3f

Creates a 2-dimensional Bezier surface of arbitrary degree in 3D Space Like the curve functions, if u or v are not in the range [0.0,1.0] the function will panic, use Clamp[f|d] to ensure it is correct.

The control point matrix must not be jagged, or this will end up panicking from an index out of bounds exception

func CubicBezierCurve3Df

func CubicBezierCurve3Df(t float32, cPoint1, cPoint2, cPoint3, cPoint4 Vec3f) Vec3f

func MakeBezierCurve3Df

func MakeBezierCurve3Df(numPoints int, cPoints []Vec3f) (line []Vec3f)

Same as the 2D version, except with the line in 3D space

func Projectf

func Projectf(obj Vec3f, modelview, projection Mat4f, initialX, initialY, width, height int) (win Vec3f)

Transform a set of coordinates from object space (in obj) to window coordinates (with depth)

Window coordinates are continuous, not discrete (well, as continuous as an IEEE Floating Point can be), so you won't get exact pixel locations without rounding or similar

func QuadraticBezierCurve3Df

func QuadraticBezierCurve3Df(t float32, cPoint1, cPoint2, cPoint3 Vec3f) Vec3f

func UnProjectf

func UnProjectf(win Vec3f, modelview, projection Mat4f, initialX, initialY, width, height int) (obj Vec3f, err error)

Transform a set of window coordinates to object space. If your MVP (projection.Mul(modelview) matrix is not invertible, this will return an error

Note that the projection may not be perfect if you use strict pixel locations rather than the exact values given by Projectf. (It's still unlikely to be perfect due to precision errors, but it will be closer)

func (Vec3f) Add

func (v1 Vec3f) Add(v2 Vec3f) Vec3f

func (Vec3f) ApproxEqual

func (v1 Vec3f) ApproxEqual(v2 Vec3f) bool

func (Vec3f) ApproxEqualTheshold

func (v1 Vec3f) ApproxEqualTheshold(v2 Vec3f, threshold float32) bool

func (Vec3f) ApproxFuncEqual

func (v1 Vec3f) ApproxFuncEqual(v2 Vec3f, eq func(float32, float32) bool) bool

func (Vec3f) Cross

func (v1 Vec3f) Cross(v2 Vec3f) Vec3f

func (Vec3f) Dot

func (v1 Vec3f) Dot(v2 Vec3f) float32

func (Vec3f) Len

func (v1 Vec3f) Len() float32

func (Vec3f) Mul

func (v1 Vec3f) Mul(c float32) Vec3f

func (Vec3f) Normalize

func (v1 Vec3f) Normalize() Vec3f

func (Vec3f) Sub

func (v1 Vec3f) Sub(v2 Vec3f) Vec3f

type Vec4d

type Vec4d [4]float64

func (Vec4d) Add

func (v1 Vec4d) Add(v2 Vec4d) Vec4d

func (Vec4d) ApproxEqual

func (v1 Vec4d) ApproxEqual(v2 Vec4d) bool

func (Vec4d) ApproxEqualTheshold

func (v1 Vec4d) ApproxEqualTheshold(v2 Vec4d, threshold float64) bool

func (Vec4d) ApproxFuncEqual

func (v1 Vec4d) ApproxFuncEqual(v2 Vec4d, eq func(float64, float64) bool) bool

func (Vec4d) Dot

func (v1 Vec4d) Dot(v2 Vec4d) float64

func (Vec4d) Len

func (v1 Vec4d) Len() float64

func (Vec4d) Mul

func (v1 Vec4d) Mul(c float64) Vec4d

func (Vec4d) Normalize

func (v1 Vec4d) Normalize() Vec4d

func (Vec4d) Sub

func (v1 Vec4d) Sub(v2 Vec4d) Vec4d

type Vec4f

type Vec4f [4]float32

func (Vec4f) Add

func (v1 Vec4f) Add(v2 Vec4f) Vec4f

func (Vec4f) ApproxEqual

func (v1 Vec4f) ApproxEqual(v2 Vec4f) bool

func (Vec4f) ApproxEqualTheshold

func (v1 Vec4f) ApproxEqualTheshold(v2 Vec4f, threshold float32) bool

func (Vec4f) ApproxFuncEqual

func (v1 Vec4f) ApproxFuncEqual(v2 Vec4f, eq func(float32, float32) bool) bool

func (Vec4f) Dot

func (v1 Vec4f) Dot(v2 Vec4f) float32

func (Vec4f) Len

func (v1 Vec4f) Len() float32

func (Vec4f) Mul

func (v1 Vec4f) Mul(c float32) Vec4f

func (Vec4f) Normalize

func (v1 Vec4f) Normalize() Vec4f

func (Vec4f) Sub

func (v1 Vec4f) Sub(v2 Vec4f) Vec4f

Jump to

Keyboard shortcuts

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