GeometryMath

package
v0.0.0-...-9749107 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: GPL-3.0 Imports: 3 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ACos

func ACos(a float32) float32

func ASin

func ASin(a float32) float32

func ATan

func ATan(a float32) float32

func ATan2

func ATan2(y float32, x float32) float32

func Abs

func Abs(a float32) float32

func Ceil

func Ceil(x float32) float32

func Cos

func Cos(a float32) float32

func Degree

func Degree(radians float32) float32

func Equals

func Equals(f1 float32, f2 float32, threshold float32) bool

func Floor

func Floor(x float32) float32

func Max

func Max(x float32, y float32) float32

func Min

func Min(x float32, y float32) float32

func Mod

func Mod(x float32, y float32) float32

func Pow

func Pow(a float32, exp float32) float32

func Radians

func Radians(degree float32) float32

func Round

func Round(x float32) float32

func Sin

func Sin(a float32) float32

func Sqrt

func Sqrt(a float32) float32

func Tan

func Tan(a float32) float32

Types

type EulerAngles

type EulerAngles struct {
	Yaw                float32
	Pitch              float32
	Roll               float32
	GimbalLockDetected bool
}

func ExtractFromMatrix

func ExtractFromMatrix(m Matrix4x4) []EulerAngles

type IMatrixConfig

type IMatrixConfig interface {
	Decode() Matrix4x4
}

type IProjectionConfig

type IProjectionConfig interface {
	IMatrixConfig
	GetNear() float32
	GetFar() float32
	GetPlane(distance float32) (float32, float32)
	SetSize(width, height, near, far float32)
}

type Matrix3x3

type Matrix3x3 [3][3]float32

type Matrix4x4

type Matrix4x4 [4][4]float32

func Identity

func Identity() Matrix4x4

func LookAt

func LookAt(eye Vector3, center Vector3, up Vector3) Matrix4x4

func Orthographic

func Orthographic(left float32, right float32, bottom float32, top float32, near float32, far float32) Matrix4x4

func Perspective

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

func Rotate

func Rotate(a1 float32, v1 Vector3) Matrix4x4

func RotateX

func RotateX(a1 float32) Matrix4x4

func RotateY

func RotateY(a1 float32) Matrix4x4

func RotateZ

func RotateZ(a1 float32) Matrix4x4

func Scale

func Scale(v float32) Matrix4x4

func Translate

func Translate(v1 Vector3) Matrix4x4

func (Matrix4x4) Equals

func (m1 Matrix4x4) Equals(m2 Matrix4x4, threshold float32) bool

func (Matrix4x4) Inverse

func (m1 Matrix4x4) Inverse() Matrix4x4

func (Matrix4x4) Mul

func (m1 Matrix4x4) Mul(m2 Matrix4x4) Matrix4x4

func (Matrix4x4) MulScalar

func (m1 Matrix4x4) MulScalar(scalar float32) Matrix4x4

func (Matrix4x4) MulVector

func (m1 Matrix4x4) MulVector(v1 Vector3) Vector3

func (Matrix4x4) MulVector4

func (m1 Matrix4x4) MulVector4(v1 Vector4) Vector4

func (Matrix4x4) ToMatrix3x3

func (m1 Matrix4x4) ToMatrix3x3() Matrix3x3

func (Matrix4x4) Transpose

func (m1 Matrix4x4) Transpose() Matrix4x4

func (*Matrix4x4) UnmarshalYAML

func (m1 *Matrix4x4) UnmarshalYAML(value *yaml.Node) error

type OrthographicConfig

type OrthographicConfig struct {
	Left   float32 `yaml:"left"`
	Right  float32 `yaml:"right"`
	Bottom float32 `yaml:"bottom"`
	Top    float32 `yaml:"top"`
	Near   float32 `yaml:"near"`
	Far    float32 `yaml:"far"`
}

func (*OrthographicConfig) Decode

func (config *OrthographicConfig) Decode() Matrix4x4

func (*OrthographicConfig) GetFar

func (config *OrthographicConfig) GetFar() float32

func (*OrthographicConfig) GetNear

func (config *OrthographicConfig) GetNear() float32

func (*OrthographicConfig) GetPlane

func (config *OrthographicConfig) GetPlane(distance float32) (float32, float32)

func (OrthographicConfig) SetSize

func (config OrthographicConfig) SetSize(width, height, near, far float32)

