mathx

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEG2RAD = math.Pi / 180
	RAD2DEG = 180 / math.Pi
	EPSILON = 7.0/3 - 4.0/3 - 1.0
)

Variables

View Source
var (
	V3Zero32 = *NewZeroVector3[float32]()
	V3One32  = *NewOneVector3[float32]()
	V3Zero64 = *NewZeroVector3[float64]()
	V3One64  = *NewOneVector3[float64]()
)

Functions

func CatmullRom

func CatmullRom[T constraints.Float](t, p0, p1, p2, p3 T) T

func CeilPowerOfTwo

func CeilPowerOfTwo[T constraints.Integer](value T) T

func Clamp

func Clamp[T constraints.Float](value, min, max T) T

func CubicBezier

func CubicBezier[T constraints.Float](t, p0, p1, p2, p3 T) T

func CubicBezierP0

func CubicBezierP0[T constraints.Float](t, p T) T

func CubicBezierP1

func CubicBezierP1[T constraints.Float](t, p T) T

func CubicBezierP2

func CubicBezierP2[T constraints.Float](t, p T) T

func CubicBezierP3

func CubicBezierP3[T constraints.Float](t, p T) T

func DegToRad

func DegToRad[T constraints.Float](degrees T) T

func EuclideanModulo

func EuclideanModulo[T constraints.Float](n, m T) T

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

func FloorPowerOfTwo

func FloorPowerOfTwo[T constraints.Integer](value T) T

func IsPowerOfTwo

func IsPowerOfTwo[T constraints.Integer](value T) bool

func MapLinear

func MapLinear[T constraints.Float](x, a1, a2, b1, b2 T) T

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

func QuadraticBezier

func QuadraticBezier[T constraints.Float](t, p0, p1, p2 T) T

func QuadraticBezierP0

func QuadraticBezierP0[T constraints.Float](t, p T) T

func QuadraticBezierP1

func QuadraticBezierP1[T constraints.Float](t, p T) T

func QuadraticBezierP2

func QuadraticBezierP2[T constraints.Float](t, p T) T

func RadToDeg

func RadToDeg[T constraints.Float](radians T) T

func RandFloatSpread

func RandFloatSpread[T constraints.Float](rng T) T

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

func SetQuaternionFromProperEuler

func SetQuaternionFromProperEuler[T constraints.Float](q *Quaternion[T], a, b, c T, order string)

func Smootherstep

func Smootherstep[T constraints.Float](x, min, max T) T

func Smoothstep

func Smoothstep[T constraints.Float](x, min, max T) T

http://en.wikipedia.org/wiki/Smoothstep

Types

type ArcCurve

type ArcCurve[T constraints.Float] struct {
	EllipseCurve[T]
}

func NewArcCurve

func NewArcCurve[T constraints.Float](aX, aY, aRadius, aStartAngle, aEndAngle T, aClockwise bool) *ArcCurve[T]

func (*ArcCurve) Clone

func (c *ArcCurve) Clone() *baseCurve[T]

func (*ArcCurve) ComputeFrenetFrames added in v0.0.6

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

func (*ArcCurve) Tangent added in v0.0.6

func (c *ArcCurve) Tangent(t T) *Vector3[T]

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 T) *Vector3[T]

type Box2

type Box2[T constraints.Float] struct {
	Min Vector2[T]
	Max Vector2[T]
}

func NewBox2

func NewBox2[T constraints.Float]() *Box2[T]

func (*Box2[T]) ClampPoint

func (b *Box2[T]) ClampPoint(point Vector2[T], target *Vector2[T]) *Vector2[T]

func (*Box2[T]) Clone

func (b *Box2[T]) Clone() *Box2[T]

func (*Box2[T]) ContainsBox

func (b *Box2[T]) ContainsBox(box *Box2[T]) bool

func (*Box2[T]) ContainsPoint

func (b *Box2[T]) ContainsPoint(point Vector2[T]) bool

func (*Box2[T]) Copy

func (b *Box2[T]) Copy(box *Box2[T]) *Box2[T]

func (*Box2[T]) DistanceToPoint

func (b *Box2[T]) DistanceToPoint(point Vector2[T]) T

func (*Box2[T]) Equals

func (b *Box2[T]) Equals(box *Box2[T]) bool

func (*Box2[T]) ExpandByPoint

func (b *Box2[T]) ExpandByPoint(point Vector2[T]) *Box2[T]

func (*Box2[T]) ExpandByScalar

func (b *Box2[T]) ExpandByScalar(scalar T) *Box2[T]

func (*Box2[T]) ExpandByVector

func (b *Box2[T]) ExpandByVector(vector Vector2[T]) *Box2[T]

func (*Box2[T]) GetCenter

func (b *Box2[T]) GetCenter(target *Vector2[T]) *Vector2[T]

func (*Box2[T]) GetParameter

func (b *Box2[T]) GetParameter(point Vector2[T], target *Vector2[T]) *Vector2[T]

func (*Box2[T]) GetSize

func (b *Box2[T]) GetSize(target *Vector2[T]) *Vector2[T]

func (*Box2[T]) Intersect

func (b *Box2[T]) Intersect(box *Box2[T]) *Box2[T]

func (*Box2[T]) IntersectsBox

func (b *Box2[T]) IntersectsBox(box *Box2[T]) bool

func (*Box2[T]) IsEmpty

func (b *Box2[T]) IsEmpty() bool

func (*Box2[T]) MakeEmpty

func (b *Box2[T]) MakeEmpty() *Box2[T]

func (*Box2[T]) Set

func (b *Box2[T]) Set(min, max Vector2[T]) *Box2[T]

func (*Box2[T]) SetFromCenterAndSize

func (b *Box2[T]) SetFromCenterAndSize(center, size Vector2[T]) *Box2[T]

func (*Box2[T]) SetFromPoints

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

func (*Box2[T]) Translate

func (b *Box2[T]) Translate(offset Vector2[T]) *Box2[T]

func (*Box2[T]) Union

func (b *Box2[T]) Union(box *Box2[T]) *Box2[T]

type Box3

type Box3[T constraints.Float] struct {
	Min Vector3[T]
	Max Vector3[T]
}

func NewBox3

func NewBox3[T constraints.Float](minVal, maxVal Vector3[T]) *Box3[T]

func (*Box3[T]) ApplyMatrix4

func (b *Box3[T]) ApplyMatrix4(matrix Matrix4[T]) *Box3[T]

func (*Box3[T]) Center

func (b *Box3[T]) Center() Vector3[T]

func (*Box3[T]) ClampPoint

func (b *Box3[T]) ClampPoint(point Vector3[T]) (target *Vector3[T])

func (*Box3[T]) Clone

func (b *Box3[T]) Clone() *Box3[T]

func (*Box3[T]) ContainsBox

func (b *Box3[T]) ContainsBox(box Box3[T]) bool

func (*Box3[T]) ContainsPoint

func (b *Box3[T]) ContainsPoint(point Vector3[T]) bool

func (*Box3[T]) Copy

func (b *Box3[T]) Copy(box *Box3[T]) *Box3[T]

func (*Box3[T]) DistanceToPoint

func (b *Box3[T]) DistanceToPoint(point Vector3[T]) T

func (*Box3[T]) Equals

func (b *Box3[T]) Equals(box Box3[T]) bool

func (*Box3[T]) ExpandByPoint

func (b *Box3[T]) ExpandByPoint(point Vector3[T]) *Box3[T]

