Documentation ¶
Overview ¶
Package vecint 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 some use-cases.
Index ¶
- 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) Dim(dim math32.Dims) int
- func (v Vector2i) Div(other Vector2i) Vector2i
- func (v Vector2i) DivScalar(scalar int) Vector2i
- func (v *Vector2i) FromSlice(array []int, offset int)
- 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) SetDim(dim math32.Dims, value int)
- func (v *Vector2i) SetDiv(other Vector2i)
- func (v *Vector2i) SetDivScalar(scalar 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) SetScalar(scalar 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) ToSlice(array []int, offset int)
- func (v Vector2i) ToVector2() math32.Vector2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Vector2i ¶
Vector2i is a 2D vector/point with X and Y int components.
func Vector2iFromVector2Ceil ¶
Vector2iFromVector2Ceil converts from floating point math32.Vector2 vector to int, using ceil
func Vector2iFromVector2Floor ¶
Vector2iFromVector2Floor converts from floating point math32.Vector2 vector to int, using floor
func Vector2iFromVector2Round ¶
Vector2iFromVector2Round converts from floating point math32.Vector2 vector to int, using rounding
func Vector2iScalar ¶
Vector2iScalar returns a new Vector2i with all components set to scalar.
func (Vector2i) Add ¶
Add adds the other given vector to this one and returns the result as a new vector.
func (Vector2i) AddScalar ¶
AddScalar adds scalar s to each component of this vector and returns new vector.
func (*Vector2i) Clamp ¶
Clamp sets this vector's 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) 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) FromSlice ¶
FromSlice sets this vector's components from the given slice, starting at 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) 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) 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 all of the vector's components to zero.
func (Vector2i) SubScalar ¶
SubScalar subtracts scalar s from each component of this vector and returns new vector.