v3

package
v0.0.0-...-c238eda Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Vec

type Vec struct {
	X, Y, Z float64
}

Vec is a 3D float64 vector.

func (Vec) Abs

func (a Vec) Abs() Vec

Abs takes the absolute value of each vector component.

func (Vec) Add

func (a Vec) Add(b Vec) Vec

Add adds two vectors. Returns a + b.

func (Vec) AddScalar

func (a Vec) AddScalar(b float64) Vec

AddScalar adds a scalar to each vector component.

func (Vec) Ceil

func (a Vec) Ceil() Vec

Ceil takes the ceiling value of each vector component.

func (Vec) Clamp

func (a Vec) Clamp(b, c Vec) Vec

Clamp clamps a vector between 2 other vectors.

func (Vec) Cos

func (a Vec) Cos() Vec

Cos takes the cosine of each vector component.

func (Vec) Cross

func (a Vec) Cross(b Vec) Vec

Cross returns the cross product of a and b.

func (Vec) Div

func (a Vec) Div(b Vec) Vec

Div divides two vectors by component.

func (Vec) DivScalar

func (a Vec) DivScalar(b float64) Vec

DivScalar divides each vector component by a scalar.

func (Vec) Dot

func (a Vec) Dot(b Vec) float64

Dot returns the dot product of a and b.

func (Vec) Equals

func (a Vec) Equals(b Vec, tolerance float64) bool

Equals returns true if a == b within the tolerance limit.

func (Vec) Get

func (a Vec) Get(i int) float64

Get the n-th component of the vector.

func (Vec) LTEZero

func (a Vec) LTEZero() bool

LTEZero returns true if any vector components are <= 0.

func (Vec) LTZero

func (a Vec) LTZero() bool

LTZero returns true if any vector components are < 0.

func (Vec) Length

func (a Vec) Length() float64

Length returns the vector length.

func (Vec) Length2

func (a Vec) Length2() float64

Length2 returns the vector length * length.

func (Vec) Max

func (a Vec) Max(b Vec) Vec

Max return a vector with the maximum components of two vectors.

func (Vec) MaxComponent

func (a Vec) MaxComponent() float64

MaxComponent returns the maximum component of the vector.

func (Vec) Min

func (a Vec) Min(b Vec) Vec

Min return a vector with the minimum components of two vectors.

func (Vec) MinComponent

func (a Vec) MinComponent() float64

MinComponent returns the minimum component of the vector.

func (Vec) Mul

func (a Vec) Mul(b Vec) Vec

Mul multiplies two vectors by component.

func (Vec) MulScalar

func (a Vec) MulScalar(b float64) Vec

MulScalar multiplies each vector component by a scalar.

func (Vec) Neg

func (a Vec) Neg() Vec

Neg negates a vector.

func (Vec) Normalize

func (a Vec) Normalize() Vec

Normalize scales a vector to unit length.

func (*Vec) Set

func (a *Vec) Set(i int, val float64)

Set the n-th component of the vector.

func (Vec) Sin

func (a Vec) Sin() Vec

Sin takes the sine of each vector component.

func (Vec) Sub

func (a Vec) Sub(b Vec) Vec

Sub subtracts two vectors. Returns a - b.

func (Vec) SubScalar

func (a Vec) SubScalar(b float64) Vec

SubScalar subtracts a scalar from each vector component.

type VecSet

type VecSet []Vec

VecSet is a set of 3D float64 vectors.

func (VecSet) Max

func (a VecSet) Max() Vec

Max return the maximum components of a set of vectors.

func (VecSet) Min

func (a VecSet) Min() Vec

Min return the minimum components of a set of vectors.

Jump to

Keyboard shortcuts

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