Vector2DMixin :GetXY()
Jump to navigation
Jump to search
- These functions are implemented in
and:GetXY FrameXML/Vector2D.lua FrameXML/Vector3D.lua
.
- These functions are implemented in
Defines and returns a vector's Cartesian coordinates.
x, y = vector:GetXY() x, y, z = vector:GetXYZ() vector:SetXY(x, y) vector:SetXYZ(x, y, z)
Parameters
- x, y, z
- number - Cartesian coordinates.
Details
- Vector2DMixin uses GetXY() and SetXY().
- Vector3DMixin uses GetXYZ() and SetXYZ().
- Despite similarities, these two mixins are not compatible with each other. They must be manually converted or projected by copying coordinate values from one type to another.
Examples
Manually converting a 2D vector to 3D:
local x, y = vector2d:GetXY() local vector3d = CreateFromMixins(Vector3DMixin) vector3d:SetXYZ(x, y, 0)
Manually projecting a 3D vector to 2D:
local x, y, z = vector3d:GetXYZ() local vector2d = CreateFromMixins(Vector2DMixin) vector3d:SetXY(x, y)
See also
- CreateVector2D(x,y) - Creates a new vector and applies SetXY.
- CreateVector3D(x,y,z) - Creates a new vector and applies SetXYZ.
Patch changes
- Patch 7.2.0 (2017-03-28): Added.[1][2]
References
- ^ 2017-03-28, Vector2D.lua, version 7.2.0.23835, near line 65, archived at Townlong-Yak
- ^ 2017-03-28, Vector3D.lua, version 7.2.0.23835, near line 72, archived at Townlong-Yak