func (*Box3[T]) ExpandByScalar

func (b *Box3[T]) ExpandByScalar(scalar T) *Box3[T]

func (*Box3[T]) ExpandByVector

func (b *Box3[T]) ExpandByVector(vector Vector3[T]) *Box3[T]

func (*Box3[T]) GetBoundingSphere

func (b *Box3[T]) GetBoundingSphere() *Sphere[T]

func (*Box3[T]) GetParameter

func (b *Box3[T]) GetParameter(point Vector3[T]) (target Vector3[T])

func (*Box3[T]) Intersect

func (b *Box3[T]) Intersect(box Box3[T]) *Box3[T]

func (*Box3[T]) IntersectsBox

func (b *Box3[T]) IntersectsBox(box Box3[T]) bool

func (*Box3[T]) IntersectsPlane

func (b *Box3[T]) IntersectsPlane(plane Plane[T]) bool

func (*Box3[T]) IntersectsSphere

func (b *Box3[T]) IntersectsSphere(sphere Sphere[T]) bool

func (*Box3[T]) IntersectsTriangle

func (b *Box3[T]) IntersectsTriangle(triangle Triangle[T]) bool

func (*Box3[T]) IsEmpty

func (b *Box3[T]) IsEmpty() bool

func (*Box3[T]) MakeEmpty

func (b *Box3[T]) MakeEmpty() *Box3[T]

func (*Box3[T]) Set

func (b *Box3[T]) Set(min, max Vector3[T]) *Box3[T]

func (*Box3[T]) SetFromCenterAndSize

func (b *Box3[T]) SetFromCenterAndSize(center, size Vector3[T]) *Box3[T]

func (*Box3[T]) SetFromPoints

func (b *Box3[T]) SetFromPoints(points ...Vector3[T]) *Box3[T]

func (*Box3[T]) Size

func (b *Box3[T]) Size() *Vector3[T]

func (*Box3[T]) Translate

func (b *Box3[T]) Translate(offset Vector3[T]) *Box3[T]

func (*Box3[T]) Union

func (b *Box3[T]) Union(box Box3[T]) *Box3[T]

type CatmullRomCurve3

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

func NewCatmullRomCurve3

func NewCatmullRomCurve3[T constraints.Float](points []*Vector3[T], closed bool, curveType CurveType, tension T) *CatmullRomCurve3[T]

func (*CatmullRomCurve3) Clone

func (c *CatmullRomCurve3) Clone() *baseCurve[T]

func (*CatmullRomCurve3) ComputeFrenetFrames added in v0.0.6

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

func (*CatmullRomCurve3[T]) Copy

func (c *CatmullRomCurve3[T]) Copy(source *CatmullRomCurve3[T]) *CatmullRomCurve3[T]

func (*CatmullRomCurve3[T]) GetPoint

func (c *CatmullRomCurve3[T]) GetPoint(t T, optionalTarget *Vector3[T]) *Vector3[T]

func (*CatmullRomCurve3) Length

func (c *CatmullRomCurve3) Length() T

Get total curve arc length

func (*CatmullRomCurve3) Lengths

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

Get list of cumulative segment lengths

func (*CatmullRomCurve3) LengthsDefault

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

func (*CatmullRomCurve3) Point

func (c *CatmullRomCurve3) Point(t T) *Vector3[T]

Virtual base class method to overwrite and implement in subclasses

  • t [0 .. 1]

func (*CatmullRomCurve3) PointAt

func (c *CatmullRomCurve3) PointAt(u T) *Vector3[T]

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

func (*CatmullRomCurve3) Points

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

Get sequence of points using getPoint( t )

func (*CatmullRomCurve3) SpacedPoints

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

Get sequence of points using getPointAt( u )

func (*CatmullRomCurve3) Tangent added in v0.0.6

func (c *CatmullRomCurve3) Tangent(t T) *Vector3[T]

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 T) *Vector3[T]

func (*CatmullRomCurve3) UpdateArcLengths

func (c *CatmullRomCurve3) UpdateArcLengths()

type CoordinateSystem

type CoordinateSystem int
const (
	CoordinateSystemWebGL CoordinateSystem = iota
	CoordinateSystemWebGPU
)

type CubicBezierCurve

type CubicBezierCurve[T constraints.Float] struct {
	V0, V1, V2, V3 Vector3[T]
	// contains filtered or unexported fields
}

func NewCubicBezierCurve3

func NewCubicBezierCurve3[T constraints.Float](v0, v1, v2, v3 Vector3[T]) *CubicBezierCurve[T]

func (*CubicBezierCurve) Clone

func (c *CubicBezierCurve) Clone() *baseCurve[T]

func (*CubicBezierCurve) ComputeFrenetFrames added in v0.0.6

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

func (*CubicBezierCurve) Copy

func (c *CubicBezierCurve) Copy(source baseCurve[T]) *baseCurve[T]

func (*CubicBezierCurve[T]) Length

func (c *CubicBezierCurve[T]) Length() T

func (*CubicBezierCurve[T]) Lengths

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

func (*CubicBezierCurve[T]) LengthsDefault

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

func (*CubicBezierCurve[T]) Point

func (c *CubicBezierCurve[T]) Point(t T) *Vector3[T]

func (*CubicBezierCurve[T]) PointAt

func (c *CubicBezierCurve[T]) PointAt(u T) *Vector3[T]

func (*CubicBezierCurve[T]) Points

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

func (*CubicBezierCurve[T]) SpacedPoints

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

func (*CubicBezierCurve) Tangent added in v0.0.6

func (c *CubicBezierCurve) Tangent(t T) *Vector3[T]

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 T) *Vector3[T]

func (*CubicBezierCurve[T]) UpdateArcLengths

func (c *CubicBezierCurve[T]) UpdateArcLengths()

type Curve

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

type CurvePath

type CurvePath[T constraints.Float] struct {
	// contains filtered or unexported fields
}

func NewCurvePath

func NewCurvePath[T constraints.Float]() *CurvePath[T]

func (*CurvePath[T]) Add

func (c *CurvePath[T]) Add(curve Curve[T])

func (*CurvePath[T]) ClosePath

func (c *CurvePath[T]) ClosePath() *CurvePath[T]

func (*CurvePath[T]) Copy

func (c *CurvePath[T]) Copy(source *CurvePath[T]) *CurvePath[T]

func (*CurvePath[T]) Length

func (c *CurvePath[T]) Length() T

func (*CurvePath[T]) Lengths

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

func (*CurvePath[T]) Point

func (c *CurvePath[T]) Point(t T) *Vector3[T]

func (*CurvePath[T]) Points

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

func (*CurvePath[T]) SpacedPoints

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

func (*CurvePath[T]) UpdateArcLengths

func (c *CurvePath[T]) UpdateArcLengths()

type CurveType

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

type Cylindrical

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

func NewCylindrical

func NewCylindrical[T constraints.Float](radius, theta, y T) *Cylindrical[T]

func (*Cylindrical[T]) Clone

func (c *Cylindrical[T]) Clone() *Cylindrical[T]

func (*Cylindrical[T]) Copy

func (c *Cylindrical[T]) Copy(other *Cylindrical[T]) *Cylindrical[T]

func (*Cylindrical[T]) Set

func (c *Cylindrical[T]) Set(radius, theta, y T) *Cylindrical[T]

func (*Cylindrical[T]) SetFromCartesianCoords

