diff --git a/planner/configexport/internal/config.go b/planner/configexport/internal/config.go index ab3e02d..26f198e 100644 --- a/planner/configexport/internal/config.go +++ b/planner/configexport/internal/config.go @@ -4,7 +4,7 @@ import ( "bytes" "fmt" jsonIter "github.com/json-iterator/go" - "github.com/kercylan98/minotaur/utils/g2d/matrix" + "github.com/kercylan98/minotaur/utils/geometry/matrix" "github.com/kercylan98/minotaur/utils/str" "github.com/kercylan98/minotaur/utils/xlsxtool" "github.com/tealeg/xlsx" diff --git a/utils/g2d/physics.go b/utils/g2d/physics.go deleted file mode 100644 index 47754f1..0000000 --- a/utils/g2d/physics.go +++ /dev/null @@ -1,42 +0,0 @@ -package g2d - -// SlideDrop 侧滑掉落特定位置成员 -func SlideDrop[T any](matrix [][]T, x, y int, isStop func(start T, x, y int, data T) bool) (dropX, dropY int) { - width, height := len(matrix), len(matrix[0]) - start := matrix[x][y] - var offsetX, offsetY = -1, 1 - for { - targetX, targetY := x+offsetX, y+offsetY - if targetX < 0 || targetY == height || isStop(start, targetX, targetY, matrix[targetX][targetY]) { - dropX, dropY = targetX+1, targetY-1 - break - } - offsetX-- - offsetY++ - } - offsetX, offsetY = 1, 1 - for dropX != x && dropY != y { - targetX, targetY := x+offsetX, y+offsetY - if targetX == width || targetY == height || isStop(start, targetX, targetY, matrix[targetX][targetY]) { - dropX, dropY = targetX-1, targetY-1 - break - } - offsetX++ - offsetY++ - } - return -} - -// VerticalDrop 垂直掉落特定位置成员 -func VerticalDrop[T any](matrix [][]T, x, y int, isStop func(start T, x, y int, data T) bool) (dropX, dropY int) { - height := len(matrix[0]) - start := matrix[x][y] - var offsetY = 1 - for { - testY := y + offsetY - if testY == height || isStop(start, x, testY, matrix[x][testY]) { - return x, testY - 1 - } - offsetY++ - } -} diff --git a/utils/g2d/dp/distribution_pattern.go b/utils/geometry/dp/distribution_pattern.go similarity index 100% rename from utils/g2d/dp/distribution_pattern.go rename to utils/geometry/dp/distribution_pattern.go diff --git a/utils/g2d/dp/distribution_pattern_test.go b/utils/geometry/dp/distribution_pattern_test.go similarity index 100% rename from utils/g2d/dp/distribution_pattern_test.go rename to utils/geometry/dp/distribution_pattern_test.go diff --git a/utils/g2d/dp/link.go b/utils/geometry/dp/link.go similarity index 100% rename from utils/g2d/dp/link.go rename to utils/geometry/dp/link.go diff --git a/utils/g2d/matrix/matrix.go b/utils/geometry/matrix/matrix.go similarity index 100% rename from utils/g2d/matrix/matrix.go rename to utils/geometry/matrix/matrix.go diff --git a/utils/g2d/path/heap.go b/utils/geometry/path/heap.go similarity index 100% rename from utils/g2d/path/heap.go rename to utils/geometry/path/heap.go diff --git a/utils/g2d/path/landform.go b/utils/geometry/path/landform.go similarity index 100% rename from utils/g2d/path/landform.go rename to utils/geometry/path/landform.go diff --git a/utils/g2d/path/landform_feature.go b/utils/geometry/path/landform_feature.go similarity index 100% rename from utils/g2d/path/landform_feature.go rename to utils/geometry/path/landform_feature.go diff --git a/utils/g2d/path/node.go b/utils/geometry/path/node.go similarity index 100% rename from utils/g2d/path/node.go rename to utils/geometry/path/node.go diff --git a/utils/g2d/path/path.go b/utils/geometry/path/path.go similarity index 100% rename from utils/g2d/path/path.go rename to utils/geometry/path/path.go diff --git a/utils/g2d/path/terrain.go b/utils/geometry/path/terrain.go similarity index 100% rename from utils/g2d/path/terrain.go rename to utils/geometry/path/terrain.go diff --git a/utils/xlsxtool/sheet.go b/utils/xlsxtool/sheet.go index 9c89c36..b9216e2 100644 --- a/utils/xlsxtool/sheet.go +++ b/utils/xlsxtool/sheet.go @@ -1,7 +1,7 @@ package xlsxtool import ( - "github.com/kercylan98/minotaur/utils/g2d/matrix" + "github.com/kercylan98/minotaur/utils/geometry/matrix" "github.com/tealeg/xlsx" )