Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.
1 to 19 of 19
-- R: sideLength / 2
-- a: angle
-- returns r, distance from center to edge
function distanceToEdge(sideLength, angle)
if angle < 0 then
return distanceToEdge(sideLength, -angle)
end
while angle > math.pi / 4 do -- while angle > 45 degrees
angle = angle - math.pi / 2 -- subtract (rotate) 90 degrees
end
return sideLength / 2 / math.cos(angle)
end
[/pre]
Posted by: Islorgris on May 30 2006, 10:57 PM
sure, figure out how to compute the varying maximum distance (which is the problem using a square minimap) to the edge of the square instead of computing it according to a circle radius.
Posted by: Islorgris on Jun 2 2006, 05:17 AM
the Gatherer_MiniMapPos function you'll have to double the calculation to compute the maximum edge distance for the border with the angle of the mininote from the player position at the center and calculate the real minimap distance so you know with set of coordinates to use.
function Gatherer_MiniMapPos(deltaX, deltaY, scaleX, scaleY) -- works out the distance on the minimap
local mapX = deltaX * scaleX;
local mapY = deltaY * scaleY;
local mapDist = 0;
mapDist = Gatherer_Pythag(mapX, mapY);
if (mapDist >= 57) then
-- Remap it to just inside the minimap, by:converting dx,dy to angle,distance
-- then truncate distance to 58 and convert angle,58 to dx,dy
local flipAxis = 1;
if (mapX == 0) then mapX = 0.0000000001;
elseif (mapX < 0) then flipAxis = -1;
end
local angle = math.atan(mapY / mapX);
mapDist = distanceToEdge(116, angle);
mapX = math.cos(angle) * 58 * flipAxis;
mapY = math.sin(angle) * 58 * flipAxis;
end
return mapX, mapY, mapDist;
end
-- R: sideLength / 2
-- a: angle
-- returns r, distance from center to edge
function distanceToEdge(sideLength, angle)
if angle < 0 then
return distanceToEdge(sideLength, -angle)
end
while angle > math.pi / 4 do -- while angle > 45 degrees
angle = angle - math.pi / 2 -- subtract (rotate) 90 degrees
end
return sideLength / 2 / math.cos(angle)
end
Posted by: Malaphus on Jun 3 2006, 12:54 PM
Why doesn't this work? it seems like the mapDist variable is the only thing that would control where the icons are placed really, so i'm not sure why they are still showing up in a circle.
function Gatherer_MiniMapPos(deltaX, deltaY, scaleX, scaleY) -- works out the distance on the minimap
local mapX = deltaX * scaleX;
local mapY = deltaY * scaleY;
local pointDist = Gatherer_Pythag(mapX, mapY);
local flipAxis = 1;
if (mapX == 0) then mapX = 0.0000000001;
elseif (mapX < 0) then flipAxis = -1;
end
local angle = math.atan(mapY / mapX);
local mapDist = math.min(pointDist, distanceToEdge(116, angle));
if pointDist > mapDist then
mapX = math.cos(angle) * mapDist * flipAxis
mapY = math.sin(angle) * mapDist * flipAxis
end
return mapX, mapY, mapDist;
end
[/pre]
Posted by: Aradan on Jun 3 2006, 01:16 PM
You're still comparing the distance to a constant (58), which in polar coordinates describes a circle. I'd try something like:
[pre][/pre]
function Gatherer_MiniMapPos(deltaX, deltaY, scaleX, scaleY) -- works out the distance on the minimap
local mapX = deltaX * scaleX;
local mapY = deltaY * scaleY;
local pointDist = Gatherer_Pythag(mapX, mapY);
local flipAxis = 1;
if (mapX == 0) then mapX = 0.0000000001;
elseif (mapX < 0) then flipAxis = -1;
end
local angle = math.atan(mapY / mapX);
local mapDist = math.min(pointDist, distanceToEdge(116, angle));
if pointDist > mapDist then
mapX = math.cos(angle) * mapDist * flipAxis
mapY = math.sin(angle) * mapDist * flipAxis
end
return mapX, mapY, mapDist;
end
Posted by: Aradan on Jun 3 2006, 05:16 PM
You're still comparing the distance to a constant (58), which in polar coordinates describes a circle. I'd try something like:
[pre][/pre]
function Gatherer_MiniMapPos(deltaX, deltaY, scaleX, scaleY) -- works out the distance on the minimap
local mapX = deltaX * scaleX;
local mapY = deltaY * scaleY;
local pointDist = Gatherer_Pythag(mapX, mapY);
local flipAxis = 1;
if (mapX == 0) then mapX = 0.0000000001;
elseif (mapX < 0) then flipAxis = -1;
end
local angle = math.atan(mapY / mapX);
local mapDist = math.min(pointDist, distanceToEdge(116, angle));
if pointDist > mapDist then
mapX = math.cos(angle) * mapDist * flipAxis
mapY = math.sin(angle) * mapDist * flipAxis
end
return mapX, mapY, mapDist;
end
Posted by: Blayloc on Jul 8 2006, 08:22 PM
I tired this and I get a " gather.lua:1315 attempt to call global 'distanceToEdge' (a nil value)
Line 1315 is local mapDist = math.min(pointDist, distanceToEdge(116, angle));
I have the same UI as the OP
Posted by: Blayloc on Jul 8 2006, 09:01 PM
Still not lining up correctly...
UI is scaled to 80%.. and with the above 2 codes inserted the icon on the minimap show up to the right about 100 pixels or so.
Any thoughts?
Posted by: Kaeolla on Jul 13 2006, 01:15 AM
Do you have any frame modifiers running to change where the minimap usually goes? I run Discord Frame Modifier to change where my minimap sits and it messes with the locations.
Does anyone have any ideas on how to fix this issue?
Posted by: Kaeolla on Jul 13 2006, 01:15 AM
Do you have any frame modifiers running to change where the minimap usually goes? I run Discord Frame Modifier to change where my minimap sits and it messes with the locations.
Does anyone have any ideas on how to fix this issue?

1 to 19 of 19