mathx

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Unlicense Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEG2RAD   = math.Pi / 180
	RAD2DEG   = 180 / math.Pi
	EPSILON64 = float64(7.)/3 - float64(4.)/3 - float64(1.)
	EPSILON32 = float32(7.)/3 - float32(4.)/3 - float32(1.)
)

Variables

View Source
var (
	V3Zero = *NewZeroVector3()
	V3One  = *NewOneVector3()
)
View Source
var Box2Empty = Box2{
	Min: Vector2{X: math.MaxFloat64, Y: math.MaxFloat64},
	Max: Vector2{X: -math.MaxFloat64, Y: -math.MaxFloat64},
}

Functions

func CatmullRom

func CatmullRom(t, p0, p1, p2, p3 float64) float64

func CeilPowerOfTwo

func CeilPowerOfTwo(value int) int

func Clamp

func Clamp(value, min, max float64) float64

func CubicBezier

func CubicBezier(t, p0, p1, p2, p3 float64) float64

func CubicBezierP0

func CubicBezierP0(t, p float64) float64

func CubicBezierP1

func CubicBezierP1(t, p float64) float64

func CubicBezierP2

func CubicBezierP2(t, p float64) float64

func CubicBezierP3

func CubicBezierP3(t, p float64) float64

func DegToRad

func DegToRad(degrees float64) float64

func EuclideanModulo

func EuclideanModulo(n, m float64) float64

compute euclidean modulo of m % n https://en.wikipedia.org/wiki/Modulo_operation

func FloorPowerOfTwo

func FloorPowerOfTwo(value int) int

func IsPowerOfTwo

func IsPowerOfTwo(value int) bool

func MapLinear

func MapLinear(x, a1, a2, b1, b2 float64) float64

Linear mapping from range <a1, a2> to range <b1, b2>

func QuadraticBezier

func QuadraticBezier(t, p0, p1, p2 float64) float64

func QuadraticBezierP0

func QuadraticBezierP0(t, p float64) float64

func QuadraticBezierP1

func QuadraticBezierP1(t, p float64) float64

func QuadraticBezierP2

func QuadraticBezierP2(t, p float64) float64

func RadToDeg

func RadToDeg(radians float64) float64

func RandFloatSpread

func RandFloatSpread(rng float64) float64

Random float from <-range/2, range/2> interval

func SetQuaternionFromProperEuler

func SetQuaternionFromProperEuler(q *Quaternion, a, b, c float64, order string)

func Smootherstep

func Smootherstep(x, min, max float64) float64

Types

type ArcCurve

type ArcCurve struct {
	EllipseCurve
}

func NewArcCurve

func NewArcCurve(aX, aY, aRadius, aStartAngle, aEndAngle float64, aClockwise bool) *ArcCurve

func (*ArcCurve) Clone

func (c *ArcCurve) Clone() *baseCurve

func (*ArcCurve) ComputeFrenetFrames added in v0.0.6

func (c *ArcCurve) ComputeFrenetFrames(segments int, closed bool) map[string][]Vector3

func (*ArcCurve) Tangent added in v0.0.6

func (c *ArcCurve) Tangent(t float64) *Vector3

Returns a unit vector tangent at t In case any sub curve does not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation

func (*ArcCurve) TangentAt added in v0.0.6

func (c *ArcCurve) TangentAt(u float64) *Vector3

type Box2

type Box2 struct {
	Min Vector2
	Max Vector2
}

func NewBox2

func NewBox2() *Box2

func (*Box2) ClampPoint

func (b *Box2) ClampPoint(point Vector2, target *Vector2) *Vector2

func (*Box2) Clone

func (b *Box2) Clone() *Box2

func (*Box2) ContainsBox

func (b *Box2) ContainsBox(box *Box2) bool

func (*Box2) ContainsPoint

func (b *Box2) ContainsPoint(point Vector2) bool

func (*Box2) Copy

func (b *Box2) Copy(box *Box2) *Box2

func (*Box2) DistanceToPoint

func (b *Box2) DistanceToPoint(point Vector2) float64

func (*Box2) Equals

func (b *Box2) Equals(box *Box2) bool

func (*Box2) ExpandByPoint

func (b *Box2) ExpandByPoint(point Vector2) *Box2

func (*Box2) ExpandByScalar

func (b *Box2) ExpandByScalar(scalar float64) *Box2

func (*Box2) ExpandByVector

func (b *Box2) ExpandByVector(vector Vector2) *Box2

func (*Box2) GetCenter

func (b *Box2) GetCenter(target *Vector2) *Vector2

func (*Box2) GetParameter

func (b *Box2) GetParameter(point Vector2, target *Vector2) *Vector2

func (*Box2) GetSize

func (b *Box2) GetSize(target *Vector2) *Vector2

func (*Box2) Intersect

func (b *Box2) Intersect(box *Box2) *Box2

func (*Box2) IntersectsBox

func (b *Box2) IntersectsBox(box *Box2) bool

func (*Box2) IsEmpty

func (b *Box2) IsEmpty() bool

func (*Box2) MakeEmpty

func (b *Box2) MakeEmpty() *Box2

func (*Box2) Set

func (b *Box2) Set(min, max Vector2) *Box2

func (*Box2) SetFromCenterAndSize

func (b *Box2) SetFromCenterAndSize(center, size Vector2) *Box2

func (*Box2) SetFromPoints

func (b *Box2) SetFromPoints(points []Vector2) *Box2

func (*Box2) Translate

func (b *Box2) Translate(offset Vector2) *Box2

func (*Box2) Union

func (b *Box2) Union(box *Box2) *Box2

type Box3

type Box3 struct {
	Min Vector3
	Max Vector3
}

func NewBox3

func NewBox3(minVal, maxVal Vector3) *Box3

func (*Box3) ApplyMatrix4

func (b *Box3) ApplyMatrix4(matrix Matrix4) *Box3

func (*Box3) Center

func (b *Box3) Center() Vector3

func (*Box3) ClampPoint

func (b *Box3) ClampPoint(point Vector3) (target *Vector3)

func (*Box3) Clone

func (b *Box3) Clone() *Box3

func (*Box3) ContainsBox

func (b *Box3) ContainsBox(box Box3) bool

func (*Box3) ContainsPoint

func (b *Box3) ContainsPoint(point Vector3) bool

func (*Box3) Copy

func (b *Box3) Copy(box *Box3) *Box3

func (*Box3) DistanceToPoint

func (b *Box3) DistanceToPoint(point Vector3) float64

func (*Box3) Equals

func (b *Box3) Equals(box Box3) bool

func (*Box3) ExpandByPoint

func (b *Box3) ExpandByPoint(point Vector3) *Box3

func (*Box3) ExpandByScalar

func (b *Box3) ExpandByScalar(scalar float64) *Box3

func (*Box3) ExpandByVector

func (b *Box3) ExpandByVector(vector Vector3) *Box3

func (*Box3) GetBoundingSphere

func (b *Box3) GetBoundingSphere() *Sphere

