vpvec3

package
v0.0.0-...-bf055c7 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package vpvec3 contains 3 members vector utilities.

Index

Constants

View Source
const (
	// X is the index of the x coordinate within a vector.
	X = iota
	// Y is the index of the y coordinate within a vector.
	Y
	// Z is the index of the z coordinate within a vector.
	Z
	// Size is the number of elements in a vector.
	Size
)
View Source
const PackageCopyright = "Copyright (C)  2015, 2016  Christian Mauduit <ufoot@ufoot.org>" // PackageCopyright set by version.sh

PackageCopyright contains a short copyright notice.

View Source
const PackageEmail = "ufoot@ufoot.org" // PackageEmail set by version.sh

PackageEmail contains a contact email for the package.

View Source
const PackageLicense = "GNU GPL v3" // PackageLicense set by version.sh

PackageLicense contains a short license information.

View Source
const PackageName = "Vapor Toolkit" // PackageName set by version.sh

PackageName contains a readable name of the package, suitable for display.

View Source
const PackageTarname = "vapor" // PackageTarname set by version.sh

PackageTarname contains a short name of the package, suitable for a filename.

View Source
const PackageURL = "https://github.com/ufoot/vapor" // PackageURL set by version.sh

PackageURL contains the address of the project homepage.

View Source
const VersionMajor = 0 // VersionMajor set by version.sh

VersionMajor is the project major version.

View Source
const VersionMinor = 3 // VersionMinor set by version.sh

VersionMinor is the project minor version.

View Source
const VersionStamp = "c6a4298" // VersionStamp set by version.sh

VersionStamp is the project stamp, possibly changes for each build.

Variables

This section is empty.

Functions

This section is empty.

Types

type F32

type F32 [Size]float32

F32 is a vector containing 3 float32 values. Can hold the values of a point in space.

func F32Add

func F32Add(veca, vecb *F32) *F32

F32Add adds two vectors. Args are left untouched, a pointer on a new object is returned.

func F32AxisX

func F32AxisX() *F32

F32AxisX returns a new vector representing the X axis.

func F32AxisY

func F32AxisY() *F32

F32AxisY returns a new vector representing the Y axis.

func F32AxisZ

func F32AxisZ() *F32

F32AxisZ returns a new vector representing the Z axis.

func F32Cross

func F32Cross(veca, vecb *F32) *F32

F32Cross returns the the cross product of two vectors. Args are left untouched, a pointer on a new object is returned.

func F32DivScale

func F32DivScale(vec *F32, factor float32) *F32

F32DivScale divides all values of a vector by a scalar. Args are left untouched, a pointer on a new object is returned.

func F32FromVec2

func F32FromVec2(vec *vpvec2.F32, f float32) *F32

F32FromVec2 creates a new vector from a smaller one, by appending a value at its end.

func F32Homogeneous

func F32Homogeneous(vec *F32) *F32

F32Homogeneous scales the vector so that its latest member is 1. This what we want to do when projecting, to have homegemous coords. Arg is left untouched, a pointer on a new object is returned.

func F32Lerp

func F32Lerp(veca, vecb *F32, beta float32) *F32

F32Lerp performs a linear interpolation between 2 vectors.

func F32Max

func F32Max(veca *F32, vecb *F32) *F32

F32Max returns the mininum (member-wise) of two vectors. Args are left untouched, a pointer on a new object is returned.

func F32Min

func F32Min(veca *F32, vecb *F32) *F32

F32Min returns the mininum (member-wise) of two vectors. Args are left untouched, a pointer on a new object is returned.

func F32MulScale

func F32MulScale(vec *F32, factor float32) *F32

F32MulScale multiplies all values of a vector by a scalar. Args are left untouched, a pointer on a new object is returned.

func F32Neg

func F32Neg(vec *F32) *F32

F32Neg changes the sign of all vector members. Arg is left untouched, a pointer on a new object is returned.

func F32New

func F32New(f1, f2, f3 float32) *F32

F32New creates a new vector containing 3 float32 values.

func F32Normalize

func F32Normalize(vec *F32) *F32

F32Normalize scales a vector so that its length is 1. Arg is left untouched, a pointer on a new object is returned.

func F32Sub

func F32Sub(veca, vecb *F32) *F32

F32Sub substracts vector b from vector a. Args are left untouched, a pointer on a new object is returned.

func (*F32) Add

func (vec *F32) Add(op *F32) *F32