func (c *Cylindrical[T]) SetFromCartesianCoords(x, y, z T) *Cylindrical[T]

func (*Cylindrical[T]) SetFromVector3

func (c *Cylindrical[T]) SetFromVector3(v *Vector3[T]) *Cylindrical[T]

type EllipseCurve

type EllipseCurve[T constraints.Float] struct {
	// contains filtered or unexported fields
}

func NewEllipseCurve

func NewEllipseCurve[T constraints.Float](aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aRotation T, aClockwise bool) *EllipseCurve[T]

func (*EllipseCurve) Clone

func (c *EllipseCurve) Clone() *baseCurve[T]

func (*EllipseCurve) ComputeFrenetFrames added in v0.0.6

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

func (*EllipseCurve[T]) Copy

func (c *EllipseCurve[T]) Copy(source *EllipseCurve[T]) *EllipseCurve[T]

func (*EllipseCurve[T]) Length

func (c *EllipseCurve[T]) Length() T

func (*EllipseCurve[T]) Lengths

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

func (*EllipseCurve[T]) LengthsDefault

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

func (*EllipseCurve[T]) Point

func (c *EllipseCurve[T]) Point(t T) *Vector3[T]

func (*EllipseCurve[T]) PointAt

func (c *EllipseCurve[T]) PointAt(u T) *Vector3[T]

func (*EllipseCurve[T]) Points

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

func (*EllipseCurve[T]) SpacedPoints

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

func (*EllipseCurve) Tangent added in v0.0.6

func (c *EllipseCurve) Tangent(t T) *Vector3[T]

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 T) *Vector3[T]

func (*EllipseCurve[T]) UpdateArcLengths

func (c *EllipseCurve[T]) UpdateArcLengths()

type Euler

type Euler[T constraints.Float] struct {
	X     T
	Y     T
	Z     T
	Order EulerOrder
}

func NewEuler

func NewEuler[T constraints.Float](x, y, z T, order EulerOrder) *Euler[T]

func (*Euler[T]) Clone

func (e *Euler[T]) Clone() *Euler[T]

func (*Euler[T]) Copy

func (e *Euler[T]) Copy(euler *Euler[T]) *Euler[T]

func (*Euler[T]) Equals

func (e *Euler[T]) Equals(euler *Euler[T]) bool

func (*Euler[T]) FromArray

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

func (*Euler[T]) Reorder

func (e *Euler[T]) Reorder(newOrder EulerOrder) *Euler[T]

func (*Euler[T]) Set

func (e *Euler[T]) Set(x, y, z T, order EulerOrder) *Euler[T]

func (*Euler[T]) SetFromQuaternion

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

func (*Euler[T]) SetFromRotationMatrix

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

func (*Euler[T]) SetFromVector3

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

func (*Euler[T]) ToArray

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

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[T constraints.Float] struct {
	Start, End Vector3[T]
}

func NewLine3

func NewLine3[T constraints.Float](start, end Vector3[T]) *Line3[T]

func (*Line3[T]) ApplyMatrix4

func (l *Line3[T]) ApplyMatrix4(matrix Matrix4[T]) *Line3[T]

func (*Line3[T]) At

func (l *Line3[T]) At(t T) *Vector3[T]

func (*Line3[T]) Center

func (l *Line3[T]) Center() *Vector3[T]

func (*Line3[T]) Clone

func (l *Line3[T]) Clone() *Line3[T]

func (*Line3[T]) ClosestPointToPoint

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

func (*Line3[T]) ClosestPointToPointParameter

func (l *Line3[T]) ClosestPointToPointParameter(point Vector3[T], clampToLine bool) T

func (*Line3[T]) Copy

func (l *Line3[T]) Copy(line Line3[T]) *Line3[T]

func (*Line3[T]) Delta

func (l *Line3[T]) Delta() *Vector3[T]

func (*Line3[T]) Distance

func (l *Line3[T]) Distance() T

func (*Line3[T]) DistanceSq

func (l *Line3[T]) DistanceSq() T

func (*Line3[T]) Equals

func (l *Line3[T]) Equals(line Line3[T]) bool

func (*Line3[T]) Set

func (l *Line3[T]) Set(start, end Vector3[T]) *Line3[T]

type LineCurve

type LineCurve[T constraints.Float] struct {
	V1, V2 Vector3[T]
	// contains filtered or unexported fields
}

func NewLineCurve3

func NewLineCurve3[T constraints.Float](v1, v2 Vector3[T]) *LineCurve[T]

func (*LineCurve) Clone

func (c *LineCurve) Clone() *baseCurve[T]

func (*LineCurve) ComputeFrenetFrames added in v0.0.6

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

func (*LineCurve) Copy

func (c *LineCurve) Copy(source baseCurve[T]) *baseCurve[T]

func (*LineCurve[T]) Length

func (c *LineCurve[T]) Length() T

func (*LineCurve[T]) Lengths

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

func (*LineCurve[T]) LengthsDefault

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

func (*LineCurve[T]) Point

func (c *LineCurve[T]) Point(t T) *Vector3[T]

func (*LineCurve[T]) PointAt

func (c *LineCurve[T]) PointAt(u T) *Vector3[T]

func (*LineCurve[T]) Points

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

func (*LineCurve[T]) SpacedPoints

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

func (*LineCurve) Tangent added in v0.0.6

func (c *LineCurve) Tangent(t T) *Vector3[T]

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 T) *Vector3[T]

func (*LineCurve[T]) UpdateArcLengths

func (c *LineCurve[T]) UpdateArcLengths()

type Matrix3

type Matrix3[T constraints.Float] [9]T

func MultiplyMatrices

func MultiplyMatrices[T constraints.Float](a, b Matrix3[T]) *Matrix3[T]

func NewMatrix3

func NewMatrix3[T constraints.Float](n11, n12, n13, n21, n22, n23, n31, n32, n33 T) *Matrix3[T]

func NewMatrix3Identity

func NewMatrix3Identity[T constraints.Float]() *Matrix3[T]

func (*Matrix3[T]) Clone

func (m *Matrix3[T]) Clone() *Matrix3[T]

func (*Matrix3[T]) Copy

func (m *Matrix3[T]) Copy(matrix Matrix3[T]) *Matrix3[T]

func (*Matrix3[T]) Demrminant

func (m *Matrix3[T]) Demrminant() T

func (*Matrix3[T]) Equals

func (m *Matrix3[T]) Equals(matrix Matrix3[T]) bool

func (*Matrix3[T]) FromArray

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

func (*Matrix3[T]) Identity

func (m *Matrix3[T]) Identity() *Matrix3[T]

func (*Matrix3[T]) Invert

func (m *Matrix3[T]) Invert() *Matrix3[T]

func (*Matrix3[T]) MakeRotation

func (m *Matrix3[T]) MakeRotation(theta T) *Matrix3[T]

func (*Matrix3[T]) MakeScale

func (m *Matrix3[T]) MakeScale(x, y T) *Matrix3[T]

func (*Matrix3[T]) MakeTranslation

func (m *Matrix3[T]) MakeTranslation(x, y T) *Matrix3[T]

func (*Matrix3[T]) Multiply

func (m *Matrix3[T]) Multiply(matrix Matrix3[T]) *Matrix3[T]

func (*Matrix3[T]) MultiplyScalar

func (m *Matrix3[T]) MultiplyScalar(s T) *Matrix3[T]

func (*Matrix3[T]) NormalMatrix

