Vector2DMixin

From Wowpedia
Jump to: navigation, search

Source: SharedXML\Vector2D.lua

API

Wowpedia icon stamp.png CreateVector2D(x, y) : vector - Creates a new vector.
Wowpedia icon stamp.png AreVector2DEqual(left, right) : boolean - Compares if vectors are equal.

Methods

Wowpedia icon stamp.png Vector2DMixin:IsEqualTo(vector) : boolean
Wowpedia icon stamp.png Vector2DMixin:GetXY() : x, y
Wowpedia icon stamp.png Vector2DMixin:SetXY(x, y)
Wowpedia icon stamp.png Vector2DMixin:ScaleBy(scalar)
Wowpedia icon stamp.png Vector2DMixin:DivideBy(scalar)
Wowpedia icon stamp.png Vector2DMixin:Add(vector)
Wowpedia icon stamp.png Vector2DMixin:Subtract(vector)
Wowpedia icon stamp.png Vector2DMixin:Cross(vector)
Wowpedia icon stamp.png Vector2DMixin:Dot(vector) : dot
Wowpedia icon stamp.png Vector2DMixin:IsZero() : boolean
Wowpedia icon stamp.png Vector2DMixin:GetLengthSquared() : lengthSquared
Wowpedia icon stamp.png Vector2DMixin:GetLength() : length
Wowpedia icon stamp.png Vector2DMixin:Normalize()
Wowpedia icon stamp.png Vector2DMixin:RotateDirection(rotationRadians)
Wowpedia icon stamp.png Vector2DMixin:Clone() : vector

Example

local foo = CreateVector2D(12, 5)
local bar = CreateVector2D(2, 3)

foo:Add(bar)
print(foo:GetXY()) -- 14, 8

It's also valid to only pass the x and y fields for API functions that would take a Vector2DMixin object.

/dump C_Map.GetWorldPosFromMapPos(37, {x=0.5, y=1})

Patch changes

See also

External links

References

 
  1. ^ 2020-06-08, Vector2D.lua, version 9.0.1.34714, near line 109, archived at Townlong-Yak
  2. ^ 2018-07-16, Vector2D.lua, version 8.0.1.27101, near line 122, archived at Townlong-Yak
  3. ^ 2017-03-28, Vector2D.lua, version 7.2.0.23835, near line 41, archived at Townlong-Yak
  4. ^ 2016-10-25, Vector2D.lua, version 7.1.0.22908, archived at Townlong-Yak