Add adds operand to the vector. It modifies the vector, and returns a pointer on it.

func (*F32) Cross

func (vec *F32) Cross(op *F32) *F32

Cross returns the the cross product of two vectors. It modifies the vector, and returns a pointer on it.

func (*F32) DivScale

func (vec *F32) DivScale(factor float32) *F32

DivScale divides all values of the vector by factor. It modifies the vector, and returns a pointer on it.

func (*F32) Dot

func (vec *F32) Dot(op *F32) float32

Dot returns the the dot product of two vectors.

func (*F32) Homogeneous

func (vec *F32) Homogeneous() *F32

Homogeneous scales the vector so that its latest member is 1. This what we want to do when projecting, to have homegemous coords. It modifies the vector, and returns a pointer on it.

func (*F32) IsSimilar

func (vec *F32) IsSimilar(op *F32) bool

IsSimilar returns true if vectors are approximatively the same. This is a workarround to ignore rounding errors.

func (*F32) Length

func (vec *F32) Length() float32

Length returns the length of the vector.

func (*F32) Lerp

func (vec *F32) Lerp(op *F32, beta float32) *F32

Lerp performs a linear interpolation with another vector.

func (*F32) Max

func (vec *F32) Max(op *F32) *F32

Max returns the maximum of all vector members. It modifies the vector, and returns a pointer on it.

func (*F32) Min

func (vec *F32) Min(op *F32) *F32

Min returns the minimum of all vector members. It modifies the vector, and returns a pointer on it.

func (*F32) MulScale

func (vec *F32) MulScale(factor float32) *F32

MulScale multiplies all values of the vector by factor. It modifies the vector, and returns a pointer on it.

func (*F32) Neg

func (vec *F32) Neg() *F32

Neg changes the sign of all vector members. It modifies the vector, and returns a pointer on it.

func (*F32) Normalize

func (vec *F32) Normalize() *F32

Normalize scales the vector so that its length is 1. It modifies the vector, and returns a pointer on it.

func (*F32) SqMag

func (vec *F32) SqMag() float32

SqMag returns the sum of the squares of all values. It is used to calculate length, it is faster than the complete length calculation, as it does not perform a square root.

func (*F32) String

func (vec *F32) String() string

String returns a readable form of the vector.

func (*F32) Sub

func (vec *F32) Sub(op *F32) *F32

Sub substracts operand from the vector. It modifies the vector, and returns a pointer on it.

func (*F32) ToF64

func (vec *F32) ToF64() *F64

ToF64 converts the vector to a float64 vector.

func (*F32) ToI32

func (vec *F32) ToI32() *I32

ToI32 converts the vector to an int32 vector.

func (*F32) ToI64

func (vec *F32) ToI64() *I64

ToI64 converts the vector to an int64 vector.

func (*F32) ToVec2

func (vec *F32) ToVec2() *vpvec2.F32

ToVec2 creates a smaller vector by removing the last value.

func (*F32) ToX32

func (vec *F32) ToX32() *X32

ToX32 converts the vector to a fixed point number vector on 32 bits.

func (*F32) ToX64

func (vec *F32) ToX64() *X64

ToX64 converts the vector to a fixed point number vector on 64 bits.

type F32BinaryOperator

type F32BinaryOperator func(a, b *F32) *F32

F32BinaryOperator designs funcs such as Add, Sub, Min, Max, which operates on two vectors and return one.

type F32UnaryOperator

type F32UnaryOperator func(a *F32) *F32

F32UnaryOperator designs funcs such as Neg, which operates on one vector and returns another vector.

type F64

type F64 [Size]float64

F64 is a vector containing 3 float64 values. Can hold the values of a point in space.

func F64Add

func F64Add(veca, vecb *F64) *F64

F64Add adds two vectors. Args are left untouched, a pointer on a new object is returned.

func F64AxisX

func F64AxisX() *F64

F64AxisX returns a new vector representing the X axis.

func F64AxisY

func F64AxisY() *F64

F64AxisY returns a new vector representing the Y axis.

func F64AxisZ

func F64AxisZ() *F64

F64AxisZ returns a new vector representing the Z axis.

func F64Cross

func F64Cross(veca, vecb *F64) *F64

F64Cross returns the the cross product of two vectors. Args are left untouched, a pointer on a new object is returned.

func F64DivScale

func F64DivScale(vec *F64, factor float64) *F64