func (m *Matrix3[T]) NormalMatrix(matrix4 Matrix4[T]) *Matrix3[T]

func (*Matrix3[T]) Premultiply

func (m *Matrix3[T]) Premultiply(matrix Matrix3[T]) *Matrix3[T]

func (*Matrix3[T]) Rotam

func (m *Matrix3[T]) Rotam(theta T) *Matrix3[T]

func (*Matrix3[T]) Scale

func (m *Matrix3[T]) Scale(sx, sy T) *Matrix3[T]

func (*Matrix3[T]) Set

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

func (*Matrix3[T]) SetFromMatrix4

func (m *Matrix3[T]) SetFromMatrix4(me Matrix4[T]) *Matrix3[T]

func (*Matrix3[T]) SetUvTransform

func (m *Matrix3[T]) SetUvTransform(tx, ty, sx, sy, rotation, cx, cy T) *Matrix3[T]

func (*Matrix3[T]) ToArray

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

func (*Matrix3[T]) Translam

func (m *Matrix3[T]) Translam(tx, ty T) *Matrix3[T]

func (*Matrix3[T]) Transpose

func (m *Matrix3[T]) Transpose() *Matrix3[T]

func (*Matrix3[T]) TransposeIntoArray

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

type Matrix4

type Matrix4[T constraints.Float] [16]T

func MakeRotationFromQuaternion

func MakeRotationFromQuaternion[T constraints.Float](q Quaternion[T]) *Matrix4[T]

func MultiplyMatrice4s

func MultiplyMatrice4s[T constraints.Float](a, b Matrix4[T]) *Matrix4[T]

func NewMatrix4

func NewMatrix4[T constraints.Float](n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 T) *Matrix4[T]

func NewMatrix4Identity

func NewMatrix4Identity[T constraints.Float]() *Matrix4[T]

func (*Matrix4[T]) Clone

func (m *Matrix4[T]) Clone() *Matrix4[T]

func (*Matrix4[T]) Compose

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

func (*Matrix4[T]) Copy

func (m *Matrix4[T]) Copy(matrix Matrix4[T]) *Matrix4[T]

func (*Matrix4[T]) CopyPosition

func (m *Matrix4[T]) CopyPosition(matrix Matrix4[T]) *Matrix4[T]

func (*Matrix4[T]) Decompose

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

func (*Matrix4[T]) Demrminant

func (m *Matrix4[T]) Demrminant() T

func (*Matrix4[T]) Equals

func (m *Matrix4[T]) Equals(matrix Matrix4[T]) bool

func (*Matrix4[T]) ExtractBasis

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

func (*Matrix4[T]) ExtractRotation

func (m *Matrix4[T]) ExtractRotation(matrix Matrix4[T]) *Matrix4[T]

func (*Matrix4[T]) FromArray

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

func (*Matrix4[T]) Identity

func (m *Matrix4[T]) Identity() *Matrix4[T]

func (*Matrix4[T]) Invert

func (m *Matrix4[T]) Invert() *Matrix4[T]

func (*Matrix4[T]) LookAt

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

func (*Matrix4[T]) MakeBasis

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

func (*Matrix4[T]) MakeOrthographic

func (m *Matrix4[T]) MakeOrthographic(left, right, top, bottom, near, far T) *Matrix4[T]

func (*Matrix4[T]) MakePerspective

func (m *Matrix4[T]) MakePerspective(left, right, top, bottom, near, far T) *Matrix4[T]

func (*Matrix4[T]) MakeRotationAxis

func (m *Matrix4[T]) MakeRotationAxis(axis Vector3[T], angle T) *Matrix4[T]

func (*Matrix4[T]) MakeRotationFromEuler

func (m *Matrix4[T]) MakeRotationFromEuler(euler Euler[T]) *Matrix4[T]

func (*Matrix4[T]) MakeRotationX

func (m *Matrix4[T]) MakeRotationX(theta T) *Matrix4[T]

func (*Matrix4[T]) MakeRotationY

func (m *Matrix4[T]) MakeRotationY(theta T) *Matrix4[T]

func (*Matrix4[T]) MakeRotationZ

func (m *Matrix4[T]) MakeRotationZ(theta T) *Matrix4[T]

func (*Matrix4[T]) MakeScale

func (m *Matrix4[T]) MakeScale(v Vector3[T]) *Matrix4[T]

func (*Matrix4[T]) MakeShear

func (m *Matrix4[T]) MakeShear(xy, xz, yx, yz, zx, zy T) *Matrix4[T]

func (*Matrix4[T]) MakeTranslation

func (m *Matrix4[T]) MakeTranslation(v Vector3[T]) *Matrix4[T]

func (*Matrix4[T]) MaxScaleOnAxis

func (m *Matrix4[T]) MaxScaleOnAxis() T

func (*Matrix4[T]) Multiply

func (m *Matrix4[T]) Multiply(m2 Matrix4[T]) *Matrix4[T]

func (*Matrix4[T]) MultiplyScalar

func (m *Matrix4[T]) MultiplyScalar(s T) *Matrix4[T]

func (*Matrix4[T]) Premultiply

func (m *Matrix4[T]) Premultiply(m2 Matrix4[T]) *Matrix4[T]

func (*Matrix4[T]) Scale

func (m *Matrix4[T]) Scale(v Vector3[T]) *Matrix4[T]

func (*Matrix4[T]) Set

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

func (*Matrix4[T]) SetFromMatrix3

func (m *Matrix4[T]) SetFromMatrix3(matrix Matrix3[T]) *Matrix4[T]

func (*Matrix4[T]) SetPosition

func (m *Matrix4[T]) SetPosition(v Vector3[T]) *Matrix4[T]

func (*Matrix4[T]) ToArray

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

func (*Matrix4[T]) Transpose

func (m *Matrix4[T]) Transpose() *Matrix4[T]

type Plane

type Plane[T constraints.Float] struct {
	Normal   Vector3[T]
	Constant T
}

func NewPlane

func NewPlane[T constraints.Float](normal Vector3[T], constant T) *Plane[T]

func (*Plane[T]) ApplyMatrix4

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

func (*Plane[T]) Clone

func (p *Plane[T]) Clone() *Plane[T]

func (*Plane[T]) CoplanarPoint

func (p *Plane[T]) CoplanarPoint() *Vector3[T]

func (*Plane[T]) Copy

func (p *Plane[T]) Copy(plane Plane[T]) *Plane[T]

func (*Plane[T]) DistanceToPoint

func (p *Plane[T]) DistanceToPoint(point Vector3[T]) T

func (*Plane[T]) DistanceToSphere

func (p *Plane[T]) DistanceToSphere(sphere Sphere[T]) T

func (*Plane[T]) Equals

func (p *Plane[T]) Equals(plane Plane[T]) bool

func (*Plane[T]) IntersectLine

func (p *Plane[T]) IntersectLine(line Line3[T]) *Vector3[T]

func (*Plane[T]) IntersectsBox

func (p *Plane[T]) IntersectsBox(box Box3[T]) bool

func (*Plane[T]) IntersectsLine

func (p *Plane[T]) IntersectsLine(line Line3[T]) bool

func (*Plane[T]) IntersectsSphere

func (p *Plane[T]) IntersectsSphere(sphere Sphere[T]) bool

func (*Plane[T]) Negate

func (p *Plane[T]) Negate() *Plane[T]

func (*Plane[T]) Normalize

func (p *Plane[T]) Normalize() *Plane[T]

func (*Plane[T]) ProjectPoint

