-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathChestIcon.cs
37 lines (31 loc) · 1.19 KB
/
ChestIcon.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using ExileCore.Shared.AtlasHelper;
using SharpDX;
namespace HeistIcons
{
public class ChestIcon
{
public AtlasTexture Texture;
public Color Color = Color.White;
public float Size;
public ChestIcon(AtlasTexture texture, float size, Color color)
: this(texture, size)
{
Color = color;
}
public ChestIcon(AtlasTexture texture, float size)
{
Texture = texture;
Size = size;
}
public static Vector2 DeltaInWorldToMinimapDelta(Vector2 delta, double diag, float scale, float deltaZ = 0)
{
const float CAMERA_ANGLE = 38 * MathUtil.Pi / 180;
// Values according to 40 degree rotation of cartesian coordiantes, still doesn't seem right but closer
var cos = (float)(diag * Math.Cos(CAMERA_ANGLE) / scale);
var sin = (float)(diag * Math.Sin(CAMERA_ANGLE) / scale); // possible to use cos so angle = nearly 45 degrees
// 2D rotation formulas not correct, but it's what appears to work?
return new Vector2((delta.X - delta.Y) * cos, deltaZ - (delta.X + delta.Y) * sin);
}
}
}