F64DivScale divides all values of a vector by a scalar. Args are left untouched, a pointer on a new object is returned.

func F64FromVec2

func F64FromVec2(vec *vpvec2.F64, f float64) *F64

F64FromVec2 creates a new vector from a smaller one, by appending a value at its end.

func F64Homogeneous

func F64Homogeneous(vec *F64) *F64

F64Homogeneous scales the vector so that its latest member is 1. This what we want to do when projecting, to have homegemous coords. Arg is left untouched, a pointer on a new object is returned.

func F64Lerp

func F64Lerp(veca, vecb *F64, beta float64) *F64

F64Lerp performs a linear interpolation between 2 vectors.

func F64Max

func F64Max(veca *F64, vecb *F64) *F64

F64Max returns the mininum (member-wise) of two vectors. Args are left untouched, a pointer on a new object is returned.

func F64Min

func F64Min(veca *F64, vecb *F64) *F64

F64Min returns the mininum (member-wise) of two vectors. Args are left untouched, a pointer on a new object is returned.

func F64MulScale

func F64MulScale(vec *F64, factor float64) *F64

F64MulScale multiplies all values of a vector by a scalar. Args are left untouched, a pointer on a new object is returned.

func F64Neg

func F64Neg(vec *F64) *F64

F64Neg changes the sign of all vector members. Arg is left untouched, a pointer on a new object is returned.

func F64New

func F64New(f1, f2, f3 float64) *F64

F64New creates a new vector containing 3 float64 values.

func F64Normalize

func F64Normalize(vec *F64) *F64

F64Normalize scales a vector so that its length is 1. Arg is left untouched, a pointer on a new object is returned.

func F64Sub

func F64Sub(veca, vecb *F64) *F64

F64Sub substracts vector b from vector a. Args are left untouched, a pointer on a new object is returned.

func (*F64) Add

func (vec *F64) Add(op *F64) *F64

Add adds operand to the vector. It modifies the vector, and returns a pointer on it.

func (*F64) Cross

func (vec *F64) Cross(op *F64) *F64

Cross returns the the cross product of two vectors. It modifies the vector, and returns a pointer on it.

func (*F64) DivScale

func (vec *F64) DivScale(factor float64) *F64

DivScale divides all values of the vector by factor. It modifies the vector, and returns a pointer on it.

func (*F64) Dot

func (vec *F64) Dot(op *F64) float64

Dot returns the the dot product of two vectors.

func (*F64) Homogeneous

func (vec *F64) Homogeneous() *F64

Homogeneous scales the vector so that its latest member is 1. This what we want to do when projecting, to have homegemous coords. It modifies the vector, and returns a pointer on it.

func (*F64) IsSimilar

func (vec *F64) IsSimilar(op *F64) bool

IsSimilar returns true if vectors are approximatively the same. This is a workarround to ignore rounding errors.

func (*F64) Length

func (vec *F64) Length() float64

Length returns the length of the vector.

func (*F64) Lerp

func (vec *F64) Lerp(op *F64, beta float64) *F64

Lerp performs a linear interpolation with another vector.

func (*F64) Max

func (vec *F64) Max(op *F64) *F64

Max returns the maximum of all vector members. It modifies the vector, and returns a pointer on it.

func (*F64) Min

func (vec *F64) Min(op *F64) *F64

Min returns the minimum of all vector members. It modifies the vector, and returns a pointer on it.

func (*F64) MulScale

func (vec *F64) MulScale(factor float64) *F64

MulScale multiplies all values of the vector by factor. It modifies the vector, and returns a pointer on it.

func (*F64) Neg

func (vec *F64) Neg() *F64

Neg changes the sign of all vector members. It modifies the vector, and returns a pointer on it.

func (*F64) Normalize

func (vec *F64) Normalize() *F64

Normalize scales the vector so that its length is 1. It modifies the vector, and returns a pointer on it.

func (*F64) SqMag

func (vec *F64) SqMag() float64

SqMag returns the sum of the squares of all values. It is used to calculate length, it is faster than the complete length calculation, as it does not perform a square root.

func (*F64) String

func (vec *F64) String() string

String returns a readable form of the vector.

func (*F64) Sub

func (vec *F64) Sub(op *F64) *F64

Sub substracts operand from the vector. It modifies the vector, and returns a pointer on it.

func (*F64) ToF32

func (vec *F64) ToF32() *F32

ToF32 converts the vector to a float32 vector.

func (*F64) ToI32