func (p *Plane[T]) ProjectPoint(point Vector3[T]) *Vector3[T]

func (*Plane[T]) Set

func (p *Plane[T]) Set(normal Vector3[T], constant T) *Plane[T]

func (*Plane[T]) SetComponents

func (p *Plane[T]) SetComponents(x, y, z, w T) *Plane[T]

func (*Plane[T]) SetFromCoplanarPoints

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

func (*Plane[T]) SetFromNormalAndCoplanarPoint

func (p *Plane[T]) SetFromNormalAndCoplanarPoint(normal, point Vector3[T]) *Plane[T]

func (*Plane[T]) Translate

func (p *Plane[T]) Translate(offset Vector3[T]) *Plane[T]

type Quaternion

type Quaternion[T constraints.Float] struct {
	X, Y, Z, W T
}

func MultiplyQuaternions

func MultiplyQuaternions[T constraints.Float](a, b Quaternion[T]) *Quaternion[T]

func NewIdentityQuaternion

func NewIdentityQuaternion[T constraints.Float]() *Quaternion[T]

func NewQuaternion

func NewQuaternion[T constraints.Float](x, y, z, w T) *Quaternion[T]

func (*Quaternion[T]) AngleTo

func (q *Quaternion[T]) AngleTo(qb Quaternion[T]) T

func (*Quaternion[T]) Clone

func (q *Quaternion[T]) Clone() *Quaternion[T]

func (*Quaternion[T]) Conjugate

func (q *Quaternion[T]) Conjugate() *Quaternion[T]

func (*Quaternion[T]) Copy

func (q *Quaternion[T]) Copy(quaternion Quaternion[T]) *Quaternion[T]

func (*Quaternion[T]) Dot

func (q *Quaternion[T]) Dot(v Quaternion[T]) T

func (*Quaternion[T]) Equals

func (q *Quaternion[T]) Equals(quaternion Quaternion[T]) bool

func (*Quaternion[T]) FromArray

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

func (*Quaternion[T]) Identity

func (q *Quaternion[T]) Identity() *Quaternion[T]

func (*Quaternion[T]) Invert

func (q *Quaternion[T]) Invert() *Quaternion[T]

func (*Quaternion[T]) Length

func (q *Quaternion[T]) Length() T

func (*Quaternion[T]) LengthSq

func (q *Quaternion[T]) LengthSq() T

func (*Quaternion[T]) Multiply

func (q *Quaternion[T]) Multiply(qb Quaternion[T]) *Quaternion[T]

func (*Quaternion[T]) MultiplyQuaternionsFlat

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

func (*Quaternion[T]) Normalize

func (q *Quaternion[T]) Normalize() *Quaternion[T]

func (*Quaternion[T]) Premultiply

func (q *Quaternion[T]) Premultiply(qb Quaternion[T]) *Quaternion[T]

func (*Quaternion[T]) RotateTowards

func (q *Quaternion[T]) RotateTowards(qb Quaternion[T], step T) *Quaternion[T]

func (*Quaternion[T]) Set

func (q *Quaternion[T]) Set(x, y, z, w T) *Quaternion[T]

func (*Quaternion[T]) SetFromAxisAngle

func (q *Quaternion[T]) SetFromAxisAngle(axis Vector3[T], angle T) *Quaternion[T]

func (*Quaternion[T]) SetFromEuler

func (q *Quaternion[T]) SetFromEuler(euler Euler[T]) *Quaternion[T]

func (*Quaternion[T]) SetFromRotationMatrix

func (q *Quaternion[T]) SetFromRotationMatrix(m Matrix4[T]) *Quaternion[T]

func (*Quaternion[T]) SetFromUnitVectors

func (q *Quaternion[T]) SetFromUnitVectors(vFrom, vTo Vector3[T]) *Quaternion[T]

func (*Quaternion[T]) Slerp

func (q *Quaternion[T]) Slerp(qb Quaternion[T], t T) *Quaternion[T]

func (*Quaternion[T]) SlerpFlat

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

func (*Quaternion[T]) ToArray

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

type Ray

type Ray[T constraints.Float] struct {
	Origin, Dir Vector3[T]
}

func NewRay

func NewRay[T constraints.Float](origin, dir Vector3[T]) *Ray[T]

func (*Ray[T]) ApplyMatrix4

func (r *Ray[T]) ApplyMatrix4(matrix4 Matrix4[T]) *Ray[T]

func (*Ray[T]) At

func (r *Ray[T]) At(t T) *Vector3[T]

func (*Ray[T]) Clone

func (r *Ray[T]) Clone() *Ray[T]

func (*Ray[T]) ClosestPointToPoint

func (r *Ray[T]) ClosestPointToPoint(point Vector3[T]) *Vector3[T]

func (*Ray[T]) Copy

func (r *Ray[T]) Copy(ray *Ray[T]) *Ray[T]

func (*Ray[T]) DistanceSqToPoint

func (r *Ray[T]) DistanceSqToPoint(point Vector3[T]) T

func (*Ray[T]) DistanceSqToSegment

func (r *Ray[T]) DistanceSqToSegment(v0, v1 Vector3[T], optionalPointOnRay, optionalPointOnSegment *Vector3[T]) T

func (*Ray[T]) DistanceToPlane

func (r *Ray[T]) DistanceToPlane(plane *Plane[T]) T

func (*Ray[T]) DistanceToPoint

func (r *Ray[T]) DistanceToPoint(point Vector3[T]) T

func (*Ray[T]) Equals

func (r *Ray[T]) Equals(ray Ray[T]) bool

func (*Ray[T]) IntersectBox

func (r *Ray[T]) IntersectBox(box *Box3[T]) *Vector3[T]

func (*Ray[T]) IntersectPlane

func (r *Ray[T]) IntersectPlane(plane *Plane[T]) *Vector3[T]

func (*Ray[T]) IntersectSphere

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

func (*Ray[T]) IntersectTriangle

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

func (*Ray[T]) IntersectsBox

func (r *Ray[T]) IntersectsBox(box *Box3[T]) bool

func (*Ray[T]) IntersectsPlane

func (r *Ray[T]) IntersectsPlane(plane *Plane[T]) bool

func (*Ray[T]) IntersectsSphere

func (r *Ray[T]) IntersectsSphere(sphere *Sphere[T]) bool

func (*Ray[T]) LookAt

func (r *Ray[T]) LookAt(v *Vector3[T]) *Ray[T]

func (*Ray[T]) Recast

func (r *Ray[T]) Recast(t T) *Ray[T]

func (*Ray[T]) Set

func (r *Ray[T]) Set(origin, dir Vector3[T]) *Ray[T]

type Sphere

type Sphere[T constraints.Float] struct {
	Center Vector3[T]
	Radius T
}

func NewSphere

func NewSphere[T constraints.Float](center Vector3[T], radius T) *Sphere[T]

func (*Sphere[T]) ApplyMatrix4

func (s *Sphere[T]) ApplyMatrix4(matrix Matrix4[T]) *Sphere[T]

func (*Sphere[T]) BoundingBox

func (s *Sphere[T]) BoundingBox() *Box3[T]

func (*Sphere[T]) ClampPoint

func (s *Sphere[T]) ClampPoint(point Vector3[T]) *Vector3[T]

func (*Sphere[T]) Clone

func (s *Sphere[T]) Clone() *Sphere[T]

func (*Sphere[T]) ContainsPoint

