Documentation
¶
Index ¶
- func Compare[T mathex.SignedNumber](a, b Of[T]) int
- func MaxW[T mathex.SignedNumber](a, b Of[T]) T
- func MaxX[T mathex.SignedNumber](a, b Of[T]) T
- func MaxY[T mathex.SignedNumber](a, b Of[T]) T
- func MaxZ[T mathex.SignedNumber](a, b Of[T]) T
- func MinW[T mathex.SignedNumber](a, b Of[T]) T
- func MinX[T mathex.SignedNumber](a, b Of[T]) T
- func MinY[T mathex.SignedNumber](a, b Of[T]) T
- func MinZ[T mathex.SignedNumber](a, b Of[T]) T
- type Float32
- type Float64
- type Int
- type Int8
- type Int16
- type Int32
- type Int64
- type Of
- func Average[T mathex.SignedNumber](vectors []Of[T]) Of[T]
- func Fill[T mathex.SignedNumber](v T) Of[T]
- func FromArray[T mathex.SignedNumber](data []T) Of[T]
- func Lerp[T mathex.SignedNumber](a, b Of[T], t float64) Of[T]
- func Max[T mathex.SignedNumber](a, b Of[T]) Of[T]
- func Midpoint[T mathex.SignedNumber](a, b Of[T]) Of[T]
- func Min[T mathex.SignedNumber](a, b Of[T]) Of[T]
- func New[T mathex.SignedNumber](x, y, z, w T) Of[T]
- func NewT[T mathex.SignedNumber, XT, YT, ZT, WT mathex.Number](x XT, y YT, z ZT, w WT) Of[T]
- func One[T mathex.SignedNumber]() Of[T]
- func Read[T mathex.SignedNumber](in io.Reader, endian binary.ByteOrder) (v Of[T], err error)
- func ReadFloat32(in io.Reader, endian binary.ByteOrder) (Of[float32], error)
- func ReadFloat64(in io.Reader, endian binary.ByteOrder) (Of[float64], error)
- func ReadInt8(in io.Reader) (Of[int8], error)
- func ReadInt16(in io.Reader, endian binary.ByteOrder) (Of[int16], error)
- func ReadInt32(in io.Reader, endian binary.ByteOrder) (Of[int32], error)
- func ReadInt64(in io.Reader, endian binary.ByteOrder) (Of[int64], error)
- func To[T, OT mathex.SignedNumber](v Of[OT]) Of[T]
- func Zero[T mathex.SignedNumber]() Of[T]
- func (v Of[T]) Abs() Of[T]
- func (v Of[T]) Add(other Of[T]) Of[T]
- func (v Of[T]) AddW(dW T) Of[T]
- func (v Of[T]) AddX(dX T) Of[T]
- func (v Of[T]) AddY(dY T) Of[T]
- func (v Of[T]) AddZ(dZ T) Of[T]
- func (v Of[T]) Ceil() Of[T]
- func (v Of[T]) CeilToInt() Of[int]
- func (v Of[T]) Clamp(vmin, vmax T) Of[T]
- func (v Of[T]) ContainsNaN() bool
- func (v Of[T]) DivByConstant(t float64) Of[T]
- func (v Of[T]) Dot(other Of[T]) float64
- func (v Of[T]) Exp() Of[T]
- func (v Of[T]) Exp2() Of[T]
- func (v Of[T]) Expm1() Of[T]
- func (v Of[T]) Flip() Of[T]
- func (v Of[T]) FlipW() Of[T]
- func (v Of[T]) FlipX() Of[T]
- func (v Of[T]) FlipY() Of[T]
- func (v Of[T]) FlipZ() Of[T]
- func (v Of[T]) Floor() Of[T]
- func (v Of[T]) FloorToInt() Of[int]
- func (v Of[T]) Format(format string) string
- func (v Of[T]) Length() float64
- func (v Of[T]) LengthF() float32
- func (v Of[T]) LengthSquared() T
- func (v Of[T]) Log() Of[T]
- func (v Of[T]) Log2() Of[T]
- func (v Of[T]) Log10() Of[T]
- func (v Of[T]) MarshalJSON() ([]byte, error)
- func (v Of[T]) MaxComponent() T
- func (v Of[T]) MinComponent() T
- func (v Of[T]) MultByVector(o Of[T]) Of[T]
- func (v Of[T]) NearZero() bool
- func (v Of[T]) Negated() Of[T]
- func (v Of[T]) Normalized() Of[T]
- func (v Of[T]) Product() T
- func (v Of[T]) Reciprocal() Of[float64]
- func (v Of[T]) ReciprocalF() Of[float32]
- func (v Of[T]) Round() Of[T]
- func (v Of[T]) RoundToInt() Of[int]
- func (v Of[T]) Scale(t float64) Of[T]
- func (v Of[T]) SetW(newW T) Of[T]
- func (v Of[T]) SetX(newX T) Of[T]
- func (v Of[T]) SetY(newY T) Of[T]
- func (v Of[T]) SetZ(newZ T) Of[T]
- func (v Of[T]) Sqrt() Of[T]
- func (v Of[T]) String() string
- func (v Of[T]) Sub(other Of[T]) Of[T]
- func (v Of[T]) ToFloat32() Of[float32]
- func (v Of[T]) ToFloat64() Of[float64]
- func (v Of[T]) ToInt() Of[int]
- func (v Of[T]) ToInt8() Of[int8]
- func (v Of[T]) ToInt16() Of[int16]
- func (v Of[T]) ToInt32() Of[int32]
- func (v Of[T]) ToInt64() Of[int64]
- func (v *Of[T]) UnmarshalJSON(data []byte) error
- func (v Of[T]) Values() (T, T, T, T)
- func (v Of[T]) Write(out io.Writer, endian binary.ByteOrder) (err error)
- func (v Of[T]) XY() vector2.Of[T]
- func (v Of[T]) XYZ() vector3.Of[T]
- func (v Of[T]) XZ() vector2.Of[T]
- func (v Of[T]) YX() vector2.Of[T]
- func (v Of[T]) YZ() vector2.Of[T]
- func (v Of[T]) ZX() vector2.Of[T]
- func (v Of[T]) ZY() vector2.Of[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaxW ¶
func MaxW[T mathex.SignedNumber](a, b Of[T]) T
func MaxX ¶
func MaxX[T mathex.SignedNumber](a, b Of[T]) T
func MaxY ¶
func MaxY[T mathex.SignedNumber](a, b Of[T]) T
func MaxZ ¶
func MaxZ[T mathex.SignedNumber](a, b Of[T]) T
func MinW ¶
func MinW[T mathex.SignedNumber](a, b Of[T]) T
func MinX ¶
func MinX[T mathex.SignedNumber](a, b Of[T]) T
func MinY ¶
func MinY[T mathex.SignedNumber](a, b Of[T]) T
func MinZ ¶
func MinZ[T mathex.SignedNumber](a, b Of[T]) T
Types ¶
type Float32 ¶
func NewFloat32 ¶
type Float64 ¶
func NewFloat64 ¶
type Of ¶
type Of[T mathex.SignedNumber] struct { X T Y T Z T W T }
Of contains 4 components
func Average ¶
func Average[T mathex.SignedNumber](vectors []Of[T]) Of[T]
Average sums all vector4's components together and divides each component by the number of vectors added
func Fill ¶
func Fill[T mathex.SignedNumber](v T) Of[T]
Fill creates a vector where each component is equal to v
func FromArray ¶
func FromArray[T mathex.SignedNumber](data []T) Of[T]
Builds a vector from the data found from the passed in array to the best of it's ability. If the length of the array is smaller than the vector itself, only those values will be used to build the vector, and the remaining vector components will remain the default value of the vector's data type (some version of 0).
func Lerp ¶
func Lerp[T mathex.SignedNumber](a, b Of[T], t float64) Of[T]
Lerp linearly interpolates between a and b by t
func New ¶
func New[T mathex.SignedNumber](x, y, z, w T) Of[T]
New creates a new vector with corresponding 3 components
func NewT ¶
func NewT[T mathex.SignedNumber, XT, YT, ZT, WT mathex.Number](x XT, y YT, z ZT, w WT) Of[T]
func (Of[T]) Add ¶
Add takes each component of our vector and adds them to the vector passed in, returning a resulting vector
func (Of[T]) CeilToInt ¶
CeilToInt applies the ceil math operation to each component of the vector, and then casts it to a int
func (Of[T]) ContainsNaN ¶
func (Of[T]) DivByConstant ¶
func (Of[T]) Expm1 ¶
Expm1 returns e**x - 1, the base-e exponential for each component minus 1. It is more accurate than Exp(x) - 1 when the component is near zero
func (Of[T]) FloorToInt ¶
FloorToInt applies the floor math operation to each component of the vector, and then casts it to a int
func (Of[T]) LengthSquared ¶
func (v Of[T]) LengthSquared() T
func (Of[T]) MarshalJSON ¶
func (Of[T]) MaxComponent ¶
func (v Of[T]) MaxComponent() T
func (Of[T]) MinComponent ¶
func (v Of[T]) MinComponent() T
func (Of[T]) MultByVector ¶
MultByVector is component wise multiplication, also known as Hadamard product.
func (Of[T]) Normalized ¶
func (Of[T]) Reciprocal ¶
func (Of[T]) ReciprocalF ¶
func (Of[T]) Round ¶
Round takes each component of the vector and rounds it to the nearest whole number
func (Of[T]) RoundToInt ¶
RoundToInt takes each component of the vector and rounds it to the nearest whole number, and then casts it to a int