func (*Box3) GetParameter

func (b *Box3) GetParameter(point Vector3) (target Vector3)

func (*Box3) Intersect

func (b *Box3) Intersect(box Box3) *Box3

func (*Box3) IntersectsBox

func (b *Box3) IntersectsBox(box Box3) bool

func (*Box3) IntersectsPlane

func (b *Box3) IntersectsPlane(plane Plane) bool

func (*Box3) IntersectsSphere

func (b *Box3) IntersectsSphere(sphere Sphere) bool

func (*Box3) IntersectsTriangle

func (b *Box3) IntersectsTriangle(triangle Triangle) bool

func (*Box3) IsEmpty

func (b *Box3) IsEmpty() bool

func (*Box3) MakeEmpty

func (b *Box3) MakeEmpty() *Box3

func (*Box3) Set

func (b *Box3) Set(min, max Vector3) *Box3

func (*Box3) SetFromCenterAndSize

func (b *Box3) SetFromCenterAndSize(center, size Vector3) *Box3

func (*Box3) SetFromPoints

func (b *Box3) SetFromPoints(points ...Vector3) *Box3

func (*Box3) Size

func (b *Box3) Size() *Vector3

func (*Box3) Translate

func (b *Box3) Translate(offset Vector3) *Box3

func (*Box3) Union

func (b *Box3) Union(box Box3) *Box3

type CatmullRomCurve3

type CatmullRomCurve3 struct {
	Points    []*Vector3
	Closed    bool
	CurveType CurveType
	Tension   float64
	// contains filtered or unexported fields
}

func NewCatmullRomCurve3

func NewCatmullRomCurve3(points []*Vector3, closed bool, curveType CurveType, tension float64) *CatmullRomCurve3

func (*CatmullRomCurve3) Clone

func (c *CatmullRomCurve3) Clone() *baseCurve

func (*CatmullRomCurve3) ComputeFrenetFrames added in v0.0.6

func (c *CatmullRomCurve3) ComputeFrenetFrames(segments int, closed bool) map[string][]Vector3

func (*CatmullRomCurve3) Copy

func (*CatmullRomCurve3) GetPoint

func (c *CatmullRomCurve3) GetPoint(t float64, optionalTarget *Vector3) *Vector3

func (*CatmullRomCurve3) Length

func (c *CatmullRomCurve3) Length() float64

Get total curve arc length

func (*CatmullRomCurve3) Lengths

func (c *CatmullRomCurve3) Lengths(divisions int) []float64

Get list of cumulative segment lengths

func (*CatmullRomCurve3) LengthsDefault

func (c *CatmullRomCurve3) LengthsDefault() []float64

func (*CatmullRomCurve3) Point

func (c *CatmullRomCurve3) Point(t float64) *Vector3

Virtual base class method to overwrite and implement in subclasses

  • t [0 .. 1]

func (*CatmullRomCurve3) PointAt

func (c *CatmullRomCurve3) PointAt(u float64) *Vector3

Get point at relative position in curve according to arc length - u [0 .. 1]

func (*CatmullRomCurve3) Points

func (c *CatmullRomCurve3) Points(divisions int) []Vector3

Get sequence of points using getPoint( t )

func (*CatmullRomCurve3) SpacedPoints

func (c *CatmullRomCurve3) SpacedPoints(divisions int) []Vector3

Get sequence of points using getPointAt( u )

func (*CatmullRomCurve3) Tangent added in v0.0.6

func (c *CatmullRomCurve3) Tangent(t float64) *Vector3

Returns a unit vector tangent at t In case any sub curve does not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation

func (*CatmullRomCurve3) TangentAt added in v0.0.6

func (c *CatmullRomCurve3) TangentAt(u float64) *Vector3

func (*CatmullRomCurve3) UpdateArcLengths

func (c *CatmullRomCurve3) UpdateArcLengths()

type CoordinateSystem

type CoordinateSystem int
const (
	CoordinateSystemWebGL CoordinateSystem = iota
	CoordinateSystemWebGPU
)

type CubicBezierCurve

type CubicBezierCurve struct {
	V0, V1, V2, V3 Vector3
	// contains filtered or unexported fields
}

func NewCubicBezierCurve3

func NewCubicBezierCurve3(v0, v1, v2, v3 Vector3) *CubicBezierCurve

func (*CubicBezierCurve) Clone

func (c *CubicBezierCurve) Clone() *baseCurve

func (*CubicBezierCurve) ComputeFrenetFrames added in v0.0.6

func (c *CubicBezierCurve) ComputeFrenetFrames(segments int, closed bool) map[string][]Vector3

func (*CubicBezierCurve) Copy

func (c *CubicBezierCurve) Copy(source baseCurve) *baseCurve

func (*CubicBezierCurve) Length

func (c *CubicBezierCurve) Length() float64

func (*CubicBezierCurve) Lengths

func (c *CubicBezierCurve) Lengths(divisions int) []float64

func (*CubicBezierCurve) LengthsDefault

func (c *CubicBezierCurve) LengthsDefault() []float64

func (*CubicBezierCurve) Point

func (c *CubicBezierCurve) Point(t float64) *Vector3

func (*CubicBezierCurve) PointAt

func (c *CubicBezierCurve) PointAt(u float64) *Vector3

func (*CubicBezierCurve) Points

func (c *CubicBezierCurve) Points(divisions int) []Vector3

func (*CubicBezierCurve) SpacedPoints

func (c *CubicBezierCurve) SpacedPoints(divisions int) []Vector3

func (*CubicBezierCurve) Tangent added in v0.0.6

func (c *CubicBezierCurve) Tangent(t float64) *Vector3

Returns a unit vector tangent at t In case any sub curve does not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation

func (*CubicBezierCurve) TangentAt added in v0.0.6

func (c *CubicBezierCurve) TangentAt(u float64) *Vector3

func (*CubicBezierCurve) UpdateArcLengths

func (c *CubicBezierCurve) UpdateArcLengths()

type Curve

type Curve interface {
	Point(t float64) *Vector3
	PointAt(u float64) *Vector3
	Points(divisions int) []Vector3
	SpacedPoints(divisions int) []Vector3
	LengthsDefault() []float64
	Length() float64
	Lengths(divisions int) []float64
	UpdateArcLengths()
}

type CurvePath

type CurvePath struct {
	// contains filtered or unexported fields
}

func NewCurvePath

func NewCurvePath() *CurvePath

func (*CurvePath) Add

func (c *CurvePath) Add(curve Curve)

func (*CurvePath) ClosePath

func (c *CurvePath) ClosePath() *CurvePath

func (*CurvePath) Copy

func (c *CurvePath) Copy(source *CurvePath) *CurvePath

func (*CurvePath) Length

func (c *CurvePath) Length() float64

func (*CurvePath) Lengths

func (c *CurvePath) Lengths() []float64

func (*CurvePath) Point

func (c *CurvePath) Point(t float64) *Vector3

func (*CurvePath) Points