func (s *Sphere[T]) ContainsPoint(point Vector3[T]) bool

func (*Sphere[T]) Copy

func (s *Sphere[T]) Copy(sphere Sphere[T]) *Sphere[T]

func (*Sphere[T]) DistanceToPoint

func (s *Sphere[T]) DistanceToPoint(point Vector3[T]) T

func (*Sphere[T]) Equals

func (s *Sphere[T]) Equals(sphere Sphere[T]) bool

func (*Sphere[T]) ExpandByPoint

func (s *Sphere[T]) ExpandByPoint(point Vector3[T]) *Sphere[T]

func (*Sphere[T]) IntersectsBox

func (s *Sphere[T]) IntersectsBox(box Box3[T]) bool

func (*Sphere[T]) IntersectsPlane

func (s *Sphere[T]) IntersectsPlane(plane Plane[T]) bool

func (*Sphere[T]) IntersectsSphere

func (s *Sphere[T]) IntersectsSphere(sphere Sphere[T]) bool

func (*Sphere[T]) IsEmpty

func (s *Sphere[T]) IsEmpty() bool

func (*Sphere[T]) MakeEmpty

func (s *Sphere[T]) MakeEmpty() *Sphere[T]

func (*Sphere[T]) Set

func (s *Sphere[T]) Set(center Vector3[T], radius T) *Sphere[T]

func (*Sphere[T]) SetFromPoints

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

func (*Sphere[T]) Translate

func (s *Sphere[T]) Translate(offset Vector3[T]) *Sphere[T]

func (*Sphere[T]) Union

func (s *Sphere[T]) Union(sphere Sphere[T]) *Sphere[T]

type Spherical

type Spherical[T constraints.Float] struct {
	Radius, Phi, Theta T
}

func NewSpherical

func NewSpherical[T constraints.Float](radius, phi, theta T) *Spherical[T]

func (*Spherical[T]) Clone

func (s *Spherical[T]) Clone() *Spherical[T]

func (*Spherical[T]) Copy

func (s *Spherical[T]) Copy(other *Spherical[T]) *Spherical[T]

func (*Spherical[T]) MakeSafe

func (s *Spherical[T]) MakeSafe() *Spherical[T]

func (*Spherical[T]) Set

func (s *Spherical[T]) Set(radius, phi, theta T) *Spherical[T]

func (*Spherical[T]) SetFromCartesianCoords

func (s *Spherical[T]) SetFromCartesianCoords(x, y, z T) *Spherical[T]

func (*Spherical[T]) SetFromVector3

func (s *Spherical[T]) SetFromVector3(v *Vector3[T]) *Spherical[T]

type SphericalHarmonics3

type SphericalHarmonics3[T constraints.Float] [9]Vector3[T]

func NewSphericalHarmonics3

func NewSphericalHarmonics3[T constraints.Float]() *SphericalHarmonics3[T]

func (*SphericalHarmonics3[T]) Add

func (*SphericalHarmonics3[T]) AddScaledSH

func (sh *SphericalHarmonics3[T]) AddScaledSH(sh2 SphericalHarmonics3[T], s T) *SphericalHarmonics3[T]

func (*SphericalHarmonics3[T]) BasisAt

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

GetBasisAt evaluates the basis functions

func (*SphericalHarmonics3[T]) Clone

func (sh *SphericalHarmonics3[T]) Clone() *SphericalHarmonics3[T]

func (*SphericalHarmonics3[T]) Copy

func (*SphericalHarmonics3[T]) Equals

func (sh *SphericalHarmonics3[T]) Equals(sh2 SphericalHarmonics3[T]) bool

func (*SphericalHarmonics3[T]) FromArray

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

func (*SphericalHarmonics3[T]) GetAt

func (sh *SphericalHarmonics3[T]) GetAt(normal *Vector3[T]) *Vector3[T]

GetAt returns the radiance in the direction of the normal

func (*SphericalHarmonics3[T]) GetIrradianceAt

func (sh *SphericalHarmonics3[T]) GetIrradianceAt(normal Vector3[T]) *Vector3[T]

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

func (*SphericalHarmonics3[T]) Lerp

func (sh *SphericalHarmonics3[T]) Lerp(sh2 SphericalHarmonics3[T], alpha T) *SphericalHarmonics3[T]

func (*SphericalHarmonics3[T]) Scale

func (sh *SphericalHarmonics3[T]) Scale(s T) *SphericalHarmonics3[T]

func (*SphericalHarmonics3[T]) Set

func (sh *SphericalHarmonics3[T]) Set(coefficients ...Vector3[T]) *SphericalHarmonics3[T]

func (*SphericalHarmonics3[T]) ToArray

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

func (*SphericalHarmonics3[T]) Zero

func (sh *SphericalHarmonics3[T]) Zero() *SphericalHarmonics3[T]

type SplineCurve

type SplineCurve[T constraints.Float] struct {
	// contains filtered or unexported fields
}

func NewSplineCurve

func NewSplineCurve[T constraints.Float](points ...Vector3[T]) *SplineCurve[T]

func (*SplineCurve) Clone

func (c *SplineCurve) Clone() *baseCurve[T]

func (*SplineCurve) ComputeFrenetFrames added in v0.0.6

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

func (*SplineCurve) Copy

func (c *SplineCurve) Copy(source baseCurve[T]) *baseCurve[T]

func (*SplineCurve[T]) Length

func (c *SplineCurve[T]) Length() T

func (*SplineCurve[T]) Lengths

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

func (*SplineCurve[T]) LengthsDefault

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

func (*SplineCurve[T]) Point

func (c *SplineCurve[T]) Point(t T) *Vector3[T]

func (*SplineCurve[T]) PointAt

func (c *SplineCurve[T]) PointAt(u T) *Vector3[T]

func (*SplineCurve[T]) Points

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

func (*SplineCurve[T]) SpacedPoints

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

func (*SplineCurve) Tangent added in v0.0.6

func (c *SplineCurve) Tangent(t T) *Vector3[T]

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 T) *Vector3[T]

func (*SplineCurve[T]) UpdateArcLengths

func (c *SplineCurve[T]) UpdateArcLengths()

type Triangle

type Triangle[T constraints.Float] struct {
	A, B, C Vector3[T]
}

func NewTriangle

func NewTriangle[T constraints.Float](a, b, c Vector3[T]) Triangle[T]

func (*Triangle[T]) Area

func (t *Triangle[T]) Area() T

func (*Triangle[T]) Barycoord

func (t *Triangle[T]) Barycoord(point Vector3[T]) *Vector3[T]

func (*Triangle[T]) Clone

func (t *Triangle[T]) Clone() Triangle[T]

func (*Triangle[T]) ClosestPointToPoint

func (t *Triangle[T]) ClosestPointToPoint(p Vector3[T]) *Vector3[T]

func (*Triangle[T]) ContainsPoint

func (t *Triangle[T]) ContainsPoint(point Vector3[T]) bool

func (*Triangle[T]) Copy

func (t *Triangle[T]) Copy(triangle Triangle[T]) *Triangle[T]

func (*Triangle[T]) Equals

func (t *Triangle[T]) Equals(triangle Triangle[T]) bool

func (*Triangle[T]) Interpolation

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

func (*Triangle[T]) IsFrontFacing

func (t *Triangle[T]) IsFrontFacing(direction Vector3[T]) bool

func (*Triangle[T]) Midpoint

func (t *Triangle[T]) Midpoint() *Vector3[T]