func (vec *F64) ToI32() *I32

ToI32 converts the vector to an int32 vector.

func (*F64) ToI64

func (vec *F64) ToI64() *I64

ToI64 converts the vector to an int64 vector.

func (*F64) ToVec2

func (vec *F64) ToVec2() *vpvec2.F64

ToVec2 creates a smaller vector by removing the last value.

func (*F64) ToX32

func (vec *F64) ToX32() *X32

ToX32 converts the vector to a fixed point number vector on 32 bits.

func (*F64) ToX64

func (vec *F64) ToX64() *X64

ToX64 converts the vector to a fixed point number vector on 64 bits.

type F64BinaryOperator

type F64BinaryOperator func(a, b *F64) *F64

F64BinaryOperator designs funcs such as Add, Sub, Min, Max, which operates on two vectors and return one.

type F64UnaryOperator

type F64UnaryOperator func(a *F64) *F64

F64UnaryOperator designs funcs such as Neg, which operates on one vector and returns another vector.

type I32

type I32 [Size]int32

I32 is a vector containing 3 int32 values. Can hold the values of a point in a plane.

func I32Add

func I32Add(veca, vecb *I32) *I32

I32Add adds two vectors. Args are left untouched, a pointer on a new object is returned.

func I32Neg

func I32Neg(vec *I32) *I32

I32Neg changes the sign of all vector members. Arg is left untouched, a pointer on a new object is returned.

func I32New

func I32New(i1, i2, i3 int32) *I32

I32New creates a new vector containing 3 int32 values.

func I32Sub

func I32Sub(veca, vecb *I32) *I32

I32Sub substracts vector b from vector a. Args are left untouched, a pointer on a new object is returned.

func (*I32) Add

func (vec *I32) Add(op *I32) *I32

Add adds operand to the vector. It modifies the vector, and returns a pointer on it.

func (*I32) Neg

func (vec *I32) Neg() *I32

Neg changes the sign of all vector members. It modifies the vector, and returns a pointer on it.

func (*I32) String

func (vec *I32) String() string

String returns a readable form of the vector.

func (*I32) Sub

func (vec *I32) Sub(op *I32) *I32

Sub substracts operand from the vector. It modifies the vector, and returns a pointer on it.

func (*I32) ToF32

func (vec *I32) ToF32() *F32

ToF32 converts the vector to a float32 vector.

func (*I32) ToF64

func (vec *I32) ToF64() *F64

ToF64 converts the vector to a float64 vector.

func (*I32) ToI64

func (vec *I32) ToI64() *I64

ToI64 converts the vector to an int64 vector.

func (*I32) ToX32

func (vec *I32) ToX32() *X32

ToX32 converts the vector to a fixed point number vector on 32 bits.

func (*I32) ToX64

func (vec *I32) ToX64() *X64

ToX64 converts the vector to a fixed point number vector on 64 bits.

type I64

type I64 [Size]int64

I64 is a vector containing 3 int64 values. Can hold the values of a point in a plane.

func I64Add

func I64Add(veca, vecb *I64) *I64

I64Add adds two vectors. Args are left untouched, a pointer on a new object is returned.

func I64Neg

func I64Neg(vec *I64) *I64

I64Neg changes the sign of all vector members. Arg is left untouched, a pointer on a new object is returned.

func I64New

func I64New(i1, i2, i3 int64) *I64

I64New creates a new vector containing 3 int64 values.

func I64Sub

func I64Sub(veca, vecb *I64) *I64

I64Sub substracts vector b from vector a. Args are left untouched, a pointer on a new object is returned.

func (*I64) Add

func (vec *I64) Add(op *I64) *I64

Add adds operand to the vector. It modifies the vector, and returns a pointer on it.

func (*I64) Neg

func (vec *I64) Neg() *I64

Neg changes the sign of all vector members. It modifies the vector, and returns a pointer on it.

func (*I64) String

func (vec *I64) String() string

String returns a readable form of the vector.

func (*I64) Sub

func (vec *I64) Sub(op *I64) *I64

Sub substracts operand from the vector. It modifies the vector, and returns a pointer on it.

func (*I64) ToF32

func (vec *I64) ToF32() *F32

ToF32 converts the vector to a float32 vector.

func (*I64) ToF64

func (vec *I64) ToF64() *F64

ToF64 converts the vector to a float64 vector.

func (*I64) ToI32

func (vec *I64) ToI32() *I32

ToI32 converts the vector to an int32 vector.