func (c *CurvePath) Points(divisions int) []Vector3

func (*CurvePath) SpacedPoints

func (c *CurvePath) SpacedPoints(divisions int) []*Vector3

func (*CurvePath) UpdateArcLengths

func (c *CurvePath) UpdateArcLengths()

type CurveType

type CurveType int
const (
	CurveTypeUnknown CurveType = iota
	CurveTypeCentripetal
	CurveTypeChordal
	CurveTypeCatmullRom
)

type Cylindrical

type Cylindrical struct {
	Radius float64 // distance from the origin to a point in the x-z plane
	Theta  float64 // counterclockwise angle in the x-z plane measured in radians from the positive z-axis
	Y      float64 // height above the x-z plane
}

func NewCylindrical

func NewCylindrical(radius, theta, y float64) *Cylindrical

func (*Cylindrical) Clone

func (c *Cylindrical) Clone() *Cylindrical

func (*Cylindrical) Copy

func (c *Cylindrical) Copy(other *Cylindrical) *Cylindrical

func (*Cylindrical) Set

func (c *Cylindrical) Set(radius, theta, y float64) *Cylindrical

func (*Cylindrical) SetFromCartesianCoords

func (c *Cylindrical) SetFromCartesianCoords(x, y, z float64) *Cylindrical

func (*Cylindrical) SetFromVector3

func (c *Cylindrical) SetFromVector3(v *Vector3) *Cylindrical

type EllipseCurve

type EllipseCurve struct {
	// contains filtered or unexported fields
}

func NewEllipseCurve

func NewEllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aRotation float64, aClockwise bool) *EllipseCurve

func (*EllipseCurve) Clone

func (c *EllipseCurve) Clone() *baseCurve

func (*EllipseCurve) ComputeFrenetFrames added in v0.0.6

func (c *EllipseCurve) ComputeFrenetFrames(segments int, closed bool) map[string][]Vector3

func (*EllipseCurve) Copy

func (c *EllipseCurve) Copy(source *EllipseCurve) *EllipseCurve

func (*EllipseCurve) Length

func (c *EllipseCurve) Length() float64

func (*EllipseCurve) Lengths

func (c *EllipseCurve) Lengths(divisions int) []float64

func (*EllipseCurve) LengthsDefault

func (c *EllipseCurve) LengthsDefault() []float64

func (*EllipseCurve) Point

func (c *EllipseCurve) Point(t float64) *Vector3

func (*EllipseCurve) PointAt

func (c *EllipseCurve) PointAt(u float64) *Vector3

func (*EllipseCurve) Points

func (c *EllipseCurve) Points(divisions int) []Vector3

func (*EllipseCurve) SpacedPoints

func (c *EllipseCurve) SpacedPoints(divisions int) []Vector3

func (*EllipseCurve) Tangent added in v0.0.6

func (c *EllipseCurve) Tangent(t float64) *Vector3

Returns a unit vector tangent at t In case any sub curve does not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation

func (*EllipseCurve) TangentAt added in v0.0.6

func (c *EllipseCurve) TangentAt(u float64) *Vector3

func (*EllipseCurve) UpdateArcLengths

func (c *EllipseCurve) UpdateArcLengths()

type Euler

type Euler struct {
	X     float64
	Y     float64
	Z     float64
	Order EulerOrder
}

func NewEuler

func NewEuler(x, y, z float64, order EulerOrder) *Euler

func (*Euler) Clone

func (e *Euler) Clone() *Euler

func (*Euler) Copy

func (e *Euler) Copy(euler *Euler) *Euler

func (*Euler) Equals

func (e *Euler) Equals(euler *Euler) bool

func (*Euler) FromArray

func (e *Euler) FromArray(array []float64) *Euler

func (*Euler) Reorder

func (e *Euler) Reorder(newOrder EulerOrder) *Euler

func (*Euler) Set

func (e *Euler) Set(x, y, z float64, order EulerOrder) *Euler

func (*Euler) SetFromQuaternion

func (e *Euler) SetFromQuaternion(q Quaternion, order EulerOrder, update bool) *Euler

func (*Euler) SetFromRotationMatrix

func (e *Euler) SetFromRotationMatrix(m Matrix4, order EulerOrder, update bool) *Euler

func (*Euler) SetFromVector3

func (e *Euler) SetFromVector3(v Vector3, order EulerOrder) *Euler

func (*Euler) ToArray

func (e *Euler) ToArray(array []float64, offset int) []float64

type EulerOrder

type EulerOrder int
const (
	EULER_ORDER_XYZ EulerOrder = iota
	EULER_ORDER_YXZ
	EULER_ORDER_ZXY
	EULER_ORDER_ZYX
	EULER_ORDER_YZX
	EULER_ORDER_XZY
	EULER_ORDER_DEFAULT = EULER_ORDER_XYZ
)

type Line3

type Line3 struct {
	Start, End Vector3
}

func NewLine3

func NewLine3(start, end Vector3) *Line3

func (*Line3) ApplyMatrix4

func (l *Line3) ApplyMatrix4(matrix Matrix4) *Line3

func (*Line3) At

func (l *Line3) At(t float64) *Vector3

func (*Line3) Center

func (l *Line3) Center() *Vector3

func (*Line3) Clone

func (l *Line3) Clone() *Line3

func (*Line3) ClosestPointToPoint

func (l *Line3) ClosestPointToPoint(point Vector3, clampToLine bool) *Vector3

func (*Line3) ClosestPointToPointParameter

func (l *Line3) ClosestPointToPointParameter(point Vector3, clampToLine bool) float64

func (*Line3) Copy

func (l *Line3) Copy(line Line3) *Line3

func (*Line3) Delta

func (l *Line3) Delta() *Vector3

func (*Line3) Distance

func (l *Line3) Distance() float64

func (*Line3) DistanceSq

func (l *Line3) DistanceSq() float64

func (*Line3) Equals

func (l *Line3) Equals(line Line3) bool

func (*Line3) Set

func (l *Line3) Set(start, end Vector3) *Line3

type LineCurve

type LineCurve struct {
	V1, V2 Vector3
	// contains filtered or unexported fields
}

func NewLineCurve3

func NewLineCurve3(v1, v2 Vector3) *LineCurve

func (*LineCurve) Clone

func (c *LineCurve) Clone() *baseCurve

func (*LineCurve) ComputeFrenetFrames added in v0.0.6

func (c *LineCurve) ComputeFrenetFrames(segments int, closed bool) map[string][]Vector3

func (*LineCurve) Copy

func (c *LineCurve) Copy(source baseCurve) *baseCurve

func (*LineCurve) Length

func (c *LineCurve) Length() float64

func (*LineCurve) Lengths

func (c *LineCurve) Lengths(divisions int) []float64

func (*LineCurve) LengthsDefault

func (c *LineCurve) LengthsDefault() []float64

func (*LineCurve) Point

func (c *LineCurve) Point(t float64) *Vector3

func (*LineCurve) PointAt

func (c *LineCurve) PointAt(u float64) *Vector3

