Documentation ¶
Overview ¶
Package evec has vector types for emergent, including Vec2i which is a 2D vector with int values, using the API based on mat32.Vec2i. This is distinct from mat32.Vec2i because it uses int instead of int32, and the int is significantly easier to deal with for layer sizing params etc.
Index ¶
- Variables
- func Max32i(a, b int) int
- func Min32i(a, b int) int
- type Dims
- type Vec2i
- func (v Vec2i) Add(other Vec2i) Vec2i
- func (v Vec2i) AddScalar(s int) Vec2i
- func (v *Vec2i) Clamp(min, max Vec2i)
- func (v *Vec2i) ClampScalar(minVal, maxVal int)
- func (v Vec2i) Dim(dim Dims) int
- func (v Vec2i) Div(other Vec2i) Vec2i
- func (v Vec2i) DivScalar(scalar int) Vec2i
- func (v *Vec2i) FromArray(array []int, offset int)
- func (v Vec2i) IsEqual(other Vec2i) bool
- func (v Vec2i) IsNil() bool
- func (v Vec2i) Max(other Vec2i) Vec2i
- func (v Vec2i) Min(other Vec2i) Vec2i
- func (v Vec2i) Mul(other Vec2i) Vec2i
- func (v Vec2i) MulScalar(s int) Vec2i
- func (v Vec2i) Negate() Vec2i
- func (v *Vec2i) Set(x, y int)
- func (v *Vec2i) SetAdd(other Vec2i)
- func (v *Vec2i) SetAddScalar(s int)
- func (v *Vec2i) SetByName(name string, value int)
- func (v *Vec2i) SetDim(dim Dims, value int)
- func (v *Vec2i) SetDiv(other Vec2i)
- func (v *Vec2i) SetDivScalar(s int)
- func (v *Vec2i) SetMax(other Vec2i)
- func (v *Vec2i) SetMin(other Vec2i)
- func (v *Vec2i) SetMul(other Vec2i)
- func (v *Vec2i) SetMulScalar(s int)
- func (v *Vec2i) SetNegate()
- func (v *Vec2i) SetScalar(s int)
- func (v *Vec2i) SetSub(other Vec2i)
- func (v *Vec2i) SetSubScalar(s int)
- func (v *Vec2i) SetZero()
- func (v Vec2i) Sub(other Vec2i) Vec2i
- func (v Vec2i) SubScalar(s int) Vec2i
- func (v Vec2i) ToArray(array []int, offset int)
- func (v Vec2i) ToVec2() mat32.Vec2
Constants ¶
This section is empty.
Variables ¶
var KiT_Dims = kit.Enums.AddEnum(DimsN, kit.NotBitFlag, nil)
Functions ¶
Types ¶
type Dims ¶
type Dims int
Dims is a list of vector dimension (component) names
func (*Dims) FromString ¶
type Vec2i ¶
Vec2i is a 2D vector/point with X and Y int components.
func NewVec2iFmVec2Ceil ¶ added in v1.1.22
NewVec2iFmVec2Ceil converts from floating point mat32.Vec2 vector to int, using ceil
func NewVec2iFmVec2Floor ¶ added in v1.1.22
NewVec2iFmVec2Floor converts from floating point mat32.Vec2 vector to int, using floor
func NewVec2iFmVec2Round ¶ added in v1.1.22
NewVec2iFmVec2Round converts from floating point mat32.Vec2 vector to int, using rounding
func NewVec2iScalar ¶
NewVec2iScalar returns a new Vec2i with all components set to scalar.
func (Vec2i) AddScalar ¶
AddScalar adds scalar s to each component of this vector and returns new vector.
func (*Vec2i) 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 (*Vec2i) ClampScalar ¶
ClampScalar sets this vector components to be no less than minVal and not greater than maxVal.
func (Vec2i) Div ¶
Div divides each component of this vector by the corresponding one from other vector and returns resulting vector.
func (Vec2i) DivScalar ¶
DivScalar divides each component of this vector by the scalar s and returns resulting vector. If scalar is zero, returns zero.
func (*Vec2i) FromArray ¶
FromArray sets this vector's components from the specified array and offset.
func (Vec2i) Mul ¶
Mul multiplies each component of this vector by the corresponding one from other and returns resulting vector.
func (Vec2i) MulScalar ¶
MulScalar multiplies each component of this vector by the scalar s and returns resulting vector.
func (*Vec2i) SetAddScalar ¶
SetAddScalar sets this to addition with scalar.
func (*Vec2i) SetByName ¶
SetByName sets this vector component value by its case insensitive name: "x" or "y".
func (*Vec2i) SetDivScalar ¶
SetDivScalar sets this to division by scalar.
func (*Vec2i) SetMax ¶
SetMax sets this vector components to the maximum value of itself and other vector.
func (*Vec2i) SetMin ¶
SetMin sets this vector components to the minimum values of itself and other vector.
func (*Vec2i) SetMul ¶
SetMul sets this to multiplication with other vector (i.e., *= or times-equals).
func (*Vec2i) SetMulScalar ¶
SetMulScalar sets this to multiplication by scalar.
func (*Vec2i) SetNegate ¶
func (v *Vec2i) SetNegate()
SetNegate negates each of this vector's components.
func (*Vec2i) SetSub ¶
SetSub sets this to subtraction with other vector (i.e., -= or minus-equals).
func (*Vec2i) SetSubScalar ¶
SetSubScalar sets this to subtraction of scalar.
func (*Vec2i) SetZero ¶
func (v *Vec2i) SetZero()
SetZero sets this vector X and Y components to be zero.
func (Vec2i) SubScalar ¶
SubScalar subtracts scalar s from each component of this vector and returns new vector.