func (*Triangle[T]) Normal

func (t *Triangle[T]) Normal() *Vector3[T]

func (*Triangle[T]) Plane

func (t *Triangle[T]) Plane() *Plane[T]

func (*Triangle[T]) Set

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

func (*Triangle[T]) SetFromPointsAndIndices

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

type Vector2

type Vector2[T constraints.Float] struct {
	X T
	Y T
}

func AddScaledVector2

func AddScaledVector2[T constraints.Float](vector Vector2[T], scalar T) *Vector2[T]

func AddVector2s

func AddVector2s[T constraints.Float](a, b Vector2[T]) *Vector2[T]

func LerpVectors

func LerpVectors[T constraints.Float](v1, v2 Vector2[T], alpha T) *Vector2[T]

func NewOneVector2

func NewOneVector2[T constraints.Float]() *Vector2[T]

func NewVector2

func NewVector2[T constraints.Float](x, y T) *Vector2[T]

func NewZeroVector2

func NewZeroVector2[T constraints.Float]() *Vector2[T]

func SubVector2s

func SubVector2s[T constraints.Float](a, b Vector2[T]) *Vector2[T]

func (*Vector2[T]) Add

func (v *Vector2[T]) Add(vector Vector2[T]) *Vector2[T]

func (*Vector2[T]) AddScalar

func (v *Vector2[T]) AddScalar(scalar T) *Vector2[T]

func (*Vector2[T]) Angle

func (v *Vector2[T]) Angle() T

func (*Vector2[T]) AngleTo

func (v *Vector2[T]) AngleTo(vector Vector2[T]) T

func (*Vector2[T]) ApplyMatrix3

func (v *Vector2[T]) ApplyMatrix3(m Matrix3[T]) *Vector2[T]

func (*Vector2[T]) Ceil

func (v *Vector2[T]) Ceil() *Vector2[T]

func (*Vector2[T]) Clamp

func (v *Vector2[T]) Clamp(minVal, maxVal Vector2[T]) *Vector2[T]

func (*Vector2[T]) ClampLength

func (v *Vector2[T]) ClampLength(minVal, maxVal T) *Vector2[T]

func (*Vector2[T]) ClampScalar

func (v *Vector2[T]) ClampScalar(minVal, maxVal T) *Vector2[T]

func (*Vector2[T]) Clone

func (v *Vector2[T]) Clone() *Vector2[T]

func (*Vector2[T]) Component

func (v *Vector2[T]) Component(index int) T

func (*Vector2[T]) Copy

func (v *Vector2[T]) Copy(vector Vector2[T]) *Vector2[T]

func (*Vector2[T]) Cross

func (v *Vector2[T]) Cross(vector Vector2[T]) T

func (*Vector2[T]) DistanceTo

func (v *Vector2[T]) DistanceTo(vector Vector2[T]) T

func (*Vector2[T]) DistanceToSquared

func (v *Vector2[T]) DistanceToSquared(vector Vector2[T]) T

func (*Vector2[T]) Divide

func (v *Vector2[T]) Divide(vector Vector2[T]) *Vector2[T]

func (*Vector2[T]) DivideScalar

func (v *Vector2[T]) DivideScalar(scalar T) *Vector2[T]

func (*Vector2[T]) Dot

func (v *Vector2[T]) Dot(vector Vector2[T]) T

func (*Vector2[T]) Equals

func (v *Vector2[T]) Equals(vector Vector2[T]) bool

func (*Vector2[T]) Floor

func (v *Vector2[T]) Floor() *Vector2[T]

func (*Vector2[T]) FromArray

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

func (*Vector2[T]) Height

func (v *Vector2[T]) Height() T

func (*Vector2[T]) Length

func (v *Vector2[T]) Length() T

func (*Vector2[T]) LengthSq

func (v *Vector2[T]) LengthSq() T

func (*Vector2[T]) Lerp

func (v *Vector2[T]) Lerp(vector Vector2[T], alpha T) *Vector2[T]

func (*Vector2[T]) ManhattanDistanceTo

func (v *Vector2[T]) ManhattanDistanceTo(vector Vector2[T]) T

func (*Vector2[T]) ManhattanLength

func (v *Vector2[T]) ManhattanLength() T

func (*Vector2[T]) Max

func (v *Vector2[T]) Max(vector Vector2[T]) *Vector2[T]

func (*Vector2[T]) Min

func (v *Vector2[T]) Min(vector Vector2[T]) *Vector2[T]

func (*Vector2[T]) Multiply

func (v *Vector2[T]) Multiply(vector Vector2[T]) *Vector2[T]

func (*Vector2[T]) MultiplyScalar

func (v *Vector2[T]) MultiplyScalar(scalar T) *Vector2[T]

func (*Vector2[T]) Negate

func (v *Vector2[T]) Negate() *Vector2[T]

func (*Vector2[T]) Normalize

func (v *Vector2[T]) Normalize() *Vector2[T]

func (*Vector2[T]) Random

func (v *Vector2[T]) Random() *Vector2[T]

func (*Vector2[T]) RotateAround

func (v *Vector2[T]) RotateAround(center Vector2[T], angle T) *Vector2[T]

func (*Vector2[T]) Round

func (v *Vector2[T]) Round() *Vector2[T]

func (*Vector2[T]) RoundToZero

func (v *Vector2[T]) RoundToZero() *Vector2[T]

func (*Vector2[T]) Set

func (v *Vector2[T]) Set(x, y T) *Vector2[T]

func (*Vector2[T]) SetComponent

func (v *Vector2[T]) SetComponent(index int, value T) *Vector2[T]

func (*Vector2[T]) SetHeight

func (v *Vector2[T]) SetHeight(value T) *Vector2[T]

func (*Vector2[T]) SetLength

func (v *Vector2[T]) SetLength(length T) *Vector2[T]

func (*Vector2[T]) SetScalar

func (v *Vector2[T]) SetScalar(scalar T) *Vector2[T]

func (*Vector2[T]) SetWidth

func (v *Vector2[T]) SetWidth(value T) *Vector2[T]

func (*Vector2[T]) SetX

func (v *Vector2[T]) SetX(x T) *Vector2[T]

func (*Vector2[T]) SetY

func (v *Vector2[T]) SetY(y T) *Vector2[T]

func (*Vector2[T]) Sub

func (v *Vector2[T]) Sub(vector Vector2[T]) *Vector2[T]

func (*Vector2[T]) SubScalar

func (v *Vector2[T]) SubScalar(scalar T) *Vector2[T]

func (*Vector2[T]) ToArray

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

func (*Vector2[T]) Width

func (v *Vector2[T]) Width() T

type Vector3

type Vector3[T constraints.Float] struct {
	X, Y, Z T
}

func AddVector3s

func AddVector3s[T constraints.Float](a, b Vector3[T]) *Vector3[T]

func CrossVector3s

func CrossVector3s[T constraints.Float](a, b Vector3[T]) *Vector3[T]

func LerpVector3s

func LerpVector3s[T constraints.Float](v1, v2 Vector3[T], alpha T) *Vector3[T]

func MultiplyVector3s

func MultiplyVector3s[T constraints.Float](a, b Vector3[T]) *Vector3[T]

func NewOneVector3

func NewOneVector3[T constraints.Float]() *Vector3[T]

func NewVector3

func NewVector3[T constraints.Float](x, y, z T) *Vector3[T]

func NewZeroVector3

func NewZeroVector3[T constraints.Float]() *Vector3[T]