func (*LineCurve) Points

func (c *LineCurve) Points(divisions int) []Vector3

func (*LineCurve) SpacedPoints

func (c *LineCurve) SpacedPoints(divisions int) []Vector3

func (*LineCurve) Tangent added in v0.0.6

func (c *LineCurve) Tangent(t float64) *Vector3

Returns a unit vector tangent at t In case any sub curve does not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation

func (*LineCurve) TangentAt added in v0.0.6

func (c *LineCurve) TangentAt(u float64) *Vector3

func (*LineCurve) UpdateArcLengths

func (c *LineCurve) UpdateArcLengths()

type Matrix3

type Matrix3 [9]float64

func MultiplyMatrices

func MultiplyMatrices(a, b Matrix3) *Matrix3

func NewMatrix3

func NewMatrix3(n11, n12, n13, n21, n22, n23, n31, n32, n33 float64) *Matrix3

func NewMatrix3Identity

func NewMatrix3Identity() *Matrix3

func (*Matrix3) Clone

func (m *Matrix3) Clone() *Matrix3

func (*Matrix3) Copy

func (m *Matrix3) Copy(matrix Matrix3) *Matrix3

func (*Matrix3) Demrminant

func (m *Matrix3) Demrminant() float64

func (*Matrix3) Equals

func (m *Matrix3) Equals(matrix Matrix3) bool

func (*Matrix3) FromArray

func (m *Matrix3) FromArray(array []float64, offset int) *Matrix3

func (*Matrix3) Identity

func (m *Matrix3) Identity() *Matrix3

func (*Matrix3) Invert

func (m *Matrix3) Invert() *Matrix3

func (*Matrix3) MakeRotation

func (m *Matrix3) MakeRotation(theta float64) *Matrix3

func (*Matrix3) MakeScale

func (m *Matrix3) MakeScale(x, y float64) *Matrix3

func (*Matrix3) MakeTranslation

func (m *Matrix3) MakeTranslation(x, y float64) *Matrix3

func (*Matrix3) Multiply

func (m *Matrix3) Multiply(matrix Matrix3) *Matrix3

func (*Matrix3) MultiplyScalar

func (m *Matrix3) MultiplyScalar(s float64) *Matrix3

func (*Matrix3) NormalMatrix

func (m *Matrix3) NormalMatrix(matrix4 Matrix4) *Matrix3

func (*Matrix3) Premultiply

func (m *Matrix3) Premultiply(matrix Matrix3) *Matrix3

func (*Matrix3) Rotam

func (m *Matrix3) Rotam(theta float64) *Matrix3

func (*Matrix3) Scale

func (m *Matrix3) Scale(sx, sy float64) *Matrix3

func (*Matrix3) Set

func (m *Matrix3) Set(n11, n12, n13, n21, n22, n23, n31, n32, n33 float64) *Matrix3

func (*Matrix3) SetFromMatrix4

func (m *Matrix3) SetFromMatrix4(me Matrix4) *Matrix3

func (*Matrix3) SetUvTransform

func (m *Matrix3) SetUvTransform(tx, ty, sx, sy, rotation, cx, cy float64) *Matrix3

func (*Matrix3) ToArray

func (m *Matrix3) ToArray(array []float64, offset int) []float64

func (*Matrix3) Translam

func (m *Matrix3) Translam(tx, ty float64) *Matrix3

func (*Matrix3) Transpose

func (m *Matrix3) Transpose() *Matrix3

func (*Matrix3) TransposeIntoArray

func (m *Matrix3) TransposeIntoArray(r []float64) *Matrix3

type Matrix4

type Matrix4 [16]float64

func MakeRotationFromQuaternion

func MakeRotationFromQuaternion(q Quaternion) *Matrix4

func MultiplyMatrice4s

func MultiplyMatrice4s(a, b Matrix4) *Matrix4

func NewMatrix4

func NewMatrix4(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 float64) *Matrix4

func NewMatrix4Identity

func NewMatrix4Identity() *Matrix4

func (*Matrix4) Clone

func (m *Matrix4) Clone() *Matrix4

func (*Matrix4) Compose

func (m *Matrix4) Compose(position Vector3, rotation Quaternion, scale Vector3) *Matrix4

func (*Matrix4) Copy

func (m *Matrix4) Copy(matrix Matrix4) *Matrix4

func (*Matrix4) CopyPosition

func (m *Matrix4) CopyPosition(matrix Matrix4) *Matrix4

func (*Matrix4) Decompose

func (m *Matrix4) Decompose() (position Vector3, rotation Quaternion, scale Vector3)

func (*Matrix4) Demrminant

func (m *Matrix4) Demrminant() float64

func (*Matrix4) Equals

func (m *Matrix4) Equals(matrix Matrix4) bool

func (*Matrix4) ExtractBasis

func (m *Matrix4) ExtractBasis() (xAxis, yAxis, zAxis Vector3)

func (*Matrix4) ExtractRotation

func (m *Matrix4) ExtractRotation(matrix Matrix4) *Matrix4

func (*Matrix4) FromArray

func (m *Matrix4) FromArray(array []float64, offset int) *Matrix4

func (*Matrix4) Identity

func (m *Matrix4) Identity() *Matrix4

func (*Matrix4) Invert

func (m *Matrix4) Invert() *Matrix4

func (*Matrix4) LookAt

func (m *Matrix4) LookAt(eye, target, up Vector3) *Matrix4

func (*Matrix4) MakeBasis

func (m *Matrix4) MakeBasis(xAxis, yAxis, zAxis Vector3) *Matrix4

func (*Matrix4) MakeOrthographic

func (m *Matrix4) MakeOrthographic(left, right, top, bottom, near, far float64) *Matrix4

func (*Matrix4) MakePerspective

func (m *Matrix4) MakePerspective(left, right, top, bottom, near, far float64) *Matrix4

func (*Matrix4) MakeRotationAxis

func (m *Matrix4) MakeRotationAxis(axis Vector3, angle float64) *Matrix4

func (*Matrix4) MakeRotationFromEuler

func (m *Matrix4) MakeRotationFromEuler(euler Euler) *Matrix4

func (*Matrix4) MakeRotationX

func (m *Matrix4) MakeRotationX(theta float64) *Matrix4

func (*Matrix4) MakeRotationY

func (m *Matrix4) MakeRotationY(theta float64) *Matrix4

func (*Matrix4) MakeRotationZ

func (m *Matrix4) MakeRotationZ(theta float64) *Matrix4

func (*Matrix4) MakeScale

func (m *Matrix4) MakeScale(v Vector3) *Matrix4

func (*Matrix4) MakeShear

func (m *Matrix4) MakeShear(xy, xz, yx, yz, zx, zy float64) *Matrix4

func (*Matrix4) MakeTranslation

func (m *Matrix4) MakeTranslation(v Vector3) *Matrix4

func (*Matrix4) MaxScaleOnAxis

func (m *Matrix4) MaxScaleOnAxis() float64

func (*Matrix4) Multiply

