Tag: WoW API docs |
m (→Example) Tag: WoW API docs |
||
(6 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
<font size="3">Source: [https://www.townlong-yak.com/framexml/live/Vector2D.lua SharedXML\Vector2D.lua]</font> |
<font size="3">Source: [https://www.townlong-yak.com/framexml/live/Vector2D.lua SharedXML\Vector2D.lua]</font> |
||
− | == |
+ | ==API== |
− | : [[File:Wowpedia_icon_stamp.png|12px|link=API_CreateVector2D]] [https://www.townlong-yak.com/framexml/live/go/CreateVector2D CreateVector2D](<span style="font-size:smaller; color:#ecbc2a">x, y</span>) - Creates a new vector. |
+ | : [[File:Wowpedia_icon_stamp.png|12px|link=API_CreateVector2D]] [https://www.townlong-yak.com/framexml/live/go/CreateVector2D CreateVector2D](<span style="font-size:smaller; color:#ecbc2a">x, y</span>) : <span style="font-size:smaller; color:#4ec9b0">vector</span> - Creates a new vector. |
− | : [[File:Wowpedia_icon_stamp.png|12px|link=API_AreVector2DEqual]] [https://www.townlong-yak.com/framexml/live/go/AreVector2DEqual AreVector2DEqual](<span style="font-size:smaller; color:#ecbc2a">left, right</span>) - Compares if vectors are equal. |
+ | : [[File:Wowpedia_icon_stamp.png|12px|link=API_AreVector2DEqual]] [https://www.townlong-yak.com/framexml/live/go/AreVector2DEqual AreVector2DEqual](<span style="font-size:smaller; color:#ecbc2a">left, right</span>) : <span style="font-size:smaller; color:#4ec9b0">''boolean''</span> - Compares if vectors are equal. |
− | == |
+ | ===Methods=== |
− | : [[File:Wowpedia_icon_stamp.png|12px|link= |
+ | : [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_IsEqualTo]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:IsEqualTo Vector2DMixin:IsEqualTo](<span style="font-size:smaller; color:#ecbc2a">vector</span>) : <span style="font-size:smaller; color:#4ec9b0">''boolean''</span> |
− | : [[File:Wowpedia_icon_stamp.png|12px|link= |
+ | : [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_GetXY]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:GetXY Vector2DMixin:GetXY](<span style="font-size:smaller; color:#ecbc2a"></span>) : <span style="font-size:smaller; color:#4ec9b0">x, y</span> |
− | : [[File:Wowpedia_icon_stamp.png|12px|link= |
+ | : [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_SetXY]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:SetXY Vector2DMixin:SetXY](<span style="font-size:smaller; color:#ecbc2a">x, y</span>) |
⚫ | |||
: [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_DivideBy]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:DivideBy Vector2DMixin:DivideBy](<span style="font-size:smaller; color:#ecbc2a">scalar</span>) |
: [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_DivideBy]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:DivideBy Vector2DMixin:DivideBy](<span style="font-size:smaller; color:#ecbc2a">scalar</span>) |
||
− | : [[File:Wowpedia_icon_stamp.png|12px|link= |
+ | : [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_Add]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:Add Vector2DMixin:Add](<span style="font-size:smaller; color:#ecbc2a">vector</span>) |
− | : [[File:Wowpedia_icon_stamp.png|12px|link= |
+ | : [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_Subtract]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:Subtract Vector2DMixin:Subtract](<span style="font-size:smaller; color:#ecbc2a">vector</span>) |
− | : [[File:Wowpedia_icon_stamp.png|12px|link= |
+ | : [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_Cross]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:Cross Vector2DMixin:Cross](<span style="font-size:smaller; color:#ecbc2a">vector</span>) |
− | : [[File:Wowpedia_icon_stamp.png|12px|link= |
+ | : [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_Dot]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:Dot Vector2DMixin:Dot](<span style="font-size:smaller; color:#ecbc2a">vector</span>) : <span style="font-size:smaller; color:#4ec9b0">dot</span> |
− | : [[File:Wowpedia_icon_stamp.png|12px|link= |
+ | : [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_IsZero]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:IsZero Vector2DMixin:IsZero](<span style="font-size:smaller; color:#ecbc2a"></span>) : <span style="font-size:smaller; color:#4ec9b0">''boolean''</span> |
− | : [[File:Wowpedia_icon_stamp.png|12px|link= |
+ | : [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_GetLengthSquared]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:GetLengthSquared Vector2DMixin:GetLengthSquared](<span style="font-size:smaller; color:#ecbc2a"></span>) : <span style="font-size:smaller; color:#4ec9b0">lengthSquared</span> |
⚫ | |||
: [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_Normalize]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:Normalize Vector2DMixin:Normalize](<span style="font-size:smaller; color:#ecbc2a"></span>) |
: [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_Normalize]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:Normalize Vector2DMixin:Normalize](<span style="font-size:smaller; color:#ecbc2a"></span>) |
||
: [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_RotateDirection]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:RotateDirection Vector2DMixin:RotateDirection](<span style="font-size:smaller; color:#ecbc2a">rotationRadians</span>) |
: [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_RotateDirection]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:RotateDirection Vector2DMixin:RotateDirection](<span style="font-size:smaller; color:#ecbc2a">rotationRadians</span>) |
||
− | : [[File:Wowpedia_icon_stamp.png|12px|link= |
+ | : [[File:Wowpedia_icon_stamp.png|12px|link=API_Vector2DMixin_Clone]] [https://www.townlong-yak.com/framexml/live/go/Vector2DMixin:Clone Vector2DMixin:Clone](<span style="font-size:smaller; color:#ecbc2a"></span>) : <span style="font-size:smaller; color:#4ec9b0">vector</span> |
⚫ | |||
⚫ | |||
− | == |
+ | ==Example== |
<syntaxhighlight lang="lua"> |
<syntaxhighlight lang="lua"> |
||
local foo = CreateVector2D(12, 5) |
local foo = CreateVector2D(12, 5) |
||
Line 32: | Line 32: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
+ | It's also valid to only pass the <code>x</code> and <code>y</code> fields for API functions that would take a Vector2DMixin object. |
||
⚫ | |||
+ | <syntaxhighlight lang="lua"> |
||
+ | /dump C_Map.GetWorldPosFromMapPos(37, {x=0.5, y=1}) |
||
+ | </syntaxhighlight> |
||
+ | |||
⚫ | |||
* {{Patch 9.0.1|note=Added IsZero() method.<ref>{{ref FrameXML|Vector2D.lua|9.0.1|34714|109|20200608}}</ref>}} |
* {{Patch 9.0.1|note=Added IsZero() method.<ref>{{ref FrameXML|Vector2D.lua|9.0.1|34714|109|20200608}}</ref>}} |
||
* {{Patch 8.0.1|note=Added RotateDirection() method.<ref>{{ref FrameXML|Vector2D.lua|8.0.1|27101|122|20180716}}</ref>}} |
* {{Patch 8.0.1|note=Added RotateDirection() method.<ref>{{ref FrameXML|Vector2D.lua|8.0.1|27101|122|20180716}}</ref>}} |
Revision as of 20:15, 10 June 2021
Source: SharedXML\Vector2D.lua
API
- CreateVector2D(x, y) : vector - Creates a new vector.
- AreVector2DEqual(left, right) : boolean - Compares if vectors are equal.
Methods
- Vector2DMixin:IsEqualTo(vector) : boolean
- Vector2DMixin:GetXY() : x, y
- Vector2DMixin:SetXY(x, y)
- Vector2DMixin:ScaleBy(scalar)
- Vector2DMixin:DivideBy(scalar)
- Vector2DMixin:Add(vector)
- Vector2DMixin:Subtract(vector)
- Vector2DMixin:Cross(vector)
- Vector2DMixin:Dot(vector) : dot
- Vector2DMixin:IsZero() : boolean
- Vector2DMixin:GetLengthSquared() : lengthSquared
- Vector2DMixin:GetLength() : length
- Vector2DMixin:Normalize()
- Vector2DMixin:RotateDirection(rotationRadians)
- 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
- Patch 9.0.1 (2020-10-13): Added IsZero() method.[1]
- Patch 8.0.1 (2018-07-17): Added RotateDirection() method.[2]
- Patch 7.2.0 (2017-03-28): Added.[3]
- Patch 7.1.0 (2016-10-25): Vector2D.lua introduced, but without Vector2DMixin.[4]
See also
External links
- GitHub FrameXML, Gethe
- Globe "wut?" Tool, Townlong-Yak
References
- ^ 2020-06-08, Vector2D.lua, version 9.0.1.34714, near line 109, archived at Townlong-Yak
- ^ 2018-07-16, Vector2D.lua, version 8.0.1.27101, near line 122, archived at Townlong-Yak
- ^ 2017-03-28, Vector2D.lua, version 7.2.0.23835, near line 41, archived at Townlong-Yak
- ^ 2016-10-25, Vector2D.lua, version 7.1.0.22908, archived at Townlong-Yak