Documentation ¶
Index ¶
- type Array
- func (v3a Array[T]) Add(other Vector[T]) (out Array[T])
- func (v3a Array[T]) Average(vectors []Vector[T]) Vector[float64]
- func (v3a Array[T]) Bounds() (Vector[T], Vector[T])
- func (v3a Array[T]) Distance() float64
- func (v3a Array[T]) DivByConstant(t float64) (out Array[T])
- func (v3a Array[T]) Modify(f func(Vector[T]) Vector[T]) (out Array[T])
- func (v3a Array[T]) Normalized() (out Array[T])
- func (v3a Array[T]) Scale(t float64) (out Array[T])
- func (v3a Array[T]) StandardDeviation() (mean, deviation Vector[float64])
- func (v3a Array[T]) Sum() (sum Vector[T])
- type Float32
- type Float32Array
- type Float64
- type Float64Array
- type Int
- type Int64
- type Int64Array
- type IntArray
- type Vector
- func Average[T vector.Number](vectors []Vector[T]) Vector[T]
- func Backwards[T vector.Number]() Vector[T]
- func Down[T vector.Number]() Vector[T]
- func Forward[T vector.Number]() Vector[T]
- func Left[T vector.Number]() Vector[T]
- func Lerp[T vector.Number](a, b Vector[T], t float64) Vector[T]
- func Max[T vector.Number](a, b Vector[T]) Vector[T]
- func Min[T vector.Number](a, b Vector[T]) Vector[T]
- func New[T vector.Number](x T, y T, z T) Vector[T]
- func One[T vector.Number]() Vector[T]
- func Rand() Vector[float64]
- func RandInUnitSphere() Vector[float64]
- func RandOnUnitSphere() Vector[float64]
- func Right[T vector.Number]() Vector[T]
- func Up[T vector.Number]() Vector[T]
- func Zero[T vector.Number]() Vector[T]
- func (v Vector[T]) Abs() Vector[T]
- func (v Vector[T]) Add(other Vector[T]) Vector[T]
- func (v Vector[T]) Angle(other Vector[T]) float64
- func (v Vector[T]) Ceil() Vector[T]
- func (v Vector[T]) CeilToInt() Vector[int]
- func (v Vector[T]) Cross(other Vector[T]) Vector[T]
- func (v Vector[T]) Distance(other Vector[T]) float64
- func (v Vector[T]) DistanceSquared(other Vector[T]) float64
- func (v Vector[T]) DivByConstant(t float64) Vector[T]
- func (v Vector[T]) Dot(other Vector[T]) float64
- func (v Vector[T]) Floor() Vector[T]
- func (v Vector[T]) FloorToInt() Vector[int]
- func (v Vector[T]) Length() float64
- func (v Vector[T]) LengthSquared() float64
- func (v Vector[T]) Midpoint(o Vector[T]) Vector[T]
- func (v Vector[T]) MultByVector(o Vector[T]) Vector[T]
- func (v Vector[T]) Normalized() Vector[T]
- func (v Vector[T]) Perpendicular() Vector[T]
- func (v Vector[T]) Round() Vector[T]
- func (v Vector[T]) RoundToInt() Vector[int]
- func (v Vector[T]) Scale(t float64) Vector[T]
- func (v Vector[T]) SetX(newX T) Vector[T]
- func (v Vector[T]) SetY(newY T) Vector[T]
- func (v Vector[T]) SetZ(newZ T) Vector[T]
- func (v Vector[T]) Sub(other Vector[T]) Vector[T]
- func (v Vector[T]) ToFloat32() Vector[float32]
- func (v Vector[T]) ToFloat64() Vector[float64]
- func (v Vector[T]) ToInt() Vector[int]
- func (v Vector[T]) ToInt64() Vector[int64]
- func (v Vector[T]) X() T
- func (v Vector[T]) XY() vector2.Vector[T]
- func (v Vector[T]) XZ() vector2.Vector[T]
- func (v Vector[T]) Y() T
- func (v Vector[T]) YZ() vector2.Vector[T]
- func (v Vector[T]) Z() T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
func (Array[T]) Average ¶
Average sums all vector3's components together and divides each component by the number of values added
func (Array[T]) DivByConstant ¶
func (Array[T]) Normalized ¶
func (Array[T]) StandardDeviation ¶ added in v1.0.2
StandardDeviation calculates the population standard deviation on each component of the vector
type Float32Array ¶
type Float64Array ¶
type Int64Array ¶
type Vector ¶
Vector contains 3 components
func Average ¶
Average sums all vector3's components together and divides each component by the number of vectors added
func RandInUnitSphere ¶ added in v1.0.2
RandInUnitSphere returns a randomly sampled point in or on the unit sphere
func RandOnUnitSphere ¶ added in v1.0.2
RandOnUnitSphere returns a randomly sampled point on the unit sphere
func (Vector[T]) Add ¶
Add takes each component of our vector and adds them to the vector passed in, returning a resulting vector
func (Vector[T]) CeilToInt ¶
CeilToInt applies the ceil math operation to each component of the vector, and then casts it to a int
func (Vector[T]) DistanceSquared ¶
func (Vector[T]) DivByConstant ¶
func (Vector[T]) FloorToInt ¶
FloorToInt applies the floor math operation to each component of the vector, and then casts it to a int
func (Vector[T]) LengthSquared ¶
func (Vector[T]) Midpoint ¶ added in v1.0.2
Midpoint returns the midpoint between this vector and the vector passed in.
func (Vector[T]) MultByVector ¶
MultByVector is component wise multiplication, also known as Hadamard product.
func (Vector[T]) Normalized ¶
func (Vector[T]) Perpendicular ¶
Perpendicular finds a vector that meets this vector at a right angle. https://stackoverflow.com/a/11132720/4974261
func (Vector[T]) Round ¶
Round takes each component of the vector and rounds it to the nearest whole number
func (Vector[T]) RoundToInt ¶
RoundToInt takes each component of the vector and rounds it to the nearest whole number, and then casts it to a int