func (m *Matrix4) Multiply(m2 Matrix4) *Matrix4

func (*Matrix4) MultiplyScalar

func (m *Matrix4) MultiplyScalar(s float64) *Matrix4

func (*Matrix4) Premultiply

func (m *Matrix4) Premultiply(m2 Matrix4) *Matrix4

func (*Matrix4) Scale

func (m *Matrix4) Scale(v Vector3) *Matrix4

func (*Matrix4) Set

func (m *Matrix4) Set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 float64) *Matrix4

func (*Matrix4) SetFromMatrix3

func (m *Matrix4) SetFromMatrix3(matrix Matrix3) *Matrix4

func (*Matrix4) SetPosition

func (m *Matrix4) SetPosition(v Vector3) *Matrix4

func (*Matrix4) ToArray

func (m *Matrix4) ToArray(array []float64, offset int) []float64

func (*Matrix4) Transpose

func (m *Matrix4) Transpose() *Matrix4

type Plane

type Plane struct {
	Normal   Vector3
	Constant float64
}

func NewPlane

func NewPlane(normal Vector3, constant float64) *Plane

func (*Plane) ApplyMatrix4

func (p *Plane) ApplyMatrix4(matrix Matrix4, optionalNormalMatrix *Matrix3) *Plane

func (*Plane) Clone

func (p *Plane) Clone() *Plane

func (*Plane) CoplanarPoint

func (p *Plane) CoplanarPoint() *Vector3

func (*Plane) Copy

func (p *Plane) Copy(plane Plane) *Plane

func (*Plane) DistanceToPoint

func (p *Plane) DistanceToPoint(point Vector3) float64

func (*Plane) DistanceToSphere

func (p *Plane) DistanceToSphere(sphere Sphere) float64

func (*Plane) Equals

func (p *Plane) Equals(plane Plane) bool

func (*Plane) IntersectLine

func (p *Plane) IntersectLine(line Line3) *Vector3

func (*Plane) IntersectsBox

func (p *Plane) IntersectsBox(box Box3) bool

func (*Plane) IntersectsLine

func (p *Plane) IntersectsLine(line Line3) bool

func (*Plane) IntersectsSphere

func (p *Plane) IntersectsSphere(sphere Sphere) bool

func (*Plane) Negate

func (p *Plane) Negate() *Plane

func (*Plane) Normalize

func (p *Plane) Normalize() *Plane

func (*Plane) ProjectPoint

func (p *Plane) ProjectPoint(point Vector3) *Vector3

func (*Plane) Set

func (p *Plane) Set(normal Vector3, constant float64) *Plane

func (*Plane) SetComponents

func (p *Plane) SetComponents(x, y, z, w float64) *Plane

func (*Plane) SetFromCoplanarPoints

func (p *Plane) SetFromCoplanarPoints(a, b, c Vector3) *Plane

func (*Plane) SetFromNormalAndCoplanarPoint

func (p *Plane) SetFromNormalAndCoplanarPoint(normal, point Vector3) *Plane

func (*Plane) Translate

func (p *Plane) Translate(offset Vector3) *Plane

type Quaternion

type Quaternion struct {
	X, Y, Z, W float64
}

func MultiplyQuaternions

func MultiplyQuaternions(a, b Quaternion) *Quaternion

func NewIdentityQuaternion

func NewIdentityQuaternion() *Quaternion

func NewQuaternion

func NewQuaternion(x, y, z, w float64) *Quaternion

func (*Quaternion) AngleTo

func (q *Quaternion) AngleTo(qb Quaternion) float64

func (*Quaternion) Clone

func (q *Quaternion) Clone() *Quaternion

func (*Quaternion) Conjugate

func (q *Quaternion) Conjugate() *Quaternion

func (*Quaternion) Copy

func (q *Quaternion) Copy(quaternion Quaternion) *Quaternion

func (*Quaternion) Dot

func (q *Quaternion) Dot(v Quaternion) float64

func (*Quaternion) Equals

func (q *Quaternion) Equals(quaternion Quaternion) bool

func (*Quaternion) FromArray

func (q *Quaternion) FromArray(array []float64, offset int) *Quaternion

func (*Quaternion) Identity

func (q *Quaternion) Identity() *Quaternion

func (*Quaternion) Invert

func (q *Quaternion) Invert() *Quaternion

func (*Quaternion) Length

func (q *Quaternion) Length() float64

func (*Quaternion) LengthSq

func (q *Quaternion) LengthSq() float64

func (*Quaternion) Multiply

func (q *Quaternion) Multiply(qb Quaternion) *Quaternion

func (*Quaternion) MultiplyQuaternionsFlat

func (q *Quaternion) MultiplyQuaternionsFlat(dst []float64, dstOffset int, src0 []float64, srcOffset0 int, src1 []float64, srcOffset1 int) []float64

func (*Quaternion) Normalize

func (q *Quaternion) Normalize() *Quaternion

func (*Quaternion) Premultiply

func (q *Quaternion) Premultiply(qb Quaternion) *Quaternion

func (*Quaternion) RotateTowards

func (q *Quaternion) RotateTowards(qb Quaternion, step float64) *Quaternion

func (*Quaternion) Set

func (q *Quaternion) Set(x, y, z, w float64) *Quaternion

func (*Quaternion) SetFromAxisAngle

func (q *Quaternion) SetFromAxisAngle(axis Vector3, angle float64) *Quaternion

func (*Quaternion) SetFromEuler

func (q *Quaternion) SetFromEuler(euler Euler) *Quaternion

func (*Quaternion) SetFromRotationMatrix

func (q *Quaternion) SetFromRotationMatrix(m Matrix4) *Quaternion

func (*Quaternion) SetFromUnitVectors

func (q *Quaternion) SetFromUnitVectors(vFrom, vTo Vector3) *Quaternion

func (*Quaternion) Slerp

func (q *Quaternion) Slerp(qb Quaternion, t float64) *Quaternion

func (*Quaternion) SlerpFlat

func (q *Quaternion) SlerpFlat(dst []float64, dstOffset int, src0 []float64, srcOffset0 int, src1 []float64, srcOffset1 int, t float64)

func (*Quaternion) ToArray

func (q *Quaternion) ToArray(array []float64, offset int) []float64

type Ray

type Ray struct {
	Origin, Dir Vector3
}

func NewRay

func NewRay(origin, dir Vector3) *Ray

func (*Ray) ApplyMatrix4

func (r *Ray) ApplyMatrix4(matrix4 Matrix4) *Ray

func (*Ray) At

func (r *Ray) At(t float64) *Vector3

func (*Ray) Clone

func (r *Ray) Clone() *Ray

func (*Ray) ClosestPointToPoint

func (r *Ray) ClosestPointToPoint(point Vector3) *Vector3

func (*Ray) Copy

func (r *Ray) Copy(ray *Ray) *Ray

func (*Ray) DistanceSqToPoint

func (r *Ray) DistanceSqToPoint(point Vector3) float64

