From eb22ea41613998aecbe651e0584fc0e7958678a0 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Mon, 15 Feb 2021 16:04:26 +0900 Subject: comments, to not confuse my future self. --- .../java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java | 8 ++++---- .../kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java | 2 +- src/main/java/kr/syeyoung/dungeonsguide/utils/VectorUtils.java | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java index 284a9590..76f22f30 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java @@ -33,9 +33,9 @@ public class OffsetPoint implements Cloneable, Serializable { for (int i = 0; i < dungeonRoom.getRoomMatcher().getRotation(); i++) { vector2d = VectorUtils.rotateClockwise(vector2d); if (i % 2 == 0) { - vector2d.x += dungeonRoom.getDungeonRoomInfo().getBlocks().length - 1; + vector2d.x += dungeonRoom.getDungeonRoomInfo().getBlocks().length - 1; // + Z } else { - vector2d.x += dungeonRoom.getDungeonRoomInfo().getBlocks()[0].length - 1; + vector2d.x += dungeonRoom.getDungeonRoomInfo().getBlocks()[0].length - 1; // + X } } @@ -50,9 +50,9 @@ public class OffsetPoint implements Cloneable, Serializable { for (int i = 0; i < dungeonRoom.getRoomMatcher().getRotation(); i++) { rot2 = VectorUtils.rotateCounterClockwise(rot2); if (i % 2 == 0) { - rot2.y += dungeonRoom.getMax().getZ() - dungeonRoom.getMin().getZ() + 1; + rot2.y += dungeonRoom.getMax().getZ() - dungeonRoom.getMin().getZ() + 1; // + Z } else { - rot2.y += dungeonRoom.getMax().getX() - dungeonRoom.getMin().getX() + 1; + rot2.y += dungeonRoom.getMax().getX() - dungeonRoom.getMin().getX() + 1; // + X } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java index d8b7c47b..bf480833 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java @@ -16,7 +16,7 @@ public class RoomMatcher { @Getter private DungeonRoomInfo match; @Getter - private int rotation; // how much the "found room" has to rotate to match the given dungeon room info. ! + private int rotation; // how much the "found room" has to rotate clockwise to match the given dungeon room info. ! private boolean triedMatch = false; private World w; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/VectorUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/VectorUtils.java index 14d3b7c1..9e9244de 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/VectorUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/VectorUtils.java @@ -3,6 +3,9 @@ package kr.syeyoung.dungeonsguide.utils; import javax.vecmath.Vector2d; public class VectorUtils { + // Ior rooms, different coordinate system is used. Y Increses as marker goes down. X is same. + + public static Vector2d rotateCounterClockwise(Vector2d vector2d) { return new Vector2d(vector2d.y, -vector2d.x); } -- cgit