Documentation ¶
Index ¶
- func Cast(a [3]float32) []float32
- func CastFixed(a Vec) [3]float32
- func Copy(store Vec, reference Vec)
- func DimEq(a Vec, b Vec) bool
- func Dist(a Vec, b Vec) float32
- func Dot(a Vec, b Vec) float32
- func Eql(a Vec, b Vec) bool
- func Equal(a Vec, b Vec) bool
- func Mag(v Vec) float32
- func SinDot(a Vec, b Vec) float32
- type Vec
- func Add(a Vec, b Vec) Vec
- func Cross(a Vec, b Vec) Vec
- func LogVecError(vec Vec, op string) Vec
- func Neg(a Vec) Vec
- func Norm(a Vec) Vec
- func Proj(a Vec, n Vec) Vec
- func ProjPlane(a Vec, n Vec) Vec
- func RaySphereIntersection(r0 Vec, d0 Vec, c Vec, r float32) (Vec, bool)
- func Refl(v Vec, n Vec) Vec
- func Scale(a Vec, k float32) Vec
- func ScaleVar(a Vec, b Vec) Vec
- func Sub(b Vec, a Vec) Vec
- func Tan(a Vec, n Vec) Vec
- func Vec2() Vec
- func Vec3() Vec
- func Vec4() Vec
- func VecN(n int) Vec
- func (a Vec) Add(b Vec) Vec
- func (v Vec) Clamp(min float32, max float32)
- func (store Vec) Copy(reference Vec)
- func (v Vec) Dim() int
- func (a Vec) DimEq(b Vec) bool
- func (a Vec) Dist(b Vec) float32
- func (a Vec) Eql(b Vec) bool
- func (a Vec) Equal(b Vec) bool
- func (v Vec) Mag() float32
- func (b Vec) Mul(a Vec) Vec
- func (a Vec) Neg() Vec
- func (a Vec) NegV() Vec
- func (a Vec) Norm() Vec
- func (a Vec) Proj(n Vec) Vec
- func (a Vec) ProjPlane(n Vec) Vec
- func (v Vec) Refl(n Vec) Vec
- func (a Vec) Scale(k float32) Vec
- func (b Vec) Sub(a Vec) Vec
- func (a Vec) Tan(n Vec) Vec
- func (v Vec) ToString() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶
Copy copies the reference vector into the store vec @MUTATES store and updates with copies of reference Vec Copy will attempt to copy even if vectors are different sizes
func Dot ¶
---TRIPLE CHECK THIS LOL Dot computes the dot product as in a.Dot(b) where the resulting value should return a scalar value representative of the ||a|||b||Cos() theta angle between two non-parallel vectors
func Eql ¶
Eql Checks if two vectors are equal by lazy comparison If the user of this API wishes to check whether two vectors are within EPSILON of Eachother please use the Equal() function denoted at the top of this library
func Equal ¶
Equal checks if two vectors are logically equal their subtraction and the resulting mag() of that vector gives a value less than EPSIOLN if two vectors are equal
Types ¶
type Vec ¶
type Vec []float32
Vector slice array
func Add ¶
Add sums each element index against the other vector a stores the result in a new vector @DELEGATES
func Cross ¶
Cross cross multpiplies A x B. Be aware that cross multplication is not commutative Cross is a non-mutating function @NONMUTATE and represents a Vector that is perpendicular To the plane created from two vectors when those vectors are 3 Vecs satisfying that property In general cross products produce an orthonormal vector between two vectors. For now only works on 3 Vecs and 3 Like 4 Vecs =
func LogVecError ¶
func Neg ¶
Negates the current vector by -1.0. But stores the result in a new value @NONMUTATE function see NegV for mutating
func Norm ¶
Returns normalized vector A.i / Mag() function is non mutating and delegates result to a new vector
func Proj ¶
Proj projects a vector onto the N Vec a -> N. Functino is non mutating and delegates The output vector to a new vector. Error log checking handled by internal dot product call. N typically may be considered to be a Normal vector that A will be projected onto.
func ProjPlane ¶
ProjPlane projects a vector on to the the plane defined by A & N. Functino is non mutating and delegates The output vector to a new vector. Error log checking handled by internal dot product call. N typically may be considered to be a Normal vector that A will be projected onto.
func RaySphereIntersection ¶
RaySphereIntersection Calculates the Intersection Points for a Ray and Sphere r0 is ray origin , d0 direction , c is the sphere origin, r is the radius
func Refl ¶
Refl reflects the v vector about N this function is non mutating and delegates vector result into a new vector
func Tan ¶
Tan returns the tangent vector from the given normal profile - this may Just be a plane projection of A onto the the plane p....defined by projection of A onto N when A is not parallel to N.
func (Vec) Add ¶
Add sums each element index against the other vector a stores the result in a new vector @DELEGATES
func (Vec) Clamp ¶
Clamps Vector between min and max values for each entry @mutate_selector / #utility / #mgl / #vector / #math
func (Vec) Copy ¶
Copy copies the reference vector into the store vec @MUTATES store and updates with copies of reference Vec Copy will attempt to copy even if vectors are different sizes
func (Vec) Eql ¶
Eql Checks if two vectors are equal by lazy comparison If the user of this API wishes to check whether two vectors are within EPSILON of Eachother please use the Equal() function denoted at the top of this library
func (Vec) Equal ¶
Equal checks if two vectors are logically equal their subtraction and the resulting mag() of that vector gives a value less than EPSIOLN if two vectors are equal
func (Vec) Mag ¶
Mag (v Vec) returns the magnitued of any vector > length size 0. Operation does not mutate vector state @DELEGATES
func (Vec) Neg ¶
Negates the current vector by -1.0. But stores the result in a new value @NONMUTATE function see NegV for mutating
func (Vec) NegV ¶
Negates the current vector by -1.0. But stores the result in a new value @NONMUTATE function see NegV for mutating
func (Vec) Norm ¶
Returns normalized vector A.i / Mag() function is non mutating and delegates result to a new vector - fails quietly with 0 vector
func (Vec) Proj ¶
Proj projects a vector onto the N Vec a -> N. Functino is non mutating and delegates The output vector to a new vector. Error log checking handled by internal dot product call. N typically may be considered to be a Normal vector that A will be projected onto.
func (Vec) ProjPlane ¶
ProjPlane projects a vector on to the the plane defined by A & N. Functino is non mutating and delegates The output vector to a new vector. Error log checking handled by internal dot product call. N typically may be considered to be a Normal vector that A will be projected onto.
func (Vec) Refl ¶
Refl reflects the v vector about N this function is non mutating and delegates vector result into a new vector
func (Vec) Scale ¶
Scale scales vector kX this function does not mutate the current vector @NONMUTATE function Scale