func (*Ray) DistanceSqToSegment

func (r *Ray) DistanceSqToSegment(v0, v1 Vector3, optionalPointOnRay, optionalPointOnSegment *Vector3) float64

func (*Ray) DistanceToPlane

func (r *Ray) DistanceToPlane(plane *Plane) float64

func (*Ray) DistanceToPoint

func (r *Ray) DistanceToPoint(point Vector3) float64

func (*Ray) Equals

func (r *Ray) Equals(ray Ray) bool

func (*Ray) IntersectBox

func (r *Ray) IntersectBox(box *Box3) *Vector3

func (*Ray) IntersectPlane

func (r *Ray) IntersectPlane(plane *Plane) *Vector3

func (*Ray) IntersectSphere

func (r *Ray) IntersectSphere(sphere *Sphere, target *Vector3) *Vector3

func (*Ray) IntersectTriangle

func (r *Ray) IntersectTriangle(a, b, c Vector3, backfaceCulling bool) *Vector3

func (*Ray) IntersectsBox

func (r *Ray) IntersectsBox(box *Box3) bool

func (*Ray) IntersectsPlane

func (r *Ray) IntersectsPlane(plane *Plane) bool

func (*Ray) IntersectsSphere

func (r *Ray) IntersectsSphere(sphere *Sphere) bool

func (*Ray) LookAt

func (r *Ray) LookAt(v *Vector3) *Ray

func (*Ray) Recast

func (r *Ray) Recast(t float64) *Ray

func (*Ray) Set

func (r *Ray) Set(origin, dir Vector3) *Ray

type Sphere

type Sphere struct {
	Center Vector3
	Radius float64
}

func NewSphere

func NewSphere(center Vector3, radius float64) *Sphere

func (*Sphere) ApplyMatrix4

func (s *Sphere) ApplyMatrix4(matrix Matrix4) *Sphere

func (*Sphere) BoundingBox

func (s *Sphere) BoundingBox() *Box3

func (*Sphere) ClampPoint

func (s *Sphere) ClampPoint(point Vector3) *Vector3

func (*Sphere) Clone

func (s *Sphere) Clone() *Sphere

func (*Sphere) ContainsPoint

func (s *Sphere) ContainsPoint(point Vector3) bool

func (*Sphere) Copy

func (s *Sphere) Copy(sphere Sphere) *Sphere

func (*Sphere) DistanceToPoint

func (s *Sphere) DistanceToPoint(point Vector3) float64

func (*Sphere) Equals

func (s *Sphere) Equals(sphere Sphere) bool

func (*Sphere) ExpandByPoint

func (s *Sphere) ExpandByPoint(point Vector3) *Sphere

func (*Sphere) IntersectsBox

func (s *Sphere) IntersectsBox(box Box3) bool

func (*Sphere) IntersectsPlane

func (s *Sphere) IntersectsPlane(plane Plane) bool

func (*Sphere) IntersectsSphere

func (s *Sphere) IntersectsSphere(sphere Sphere) bool

func (*Sphere) IsEmpty

func (s *Sphere) IsEmpty() bool

func (*Sphere) MakeEmpty

func (s *Sphere) MakeEmpty() *Sphere

func (*Sphere) Set

func (s *Sphere) Set(center Vector3, radius float64) *Sphere

func (*Sphere) SetFromPoints

func (s *Sphere) SetFromPoints(points []Vector3, optionalCenter *Vector3) *Sphere

func (*Sphere) Translate

func (s *Sphere) Translate(offset Vector3) *Sphere

func (*Sphere) Union

func (s *Sphere) Union(sphere Sphere) *Sphere

type Spherical

type Spherical struct {
	Radius, Phi, Theta float64
}

func NewSpherical

func NewSpherical(radius, phi, theta float64) *Spherical

func (*Spherical) Clone

func (s *Spherical) Clone() *Spherical

func (*Spherical) Copy

func (s *Spherical) Copy(other *Spherical) *Spherical

func (*Spherical) MakeSafe

func (s *Spherical) MakeSafe() *Spherical

func (*Spherical) Set

func (s *Spherical) Set(radius, phi, theta float64) *Spherical

func (*Spherical) SetFromCartesianCoords

func (s *Spherical) SetFromCartesianCoords(x, y, z float64) *Spherical

func (*Spherical) SetFromVector3

func (s *Spherical) SetFromVector3(v *Vector3) *Spherical

type SphericalHarmonics3

type SphericalHarmonics3 [9]Vector3

func NewSphericalHarmonics3

func NewSphericalHarmonics3() *SphericalHarmonics3

func (*SphericalHarmonics3) Add

func (*SphericalHarmonics3) AddScaledSH

func (*SphericalHarmonics3) BasisAt

func (sh *SphericalHarmonics3) BasisAt(normal Vector3, shBasis []float64) []float64

GetBasisAt evaluates the basis functions

func (*SphericalHarmonics3) Clone

func (*SphericalHarmonics3) Copy

func (*SphericalHarmonics3) Equals

func (*SphericalHarmonics3) FromArray

func (sh *SphericalHarmonics3) FromArray(array []float64, offset int) *SphericalHarmonics3

func (*SphericalHarmonics3) GetAt

func (sh *SphericalHarmonics3) GetAt(normal *Vector3) *Vector3

GetAt returns the radiance in the direction of the normal

func (*SphericalHarmonics3) GetIrradianceAt

func (sh *SphericalHarmonics3) GetIrradianceAt(normal Vector3) *Vector3

GetIrradianceAt returns the irradiance (radiance convolved with cosine lobe) in the direction of the normal

func (*SphericalHarmonics3) Lerp

func (*SphericalHarmonics3) Scale

func (*SphericalHarmonics3) Set

func (sh *SphericalHarmonics3) Set(coefficients ...Vector3) *SphericalHarmonics3

func (*SphericalHarmonics3) ToArray

func (sh *SphericalHarmonics3) ToArray(array []float64, offset int) []float64

func (*SphericalHarmonics3) Zero

type SplineCurve

type SplineCurve struct {
	// contains filtered or unexported fields
}

func NewSplineCurve

func NewSplineCurve(points ...Vector3) *SplineCurve

func (*SplineCurve) Clone

func (c *SplineCurve) Clone() *baseCurve

func (*SplineCurve) ComputeFrenetFrames added in v0.0.6

func (c *SplineCurve) ComputeFrenetFrames(segments int, closed bool) map[string][]Vector3

func (*SplineCurve) Copy

func (c *SplineCurve) Copy(source baseCurve) *baseCurve

func (*SplineCurve) Length

func (c *SplineCurve) Length() float64

func (*SplineCurve) Lengths

func (c *SplineCurve) Lengths(divisions int) []float64

func (*SplineCurve) LengthsDefault

func (c *SplineCurve) LengthsDefault() []float64

func (*SplineCurve) Point

func (c *SplineCurve) Point(t float64) *Vector3

func (*SplineCurve) PointAt

func (c *SplineCurve) PointAt(u float64) *Vector3

