Documentation
¶
Overview ¶
Package evec has vector types for emergent, including Vector2i which is a 2D vector with int values, using the API based on math32.Vector2i. This is distinct from math32.Vector2i because it uses int instead of int32, and the int is significantly easier to deal with for layer sizing params etc.
Index ¶
- func Max32i(a, b int) int
- func Min32i(a, b int) int
- type Dims
- type Vector2i
- func (v Vector2i) Add(other Vector2i) Vector2i
- func (v Vector2i) AddScalar(s int) Vector2i
- func (v *Vector2i) Clamp(min, max Vector2i)
- func (v *Vector2i) ClampScalar(minVal, maxVal int)
- func (v Vector2i) Dim(dim Dims) int
- func (v Vector2i) Div(other Vector2i) Vector2i
- func (v Vector2i) DivScalar(scalar int) Vector2i
- func (v *Vector2i) FromArray(array []int, offset int)
- func (v Vector2i) IsEqual(other Vector2i) bool
- func (v Vector2i) IsNil() bool
- func (v Vector2i) Max(other Vector2i) Vector2i
- func (v Vector2i) Min(other Vector2i) Vector2i
- func (v Vector2i) Mul(other Vector2i) Vector2i
- func (v Vector2i) MulScalar(s int) Vector2i
- func (v Vector2i) Negate() Vector2i
- func (v *Vector2i) Set(x, y int)
- func (v *Vector2i) SetAdd(other Vector2i)
- func (v *Vector2i) SetAddScalar(s int)
- func (v *Vector2i) SetByName(name string, value int)
- func (v *Vector2i) SetDim(dim Dims, value int)
- func (v *Vector2i) SetDiv(other Vector2i)
- func (v *Vector2i) SetDivScalar(s int)
- func (v *Vector2i) SetMax(other Vector2i)
- func (v *Vector2i) SetMin(other Vector2i)
- func (v *Vector2i) SetMul(other Vector2i)
- func (v *Vector2i) SetMulScalar(s int)
- func (v *Vector2i) SetNegate()
- func (v *Vector2i) SetScalar(s int)
- func (v *Vector2i) SetSub(other Vector2i)
- func (v *Vector2i) SetSubScalar(s int)
- func (v *Vector2i) SetZero()
- func (v Vector2i) Sub(other Vector2i) Vector2i
- func (v Vector2i) SubScalar(s int) Vector2i
- func (v Vector2i) ToArray(array []int, offset int)
- func (v Vector2i) ToVector2() math32.Vector2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dims ¶
type Dims int32 //enums:enum
Dims is a list of vector dimension (component) names
const DimsN Dims = 4
DimsN is the highest valid value for type Dims, plus one.
func DimsValues ¶
func DimsValues() []Dims
DimsValues returns all possible values for the type Dims.
func (Dims) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Dims) SetString ¶
SetString sets the Dims value from its string representation, and returns an error if the string is invalid.
func (*Dims) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Vector2i ¶
Vector2i is a 2D vector/point with X and Y int components.
func NewVector2i ¶
NewVector2i returns a new Vector2i with the specified x and y components.
func NewVector2iFromVector2Ceil ¶
NewVector2iFromVector2Ceil converts from floating point math32.Vector2 vector to int, using ceil
func NewVector2iFromVector2Floor ¶
NewVector2iFromVector2Floor converts from floating point math32.Vector2 vector to int, using floor
func NewVector2iFromVector2Round ¶
NewVector2iFromVector2Round converts from floating point math32.Vector2 vector to int, using rounding
func NewVector2iScalar ¶
NewVector2iScalar returns a new Vector2i with all components set to scalar.
func (Vector2i) AddScalar ¶
AddScalar adds scalar s to each component of this vector and returns new vector.
func (*Vector2i) Clamp ¶
Clamp sets this vector components to be no less than the corresponding components of min and not greater than the corresponding component of max. Assumes min < max, if this assumption isn't true it will not operate correctly.
func (*Vector2i) ClampScalar ¶
ClampScalar sets this vector components to be no less than minVal and not greater than maxVal.
func (Vector2i) Div ¶
Div divides each component of this vector by the corresponding one from other vector and returns resulting vector.
func (Vector2i) DivScalar ¶
DivScalar divides each component of this vector by the scalar s and returns resulting vector. If scalar is zero, returns zero.
func (*Vector2i) FromArray ¶
FromArray sets this vector's components from the specified array and offset.
func (Vector2i) Mul ¶
Mul multiplies each component of this vector by the corresponding one from other and returns resulting vector.
func (Vector2i) MulScalar ¶
MulScalar multiplies each component of this vector by the scalar s and returns resulting vector.
func (*Vector2i) SetAddScalar ¶
SetAddScalar sets this to addition with scalar.
func (*Vector2i) SetByName ¶
SetByName sets this vector component value by its case insensitive name: "x" or "y".
func (*Vector2i) SetDivScalar ¶
SetDivScalar sets this to division by scalar.
func (*Vector2i) SetMax ¶
SetMax sets this vector components to the maximum value of itself and other vector.
func (*Vector2i) SetMin ¶
SetMin sets this vector components to the minimum values of itself and other vector.
func (*Vector2i) SetMul ¶
SetMul sets this to multiplication with other vector (i.e., *= or times-equals).
func (*Vector2i) SetMulScalar ¶
SetMulScalar sets this to multiplication by scalar.
func (*Vector2i) SetNegate ¶
func (v *Vector2i) SetNegate()
SetNegate negates each of this vector's components.
func (*Vector2i) SetSub ¶
SetSub sets this to subtraction with other vector (i.e., -= or minus-equals).
func (*Vector2i) SetSubScalar ¶
SetSubScalar sets this to subtraction of scalar.
func (*Vector2i) SetZero ¶
func (v *Vector2i) SetZero()
SetZero sets this vector X and Y components to be zero.
func (Vector2i) SubScalar ¶
SubScalar subtracts scalar s from each component of this vector and returns new vector.