func (*I64) ToX32

func (vec *I64) ToX32() *X32

ToX32 converts the vector to a fixed point number vector on 32 bits.

func (*I64) ToX64

func (vec *I64) ToX64() *X64

ToX64 converts the vector to a fixed point number vector on 64 bits.

type X32

type X32 [Size]vpnumber.X32

X32 is a vector containing 3 fixed point 32 bit values. Can hold the values of a point in space.

func X32Add

func X32Add(veca, vecb *X32) *X32

X32Add adds two vectors. Args are left untouched, a pointer on a new object is returned.

func X32AxisX

func X32AxisX() *X32

X32AxisX returns a new vector representing the X axis.

func X32AxisY

func X32AxisY() *X32

X32AxisY returns a new vector representing the Y axis.

func X32AxisZ

func X32AxisZ() *X32

X32AxisZ returns a new vector representing the Z axis.

func X32Cross

func X32Cross(veca, vecb *X32) *X32

X32Cross returns the the cross product of two vectors. Args are left untouched, a pointer on a new object is returned.

func X32DivScale

func X32DivScale(vec *X32, factor vpnumber.X32) *X32

X32DivScale divides all values of a vector by a scalar. Args are left untouched, a pointer on a new object is returned.

func X32FromVec2

func X32FromVec2(vec *vpvec2.X32, x vpnumber.X32) *X32

X32FromVec2 creates a new vector from a smaller one, by appending a value at its end.

func X32Homogeneous

func X32Homogeneous(vec *X32) *X32

X32Homogeneous scales the vector so that its latest member is 1. This what we want to do when projecting, to have homegemous coords. Arg is left untouched, a pointer on a new object is returned.

func X32Lerp

func X32Lerp(veca, vecb *X32, beta vpnumber.X32) *X32

X32Lerp performs a linear interpolation between 2 vectors.

func X32Max

func X32Max(veca *X32, vecb *X32) *X32

X32Max returns the mininum (member-wise) of two vectors. Args are left untouched, a pointer on a new object is returned.

func X32Min

func X32Min(veca *X32, vecb *X32) *X32

X32Min returns the mininum (member-wise) of two vectors. Args are left untouched, a pointer on a new object is returned.

func X32MulScale

func X32MulScale(vec *X32, factor vpnumber.X32) *X32

X32MulScale multiplies all values of a vector by a scalar. Args are left untouched, a pointer on a new object is returned.

func X32Neg

func X32Neg(vec *X32) *X32

X32Neg changes the sign of all vector members. Arg is left untouched, a pointer on a new object is returned.

func X32New

func X32New(x1, x2, x3 vpnumber.X32) *X32

X32New creates a new vector containing 3 fixed point 32 bit values.

func X32Normalize

func X32Normalize(vec *X32) *X32

X32Normalize scales a vector so that its length is 1. Arg is left untouched, a pointer on a new object is returned.

func X32Sub

func X32Sub(veca, vecb *X32) *X32

X32Sub substracts vector b from vector a. Args are left untouched, a pointer on a new object is returned.

func (*X32) Add

func (vec *X32) Add(op *X32) *X32

Add adds operand to the vector. It modifies the vector, and returns a pointer on it.

func (*X32) Cross

func (vec *X32) Cross(op *X32) *X32

Cross returns the the cross product of two vectors. It modifies the vector, and returns a pointer on it.

func (*X32) DivScale

func (vec *X32) DivScale(factor vpnumber.X32) *X32

DivScale divides all values of the vector by factor. It modifies the vector, and returns a pointer on it.

func (*X32) Dot

func (vec *X32) Dot(op *X32) vpnumber.X32

Dot returns the the dot product of two vectors.

func (*X32) Homogeneous

func (vec *X32) Homogeneous() *X32

Homogeneous scales the vector so that its latest member is 1. This what we want to do when projecting, to have homegemous coords. It modifies the vector, and returns a pointer on it.

func (*X32) IsSimilar

func (vec *X32) IsSimilar(op *X32) bool

IsSimilar returns true if vectors are approximatively the same. This is a workarround to ignore rounding errors.

func (*X32) Length

func (vec *X32) Length() vpnumber.X32

Length returns the length of the vector.

func (*X32) Lerp

func (vec *X32) Lerp(op *X32, beta vpnumber.X32) *X32

Lerp performs a linear interpolation with another vector.

func (*X32) Max