func (*SplineCurve) Points

func (c *SplineCurve) Points(divisions int) []Vector3

func (*SplineCurve) SpacedPoints

func (c *SplineCurve) SpacedPoints(divisions int) []Vector3

func (*SplineCurve) Tangent added in v0.0.6

func (c *SplineCurve) Tangent(t float64) *Vector3

Returns a unit vector tangent at t In case any sub curve does not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation

func (*SplineCurve) TangentAt added in v0.0.6

func (c *SplineCurve) TangentAt(u float64) *Vector3

func (*SplineCurve) UpdateArcLengths

func (c *SplineCurve) UpdateArcLengths()

type Triangle

type Triangle struct {
	A, B, C Vector3
}

func NewTriangle

func NewTriangle(a, b, c Vector3) Triangle

func (*Triangle) Area

func (t *Triangle) Area() float64

func (*Triangle) Barycoord

func (t *Triangle) Barycoord(point Vector3) *Vector3

func (*Triangle) Clone

func (t *Triangle) Clone() Triangle

func (*Triangle) ClosestPointToPoint

func (t *Triangle) ClosestPointToPoint(p Vector3) *Vector3

func (*Triangle) ContainsPoint

func (t *Triangle) ContainsPoint(point Vector3) bool

func (*Triangle) Copy

func (t *Triangle) Copy(triangle Triangle) *Triangle

func (*Triangle) Equals

func (t *Triangle) Equals(triangle Triangle) bool

func (*Triangle) Interpolation

func (t *Triangle) Interpolation(point, p1, p2, p3, v1, v2, v3 Vector3) *Vector3

func (*Triangle) IsFrontFacing

func (t *Triangle) IsFrontFacing(direction Vector3) bool

func (*Triangle) Midpoint

func (t *Triangle) Midpoint() *Vector3

func (*Triangle) Normal

func (t *Triangle) Normal() *Vector3

func (*Triangle) Plane

func (t *Triangle) Plane() *Plane

func (*Triangle) Set

func (t *Triangle) Set(a, b, c Vector3) *Triangle

func (*Triangle) SetFromPointsAndIndices

func (t *Triangle) SetFromPointsAndIndices(points []Vector3, i0, i1, i2 int) *Triangle

type Vector2

type Vector2 struct {
	X float64
	Y float64
}

func AddScaledVector2

func AddScaledVector2(vector Vector2, scalar float64) *Vector2

func AddVector2s

func AddVector2s(a, b Vector2) *Vector2

func LerpVectors

func LerpVectors(v1, v2 Vector2, alpha float64) *Vector2

func NewOneVector2

func NewOneVector2() *Vector2

func NewVector2

func NewVector2(x, y float64) *Vector2

func NewZeroVector2

func NewZeroVector2() *Vector2

func SubVector2s

func SubVector2s(a, b Vector2) *Vector2

func (*Vector2) Add

func (v *Vector2) Add(vector Vector2) *Vector2

func (*Vector2) AddScalar

func (v *Vector2) AddScalar(scalar float64) *Vector2

func (*Vector2) Angle

func (v *Vector2) Angle() float64

func (*Vector2) AngleTo

func (v *Vector2) AngleTo(vector Vector2) float64

func (*Vector2) ApplyMatrix3

func (v *Vector2) ApplyMatrix3(m Matrix3) *Vector2

func (*Vector2) Ceil

func (v *Vector2) Ceil() *Vector2

func (*Vector2) Clamp

func (v *Vector2) Clamp(minVal, maxVal Vector2) *Vector2

func (*Vector2) ClampLength

func (v *Vector2) ClampLength(minVal, maxVal float64) *Vector2

func (*Vector2) ClampScalar

func (v *Vector2) ClampScalar(minVal, maxVal float64) *Vector2

func (*Vector2) Clone

func (v *Vector2) Clone() *Vector2

func (*Vector2) Component

func (v *Vector2) Component(index int) float64

func (*Vector2) Copy

func (v *Vector2) Copy(vector Vector2) *Vector2

func (*Vector2) Cross

func (v *Vector2) Cross(vector Vector2) float64

func (*Vector2) DistanceTo

func (v *Vector2) DistanceTo(vector Vector2) float64

func (*Vector2) DistanceToSquared

func (v *Vector2) DistanceToSquared(vector Vector2) float64

func (*Vector2) Divide

func (v *Vector2) Divide(vector Vector2) *Vector2

func (*Vector2) DivideScalar

func (v *Vector2) DivideScalar(scalar float64) *Vector2

func (*Vector2) Dot

func (v *Vector2) Dot(vector Vector2) float64

func (*Vector2) Equals

func (v *Vector2) Equals(vector Vector2) bool

func (*Vector2) Floor

func (v *Vector2) Floor() *Vector2

func (*Vector2) FromArray

func (v *Vector2) FromArray(array []float64, offset int) *Vector2

func (*Vector2) Height

func (v *Vector2) Height() float64

func (*Vector2) Length

func (v *Vector2) Length() float64

func (*Vector2) LengthSq

func (v *Vector2) LengthSq() float64

func (*Vector2) Lerp

func (v *Vector2) Lerp(vector Vector2, alpha float64) *Vector2

func (*Vector2) ManhattanDistanceTo

func (v *Vector2) ManhattanDistanceTo(vector Vector2) float64

func (*Vector2) ManhattanLength

func (v *Vector2) ManhattanLength() float64

func (*Vector2) Max

func (v *Vector2) Max(vector Vector2) *Vector2

func (*Vector2) Min

func (v *Vector2) Min(vector Vector2) *Vector2

func (*Vector2) Multiply

func (v *Vector2) Multiply(vector Vector2) *Vector2

func (*Vector2) MultiplyScalar

func (v *Vector2) MultiplyScalar(scalar float64) *Vector2

func (*Vector2) Negate

func (v *Vector2) Negate() *Vector2

func (*Vector2) Normalize

func (v *Vector2) Normalize() *Vector2

func (*Vector2) Random

func (v *Vector2) Random() *Vector2

func (*Vector2) RotateAround

func (v *Vector2) RotateAround(center Vector2, angle float64) *Vector2

func (*Vector2) Round

func (v *Vector2) Round() *Vector2

func (*Vector2) RoundToZero

func (v *Vector2) RoundToZero() *Vector2

func (*Vector2) Set

func (v *Vector2) Set(x, y float64) *Vector2

func (*Vector2) SetComponent

func (v *Vector2) SetComponent(index int, value float64) *Vector2

func (*Vector2) SetHeight

func (v *Vector2) SetHeight(value float64) *Vector2

func (*Vector2) SetLength

func (v *Vector2) SetLength(length float64) *Vector2

func (*Vector2) SetScalar

func (v *Vector2) SetScalar(scalar float64) *Vector2

func (*Vector2) SetWidth

func (v *Vector2) SetWidth(value float64) *Vector2

func (*Vector2) SetX

func (v *Vector2) SetX(x float64) *Vector2

func (*Vector2) SetY

