Documentation ¶
Index ¶
- Variables
- func Distance(a, b T) float32
- func Dot(a, b T) float32
- type Array
- type T
- func (v T) Abs() T
- func (v T) Add(v2 T) T
- func (v T) ApproxEqual(v2 T) bool
- func (v T) Ceil() T
- func (v T) Div(v2 T) T
- func (v T) Floor() T
- func (v *T) Invert()
- func (v *T) Inverted() T
- func (v T) Length() float32
- func (v T) LengthSqr() float32
- func (v T) Mul(v2 T) T
- func (v *T) Normalize()
- func (v T) Normalized() T
- func (v T) Round() T
- func (v *T) Scale(f float32)
- func (v T) ScaleI(i int) T
- func (v T) Scaled(f float32) T
- func (v T) Slice() [3]float32
- func (v T) String() string
- func (v T) Sub(v2 T) T
- func (v T) WithX(x float32) T
- func (v T) WithY(y float32) T
- func (v T) WithZ(z float32) T
- func (v T) XY() vec2.T
- func (v T) XZ() vec2.T
- func (v T) YZ() vec2.T
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Zero is the zero vector Zero = T{0, 0, 0} // One is the unit vector One = T{1, 1, 1} // UnitX is the unit vector in the X direction (right) UnitX = T{1, 0, 0} Right = T{1, 0, 0} // UnitXN is the unit vector in the negative X direction (left) UnitXN = T{-1, 0, 0} Left = T{-1, 0, 0} // UnitY is the unit vector in the Y direction (up) UnitY = T{0, 1, 0} Up = T{0, 1, 0} // UnitYN is the unit vector in the negative Y direction (down) UnitYN = T{0, -1, 0} Down = T{0, -1, 0} // UnitZ is the unit vector in the Z direction (forward) UnitZ = T{0, 0, 1} Forward = T{0, 0, 1} // UnitZN is the unit vector in the negative Z direction (backward) UnitZN = T{0, 0, -1} Backward = T{0, 0, 1} InfPos = T{math.InfPos, math.InfPos, math.InfPos} InfNeg = T{math.InfNeg, math.InfNeg, math.InfNeg} )
Functions ¶
Types ¶
type Array ¶
type Array []T
Array holds an array of 3-component vectors
type T ¶
type T struct {
X, Y, Z float32
}
T holds a 3-component vector of 32-bit floats
func (T) ApproxEqual ¶
func (T) Div ¶
Div divides each element of the vector with the corresponding element of another vector
func (T) LengthSqr ¶
LengthSqr returns the squared length of the vector. See also Length and Normalize.
func (T) Mul ¶
Mul multiplies each element of the vector with the corresponding element of another vector
func (T) Normalized ¶
Normalized returns a unit length normalized copy of the vector.
func (T) Sub ¶
Sub subtracts each element of the vector with the corresponding element of another vector
Click to show internal directories.
Click to hide internal directories.