func (vec *X32) Max(op *X32) *X32

Max returns the maximum of all vector members. It modifies the vector, and returns a pointer on it.

func (*X32) Min

func (vec *X32) Min(op *X32) *X32

Min returns the minimum of all vector members. It modifies the vector, and returns a pointer on it.

func (*X32) MulScale

func (vec *X32) MulScale(factor vpnumber.X32) *X32

MulScale multiplies all values of the vector by factor. It modifies the vector, and returns a pointer on it.

func (*X32) Neg

func (vec *X32) Neg() *X32

Neg changes the sign of all vector members. It modifies the vector, and returns a pointer on it.

func (*X32) Normalize

func (vec *X32) Normalize() *X32

Normalize scales the vector so that its length is 1. It modifies the vector, and returns a pointer on it.

func (*X32) SqMag

func (vec *X32) SqMag() vpnumber.X32

SqMag returns the sum of the squares of all values. It is used to calculate length, it is faster than the complete length calculation, as it does not perform a square root.

func (*X32) String

func (vec *X32) String() string

String returns a readable form of the vector.

func (*X32) Sub

func (vec *X32) Sub(op *X32) *X32

Sub substracts operand from the vector. It modifies the vector, and returns a pointer on it.

func (*X32) ToF32

func (vec *X32) ToF32() *F32

ToF32 converts the vector to a float32 vector.

func (*X32) ToF64

func (vec *X32) ToF64() *F64

ToF64 converts the vector to a float64 vector.

func (*X32) ToI32

func (vec *X32) ToI32() *I32

ToI32 converts the vector to an int32 vector.

func (*X32) ToI64

func (vec *X32) ToI64() *I64

ToI64 converts the vector to an int32 vector.

func (*X32) ToVec2

func (vec *X32) ToVec2() *vpvec2.X32

ToVec2 creates a smaller vector by removing the last value.

func (*X32) ToX64

func (vec *X32) ToX64() *X64

ToX64 converts the vector to a fixed point number vector on 64 bits.

type X32BinaryOperator

type X32BinaryOperator func(a, b *X32) *X32

X32BinaryOperator designs funcs such as Add, Sub, Min, Max, which operates on two vectors and return one.

type X32UnaryOperator

type X32UnaryOperator func(a *X32) *X32

X32UnaryOperator designs funcs such as Neg, which operates on one vector and returns another vector.

type X64

type X64 [Size]vpnumber.X64

X64 is a vector containing 3 fixed point 64 bit values. Can hold the values of a point in space.

func X64Add

func X64Add(veca, vecb *X64) *X64

X64Add adds two vectors. Args are left untouched, a pointer on a new object is returned.

func X64AxisX

func X64AxisX() *X64

X64AxisX returns a new vector representing the X axis.

func X64AxisY

func X64AxisY() *X64

X64AxisY returns a new vector representing the Y axis.

func X64AxisZ

func X64AxisZ() *X64

X64AxisZ returns a new vector representing the Z axis.

func X64Cross

func X64Cross(veca, vecb *X64) *X64

X64Cross returns the the cross product of two vectors. Args are left untouched, a pointer on a new object is returned.

func X64DivScale

func X64DivScale(vec *X64, factor vpnumber.X64) *X64

X64DivScale divides all values of a vector by a scalar. Args are left untouched, a pointer on a new object is returned.

func X64FromVec2

func X64FromVec2(vec *vpvec2.X64, x vpnumber.X64) *X64

X64FromVec2 creates a new vector from a smaller one, by appending a value at its end.

func X64Homogeneous

func X64Homogeneous(vec *X64) *X64

X64Homogeneous scales the vector so that its latest member is 1. This what we want to do when projecting, to have homegemous coords. Arg is left untouched, a pointer on a new object is returned.

func X64Lerp

func X64Lerp(veca, vecb *X64, beta vpnumber.X64) *X64

X64Lerp performs a linear interpolation between 2 vectors.

func X64Max

func X64Max(veca *X64, vecb *X64) *X64

X64Max returns the mininum (member-wise) of two vectors. Args are left untouched, a pointer on a new object is returned.

func X64Min

func X64Min(veca *X64, vecb *X64) *X64

X64Min returns the mininum (member-wise) of two vectors. Args are left untouched, a pointer on a new object is returned.

func X64MulScale

func X64MulScale(vec *X64, factor vpnumber.X64) *X64

X64MulScale multiplies all values of a vector by a scalar. Args are left untouched, a pointer on a new object is returned.