func (v *Vector2) SetY(y float64) *Vector2

func (*Vector2) Sub

func (v *Vector2) Sub(vector Vector2) *Vector2

func (*Vector2) SubScalar

func (v *Vector2) SubScalar(scalar float64) *Vector2

func (*Vector2) ToArray

func (v *Vector2) ToArray(array []float64, offset int) []float64

func (*Vector2) Width

func (v *Vector2) Width() float64

type Vector3

type Vector3 struct {
	X, Y, Z float64
}

func AddVector3s

func AddVector3s(a, b Vector3) *Vector3

func CrossVector3s

func CrossVector3s(a, b Vector3) *Vector3

func LerpVector3s

func LerpVector3s(v1, v2 Vector3, alpha float64) *Vector3

func MultiplyVector3s

func MultiplyVector3s(a, b Vector3) *Vector3

func NewOneVector3

func NewOneVector3() *Vector3

func NewVector3

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

func NewZeroVector3

func NewZeroVector3() *Vector3

func SubVector3s

func SubVector3s(a, b Vector3) *Vector3

func (*Vector3) Add

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

func (*Vector3) AddScalar

func (v *Vector3) AddScalar(scalar float64) *Vector3

func (*Vector3) AddScaledVector

func (v *Vector3) AddScaledVector(vector Vector3, scalar float64) *Vector3

func (*Vector3) AngleTo

func (v *Vector3) AngleTo(v2 Vector3) float64

func (*Vector3) ApplyAxisAngle

func (v *Vector3) ApplyAxisAngle(axis Vector3, angle float64) *Vector3

func (*Vector3) ApplyEuler

func (v *Vector3) ApplyEuler(e Euler) *Vector3

func (*Vector3) ApplyMatrix3

func (v *Vector3) ApplyMatrix3(m Matrix3) *Vector3

func (*Vector3) ApplyMatrix4

func (v *Vector3) ApplyMatrix4(m Matrix4) *Vector3

func (*Vector3) ApplyNormalMatrix

func (v *Vector3) ApplyNormalMatrix(m Matrix3) *Vector3

func (*Vector3) ApplyQuaternion

func (v *Vector3) ApplyQuaternion(q Quaternion) *Vector3

func (*Vector3) Ceil

func (v *Vector3) Ceil() *Vector3

func (*Vector3) Clamp

func (v *Vector3) Clamp(minVal, maxVal Vector3) *Vector3

func (*Vector3) ClampLength

func (v *Vector3) ClampLength(minVal, maxVal float64) *Vector3

func (*Vector3) ClampScalar

func (v *Vector3) ClampScalar(minVal, maxVal float64) *Vector3

func (*Vector3) Clone

func (v *Vector3) Clone() *Vector3

func (*Vector3) Component

func (v *Vector3) Component(index int) float64

func (*Vector3) Copy

func (v *Vector3) Copy(vector Vector3) *Vector3

func (*Vector3) Cross

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

func (*Vector3) DistanceTo

func (v *Vector3) DistanceTo(v2 Vector3) float64

func (*Vector3) DistanceToSquared

func (v *Vector3) DistanceToSquared(v2 Vector3) float64

func (*Vector3) Divide

func (v *Vector3) Divide(v2 Vector3) *Vector3

func (*Vector3) DivideScalar

func (v *Vector3) DivideScalar(scalar float64) *Vector3

func (*Vector3) Dot

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

func (*Vector3) Equals

func (v *Vector3) Equals(v2 Vector3) bool

func (*Vector3) Floor

func (v *Vector3) Floor() *Vector3

func (*Vector3) FromArray

func (v *Vector3) FromArray(array []float64, offset int) *Vector3

func (*Vector3) Length

func (v *Vector3) Length() float64

func (*Vector3) LengthSq

func (v *Vector3) LengthSq() float64

func (*Vector3) Lerp

func (v *Vector3) Lerp(v2 Vector3, alpha float64) *Vector3

func (*Vector3) ManhattanDistanceTo

func (v *Vector3) ManhattanDistanceTo(v2 Vector3) float64

func (*Vector3) Max

func (v *Vector3) Max(v2 Vector3) *Vector3

func (*Vector3) Min

func (v *Vector3) Min(v2 Vector3) *Vector3

func (*Vector3) Multiply

func (v *Vector3) Multiply(v2 Vector3) *Vector3

func (*Vector3) MultiplyScalar

func (v *Vector3) MultiplyScalar(scalar float64) *Vector3

func (*Vector3) Negate

func (v *Vector3) Negate() *Vector3

func (*Vector3) Normalize

func (v *Vector3) Normalize() *Vector3

func (*Vector3) ProjectOnPlane

func (v *Vector3) ProjectOnPlane(planeNormal Vector3) *Vector3

func (*Vector3) ProjectOnVector

func (v *Vector3) ProjectOnVector(v2 Vector3) *Vector3

func (*Vector3) Random

func (v *Vector3) Random() *Vector3

func (*Vector3) RandomDirection

func (v *Vector3) RandomDirection() *Vector3

func (*Vector3) Reflect

func (v *Vector3) Reflect(normal Vector3) *Vector3

func (*Vector3) Round

func (v *Vector3) Round() *Vector3

func (*Vector3) RoundToZero

func (v *Vector3) RoundToZero() *Vector3

func (*Vector3) Set

func (v *Vector3) Set(x, y, z float64) *Vector3

func (*Vector3) SetComponent

func (v *Vector3) SetComponent(index int, value float64) *Vector3

func (*Vector3) SetFromCylindrical

func (v *Vector3) SetFromCylindrical(c Cylindrical) *Vector3

func (*Vector3) SetFromCylindricalCoords

func (v *Vector3) SetFromCylindricalCoords(radius, theta, y float64) *Vector3

func (*Vector3) SetFromMatrixColumn

func (v *Vector3) SetFromMatrixColumn(m Matrix4, index int) *Vector3

func (*Vector3) SetFromMatrixPosition

func (v *Vector3) SetFromMatrixPosition(m Matrix4) *Vector3

func (*Vector3) SetFromMatrixScale

func (v *Vector3) SetFromMatrixScale(m Matrix4) *Vector3

func (*Vector3) SetFromSpherical

func (v *Vector3) SetFromSpherical(s Spherical) *Vector3

func (*Vector3) SetFromSphericalCoords

func (v *Vector3) SetFromSphericalCoords(radius, phi, theta float64) *Vector3

func (*Vector3) SetLength

func (v *Vector3) SetLength(length float64) *Vector3

func (*Vector3) SetScalar

func (v *Vector3) SetScalar(scalar float64) *Vector3

func (*Vector3) Sub

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

func (*Vector3) SubScalar

func (v *Vector3) SubScalar(scalar float64) *Vector3

func (*Vector3) ToArray

func (v *Vector3) ToArray(array []float64, offset int) []float64

func (*Vector3) TransformDirection

func (v *Vector3) TransformDirection(m Matrix4) *Vector3

Jump to

Keyboard shortcuts

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