Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Advertisement

Source: FrameXML/Vector2D.lua

API

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

Methods

Wowpedia icon stamp Vector2DMixin:Add(Vector2DMixin) - Translates the vector by another.
Wowpedia icon stamp Vector2DMixin:Clone() - Copies a vector.
Wowpedia icon stamp Vector2DMixin:Cross(Vector2DMixin) - Mimics a 3D cross product, computing its magnitude and then applying this value to the X coordinate.
Wowpedia icon stamp Vector2DMixin:DivideBy(scalar)- Divides each coordinate by a scalar.
Wowpedia icon stamp Vector2DMixin:Dot(Vector2DMixin) - Returns the dot product of the vector with another.
Wowpedia icon stamp Vector2DMixin:GetLength() - Returns the vector's total length or magnitude, independent of direction.
Wowpedia icon stamp Vector2DMixin:GetLengthSquared() - Returns the dot product of the vector with itself.
Wowpedia icon stamp Vector2DMixin:GetXY() - Returns the X and Y coordinates.
Wowpedia icon stamp Vector2DMixin:IsEqualTo(Vector2DMixin) - Compares if a vector is equal.
Wowpedia icon stamp Vector2DMixin:IsZero() - Returns true for the vector (0,0).
Wowpedia icon stamp Vector2DMixin:Normalize() - Divides each coordinate by the vector's total length, producing a unit vector in the same direction.
Wowpedia icon stamp Vector2DMixin:RotateDirection(rotationRadians) - Rotates the vector counter-clockwise by a number of radians.
Wowpedia icon stamp Vector2DMixin:ScaleBy(scalar) - Multiplies each coordinate by a scalar.
Wowpedia icon stamp Vector2DMixin:SetXY(x, y) - Sets the X and Y coordinates.
Wowpedia icon stamp Vector2DMixin:Subtract(Vector2DMixin) - Translates the vector by the opposite of another.

Example

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

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

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
Advertisement