func SubVector3s

func SubVector3s[T constraints.Float](a, b Vector3[T]) *Vector3[T]

func (*Vector3[T]) Add

func (v *Vector3[T]) Add(v2 Vector3[T]) *Vector3[T]

func (*Vector3[T]) AddScalar

func (v *Vector3[T]) AddScalar(scalar T) *Vector3[T]

func (*Vector3[T]) AddScaledVector

func (v *Vector3[T]) AddScaledVector(vector Vector3[T], scalar T) *Vector3[T]

func (*Vector3[T]) AngleTo

func (v *Vector3[T]) AngleTo(v2 Vector3[T]) T

func (*Vector3[T]) ApplyAxisAngle

func (v *Vector3[T]) ApplyAxisAngle(axis Vector3[T], angle T) *Vector3[T]

func (*Vector3[T]) ApplyEuler

func (v *Vector3[T]) ApplyEuler(e Euler[T]) *Vector3[T]

func (*Vector3[T]) ApplyMatrix3

func (v *Vector3[T]) ApplyMatrix3(m Matrix3[T]) *Vector3[T]

func (*Vector3[T]) ApplyMatrix4

func (v *Vector3[T]) ApplyMatrix4(m Matrix4[T]) *Vector3[T]

func (*Vector3[T]) ApplyNormalMatrix

func (v *Vector3[T]) ApplyNormalMatrix(m Matrix3[T]) *Vector3[T]

func (*Vector3[T]) ApplyQuaternion

func (v *Vector3[T]) ApplyQuaternion(q Quaternion[T]) *Vector3[T]

func (*Vector3[T]) Ceil

func (v *Vector3[T]) Ceil() *Vector3[T]

func (*Vector3[T]) Clamp

func (v *Vector3[T]) Clamp(minVal, maxVal Vector3[T]) *Vector3[T]

func (*Vector3[T]) ClampLength

func (v *Vector3[T]) ClampLength(minVal, maxVal T) *Vector3[T]

func (*Vector3[T]) ClampScalar

func (v *Vector3[T]) ClampScalar(minVal, maxVal T) *Vector3[T]

func (*Vector3[T]) Clone

func (v *Vector3[T]) Clone() *Vector3[T]

func (*Vector3[T]) Component

func (v *Vector3[T]) Component(index int) T

func (*Vector3[T]) Copy

func (v *Vector3[T]) Copy(vector Vector3[T]) *Vector3[T]

func (*Vector3[T]) Cross

func (v *Vector3[T]) Cross(v2 Vector3[T]) *Vector3[T]

func (*Vector3[T]) DistanceTo

func (v *Vector3[T]) DistanceTo(v2 Vector3[T]) T

func (*Vector3[T]) DistanceToSquared

func (v *Vector3[T]) DistanceToSquared(v2 Vector3[T]) T

func (*Vector3[T]) Divide

func (v *Vector3[T]) Divide(v2 Vector3[T]) *Vector3[T]

func (*Vector3[T]) DivideScalar

func (v *Vector3[T]) DivideScalar(scalar T) *Vector3[T]

func (*Vector3[T]) Dot

func (v *Vector3[T]) Dot(v2 Vector3[T]) T

func (*Vector3[T]) Equals

func (v *Vector3[T]) Equals(v2 Vector3[T]) bool

func (*Vector3[T]) Floor

func (v *Vector3[T]) Floor() *Vector3[T]

func (*Vector3[T]) FromArray

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

func (*Vector3[T]) Length

func (v *Vector3[T]) Length() T

func (*Vector3[T]) LengthSq

func (v *Vector3[T]) LengthSq() T

func (*Vector3[T]) Lerp

func (v *Vector3[T]) Lerp(v2 Vector3[T], alpha T) *Vector3[T]

func (*Vector3[T]) ManhattanDistanceTo

func (v *Vector3[T]) ManhattanDistanceTo(v2 Vector3[T]) T

func (*Vector3[T]) Max

func (v *Vector3[T]) Max(v2 Vector3[T]) *Vector3[T]

func (*Vector3[T]) Min

func (v *Vector3[T]) Min(v2 Vector3[T]) *Vector3[T]

func (*Vector3[T]) Multiply

func (v *Vector3[T]) Multiply(v2 Vector3[T]) *Vector3[T]

func (*Vector3[T]) MultiplyScalar

func (v *Vector3[T]) MultiplyScalar(scalar T) *Vector3[T]

func (*Vector3[T]) Negate

func (v *Vector3[T]) Negate() *Vector3[T]

func (*Vector3[T]) Normalize

func (v *Vector3[T]) Normalize() *Vector3[T]

func (*Vector3[T]) ProjectOnPlane

func (v *Vector3[T]) ProjectOnPlane(planeNormal Vector3[T]) *Vector3[T]

func (*Vector3[T]) ProjectOnVector

func (v *Vector3[T]) ProjectOnVector(v2 Vector3[T]) *Vector3[T]

func (*Vector3[T]) Random

func (v *Vector3[T]) Random() *Vector3[T]

func (*Vector3[T]) RandomDirection

func (v *Vector3[T]) RandomDirection() *Vector3[T]

func (*Vector3[T]) Reflect

func (v *Vector3[T]) Reflect(normal Vector3[T]) *Vector3[T]

func (*Vector3[T]) Round

func (v *Vector3[T]) Round() *Vector3[T]

func (*Vector3[T]) RoundToZero

func (v *Vector3[T]) RoundToZero() *Vector3[T]

func (*Vector3[T]) Set

func (v *Vector3[T]) Set(x, y, z T) *Vector3[T]

func (*Vector3[T]) SetComponent

func (v *Vector3[T]) SetComponent(index int, value T) *Vector3[T]

func (*Vector3[T]) SetFromCylindrical

func (v *Vector3[T]) SetFromCylindrical(c Cylindrical[T]) *Vector3[T]

func (*Vector3[T]) SetFromCylindricalCoords

func (v *Vector3[T]) SetFromCylindricalCoords(radius, theta, y T) *Vector3[T]

func (*Vector3[T]) SetFromMatrixColumn

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

func (*Vector3[T]) SetFromMatrixPosition

func (v *Vector3[T]) SetFromMatrixPosition(m Matrix4[T]) *Vector3[T]

func (*Vector3[T]) SetFromMatrixScale

func (v *Vector3[T]) SetFromMatrixScale(m Matrix4[T]) *Vector3[T]

func (*Vector3[T]) SetFromSpherical

func (v *Vector3[T]) SetFromSpherical(s Spherical[T]) *Vector3[T]

func (*Vector3[T]) SetFromSphericalCoords

func (v *Vector3[T]) SetFromSphericalCoords(radius, phi, theta T) *Vector3[T]

func (*Vector3[T]) SetLength

func (v *Vector3[T]) SetLength(length T) *Vector3[T]

func (*Vector3[T]) SetScalar

func (v *Vector3[T]) SetScalar(scalar T) *Vector3[T]

func (*Vector3[T]) Sub

func (v *Vector3[T]) Sub(v2 Vector3[T]) *Vector3[T]

func (*Vector3[T]) SubScalar

func (v *Vector3[T]) SubScalar(scalar T) *Vector3[T]

func (*Vector3[T]) ToArray

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

func (*Vector3[T]) TransformDirection

func (v *Vector3[T]) TransformDirection(m Matrix4[T]) *Vector3[T]

Jump to

Keyboard shortcuts

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