Documentation
¶
Overview ¶
Package vec32 operates on four-dimensional float32 vectors.
Index ¶
- func Dot(v1, v2 Vector) float32
- type Vector
- func (v Vector) Abs() Vector
- func (v Vector) GoString() string
- func (v Vector) Inverse() Vector
- func (v Vector) IsZero() bool
- func (v Vector) Length() float32
- func (v Vector) LengthSqr() float32
- func (v Vector) Negate() Vector
- func (v Vector) Normalize() Vector
- func (v Vector) Scale(s float32) Vector
- func (v Vector) String() string
- func (v Vector) Vec3() Vector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Vector ¶
type Vector [4]float32
Vector holds a four-dimensional vector. The default value is a zero vector.
func CreateCS ¶
CreateCS finds two normalized vectors orthogonal to the given one that can be used as a coordinate system.
All calculations are done in three-dimensional space. This is particularly useful for UV-mapping and the like.
func (Vector) Inverse ¶
Inverse returns a new vector that is the result of 1.0 / v[i] for all i. Any zero value is left as zero.
func (Vector) LengthSqr ¶
LengthSqr returns the magnitude squared of the vector. This is cheaper to compute than Length.
func (Vector) Normalize ¶
Normalize creates a new vector that is of unit length in the same direction as the vector.
Click to show internal directories.
Click to hide internal directories.