func X64Neg

func X64Neg(vec *X64) *X64

X64Neg changes the sign of all vector members. Arg is left untouched, a pointer on a new object is returned.

func X64New

func X64New(x1, x2, x3 vpnumber.X64) *X64

X64New creates a new vector containing 3 fixed point 64 bit values.

func X64Normalize

func X64Normalize(vec *X64) *X64

X64Normalize scales a vector so that its length is 1. Arg is left untouched, a pointer on a new object is returned.

func X64Sub

func X64Sub(veca, vecb *X64) *X64

X64Sub substracts vector b from vector a. Args are left untouched, a pointer on a new object is returned.

func (*X64) Add

func (vec *X64) Add(op *X64) *X64

Add adds operand to the vector. It modifies the vector, and returns a pointer on it.

func (*X64) Cross

func (vec *X64) Cross(op *X64) *X64

Cross returns the the cross product of two vectors. It modifies the vector, and returns a pointer on it.

func (*X64) DivScale

func (vec *X64) DivScale(factor vpnumber.X64) *X64

DivScale divides all values of the vector by factor. It modifies the vector, and returns a pointer on it.

func (*X64) Dot

func (vec *X64) Dot(op *X64) vpnumber.X64

Dot returns the the dot product of two vectors.

func (*X64) Homogeneous

func (vec *X64) Homogeneous() *X64

Homogeneous scales the vector so that its latest member is 1. This what we want to do when projecting, to have homegemous coords. It modifies the vector, and returns a pointer on it.

func (*X64) IsSimilar

func (vec *X64) IsSimilar(op *X64) bool

IsSimilar returns true if vectors are approximatively the same. This is a workarround to ignore rounding errors.

func (*X64) Length

func (vec *X64) Length() vpnumber.X64

Length returns the length of the vector.

func (*X64) Lerp

func (vec *X64) Lerp(op *X64, beta vpnumber.X64) *X64

Lerp performs a linear interpolation with another vector.

func (*X64) Max

func (vec *X64) Max(op *X64) *X64

Max returns the maximum of all vector members. It modifies the vector, and returns a pointer on it.

func (*X64) Min

func (vec *X64) Min(op *X64) *X64

Min returns the minimum of all vector members. It modifies the vector, and returns a pointer on it.

func (*X64) MulScale

func (vec *X64) MulScale(factor vpnumber.X64) *X64

MulScale multiplies all values of the vector by factor. It modifies the vector, and returns a pointer on it.

func (*X64) Neg

func (vec *X64) Neg() *X64

Neg changes the sign of all vector members. It modifies the vector, and returns a pointer on it.

func (*X64) Normalize

func (vec *X64) Normalize() *X64

Normalize scales the vector so that its length is 1. It modifies the vector, and returns a pointer on it.

func (*X64) SqMag

func (vec *X64) SqMag() vpnumber.X64

SqMag returns the sum of the squares of all values. It is used to calculate length, it is faster than the complete length calculation, as it does not perform a square root.

func (*X64) String

func (vec *X64) String() string

String returns a readable form of the vector.

func (*X64) Sub

func (vec *X64) Sub(op *X64) *X64

Sub substracts operand from the vector. It modifies the vector, and returns a pointer on it.

func (*X64) ToF32

func (vec *X64) ToF32() *F32

ToF32 converts the vector to a float32 vector.

func (*X64) ToF64

func (vec *X64) ToF64() *F64

ToF64 converts the vector to a float64 vector.

func (*X64) ToI32

func (vec *X64) ToI32() *I32

ToI32 converts the vector to an int32 vector.

func (*X64) ToI64

func (vec *X64) ToI64() *I64

ToI64 converts the vector to an int32 vector.

func (*X64) ToVec2

func (vec *X64) ToVec2() *vpvec2.X64

ToVec2 creates a smaller vector by removing the last value.

func (*X64) ToX32

func (vec *X64) ToX32() *X32

ToX32 converts the vector to a fixed point number vector on 64 bits.

type X64BinaryOperator

type X64BinaryOperator func(a, b *X64) *X64

X64BinaryOperator designs funcs such as Add, Sub, Min, Max, which operates on two vectors and return one.

type X64UnaryOperator

type X64UnaryOperator func(a *X64) *X64

X64UnaryOperator designs funcs such as Neg, which operates on one vector and returns another vector.

Jump to

Keyboard shortcuts

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