type PerspectiveConfig

type PerspectiveConfig struct {
	Fovy   float32 `yaml:"fovy"`
	Aspect float32 `yaml:"aspect"`
	Near   float32 `yaml:"near"`
	Far    float32 `yaml:"far"`
}

func (*PerspectiveConfig) Decode

func (config *PerspectiveConfig) Decode() Matrix4x4

func (*PerspectiveConfig) GetFar

func (config *PerspectiveConfig) GetFar() float32

func (*PerspectiveConfig) GetNear

func (config *PerspectiveConfig) GetNear() float32

func (*PerspectiveConfig) GetPlane

func (config *PerspectiveConfig) GetPlane(distance float32) (float32, float32)

func (*PerspectiveConfig) SetSize

func (config *PerspectiveConfig) SetSize(width, height, near, far float32)

type Plane3

type Plane3 struct {
	Normal Vector3
	Point  Vector3
	D      float32
}

func NewPlane

func NewPlane(normal, point Vector3) Plane3

func NewPlaneFromThreePoints

func NewPlaneFromThreePoints(p0, p1, p2 Vector3) Plane3

func (*Plane3) Distance

func (plane *Plane3) Distance(p Vector3) float32

type Vector2

type Vector2 [2]float32

func (*Vector2) Add

func (v1 *Vector2) Add(v2 *Vector2) *Vector2

func (*Vector2) Dot

func (v1 *Vector2) Dot(v2 *Vector2) float32

func (*Vector2) Invert

func (v1 *Vector2) Invert() *Vector2

func (*Vector2) Length

func (v1 *Vector2) Length() float32

func (*Vector2) MulScalar

func (v1 *Vector2) MulScalar(scalar float32) *Vector2

func (*Vector2) MulVector

func (v1 *Vector2) MulVector(v2 *Vector2) *Vector2

func (*Vector2) Normalize

func (v1 *Vector2) Normalize() *Vector2

func (*Vector2) Sub

func (v1 *Vector2) Sub(v2 *Vector2) *Vector2

func (*Vector2) X

func (v1 *Vector2) X() float32

func (*Vector2) Y

func (v1 *Vector2) Y() float32

type Vector3

type Vector3 [3]float32

func (Vector3) Add

func (v1 Vector3) Add(v2 Vector3) Vector3

func (Vector3) Cross

func (v1 Vector3) Cross(v2 Vector3) Vector3

func (Vector3) Dot

func (v1 Vector3) Dot(v2 Vector3) float32

func (Vector3) Invert

func (v1 Vector3) Invert() Vector3

func (Vector3) Length

func (v1 Vector3) Length() float32

func (Vector3) MulScalar

func (v1 Vector3) MulScalar(scalar float32) Vector3

func (Vector3) MulVector

func (v1 Vector3) MulVector(v2 Vector3) Vector3

func (Vector3) Normalize

func (v1 Vector3) Normalize() Vector3

func (Vector3) Sub

func (v1 Vector3) Sub(v2 Vector3) Vector3

func (Vector3) X

func (v1 Vector3) X() float32

func (Vector3) Y

func (v1 Vector3) Y() float32

func (Vector3) Z

func (v1 Vector3) Z() float32

type Vector4

type Vector4 [4]float32

func (*Vector4) Add

func (v1 *Vector4) Add(v2 *Vector4) *Vector4

func (*Vector4) Dot

func (v1 *Vector4) Dot(v2 *Vector4) float32

func (*Vector4) Invert

func (v1 *Vector4) Invert() *Vector4

func (*Vector4) Length

func (v1 *Vector4) Length() float32

func (*Vector4) MulScalar

func (v1 *Vector4) MulScalar(scalar float32) *Vector4

func (*Vector4) MulVector

func (v1 *Vector4) MulVector(v2 *Vector4) *Vector4

func (*Vector4) Normalize

func (v1 *Vector4) Normalize() *Vector4

func (*Vector4) Sub

func (v1 *Vector4) Sub(v2 *Vector4) *Vector4

func (*Vector4) W

func (v1 *Vector4) W() float32

func (*Vector4) X

func (v1 *Vector4) X() float32

func (*Vector4) Y

func (v1 *Vector4) Y() float32

func (*Vector4) Z

func (v1 *Vector4) Z() float32

Jump to

Keyboard shortcuts

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