Skip to content

Commit c564e58

Browse files
GetImagePos
1 parent 1134080 commit c564e58

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

iso_utils.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package maprenderer
22

33
import "math"
44

5-
var tan30 = math.Tan(30 * math.Pi / 180)
6-
var sqrt3div2 = 2 / math.Sqrt(3)
75
var sqrt3 = math.Sqrt(3)
86
var sin30 = math.Sin(30 * math.Pi / 180)
97

@@ -33,12 +31,13 @@ func GetImagePos(rel_pos, size *Pos, size_x, size_y int, cubesize float64) (floa
3331
// floating point coords
3432
cube_x, cube_y := GetIsoCubeSize(cubesize)
3533

36-
x_pos := (float64(rel_pos.X()) * cube_x / 2) +
37-
(float64(rel_pos.Z()) * cube_x / 2)
34+
x_pos := (float64(rel_pos.X()) * cube_x / 2) -
35+
(float64(rel_pos.Z()) * cube_x / 2) + 140
3836

39-
y_pos := (float64(size.Y()-rel_pos.Y()-1) * cube_y / 2) +
40-
(float64(size.X()-rel_pos.X()-1) * cube_y / 2) +
41-
(float64(size.Z()-rel_pos.Z()-1) * cube_y / 2)
37+
y_pos := float64(size_y) -
38+
(float64(rel_pos.Y()) * cube_y / 2) -
39+
(float64(rel_pos.X()) * cube_y / 4) -
40+
(float64(rel_pos.Z()) * cube_y / 4)
4241

4342
return x_pos, y_pos
4443
}

0 commit comments

Comments
 (0)