From 13dfac7905faac21ea98b08a0948104df8411d42 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 1 Nov 2023 20:09:52 -0400 Subject: removed some unused code --- ext/wittle_generator/Panel.h | 101 ------------------------------------------- 1 file changed, 101 deletions(-) (limited to 'ext') diff --git a/ext/wittle_generator/Panel.h b/ext/wittle_generator/Panel.h index 95832b5..d152370 100644 --- a/ext/wittle_generator/Panel.h +++ b/ext/wittle_generator/Panel.h @@ -340,107 +340,6 @@ class Panel { int get_parity() { return (get_num_grid_points() + 1) % 2; } private: - std::pair loc_to_xy(int location) { - int height2 = (_height - 1) / 2; - int width2 = (_width + 1) / 2; - - int x = 2 * (location % width2); - int y = 2 * (height2 - location / width2); - return {x, y}; - } - - int xy_to_loc(int x, int y) { - int height2 = (_height - 1) / 2; - int width2 = (_width + 1) / 2; - - int rowsFromBottom = height2 - y / 2; - return rowsFromBottom * width2 + x / 2; - } - - std::pair dloc_to_xy(int location) { - int height2 = (_height - 3) / 2; - int width2 = _width / 2; - - int x = 2 * (location % width2) + 1; - int y = 2 * (height2 - location / width2) + 1; - return {x, y}; - } - - int xy_to_dloc(int x, int y) { - int height2 = (_height - 3) / 2; - int width2 = _width / 2; - - int rowsFromBottom = height2 - (y - 1) / 2; - return rowsFromBottom * width2 + (x - 1) / 2; - } - - int locate_segment(int x, int y, std::vector& connections_a, - std::vector& connections_b) { - for (int i = 0; i < connections_a.size(); i++) { - std::pair coord1 = loc_to_xy(connections_a[i]); - std::pair coord2 = loc_to_xy(connections_b[i]); - int x1 = coord1.first, y1 = coord1.second, x2 = coord2.first, - y2 = coord2.second; - if ((x1 == x - 1 && x2 == x + 1 && y1 == y && y2 == y) || - (y1 == y - 1 && y2 == y + 1 && x1 == x && x2 == x)) { - return i; - } - } - return -1; - } - - bool break_segment(int x, int y, std::vector& connections_a, - std::vector& connections_b, - std::vector& intersections, - std::vector& intersectionFlags) { - int i = locate_segment(x, y, connections_a, connections_b); - if (i == -1) { - return false; - } - int other_connection = connections_b[i]; - connections_b[i] = static_cast(intersectionFlags.size()); - connections_a.push_back(static_cast(intersectionFlags.size())); - connections_b.push_back(other_connection); - intersections.push_back(static_cast(minx + x * unitWidth)); - intersections.push_back( - static_cast(miny + (_height - 1 - y) * unitHeight)); - intersectionFlags.push_back(_grid[x][y]); - return true; - } - - bool break_segment_gap(int x, int y, std::vector& connections_a, - std::vector& connections_b, - std::vector& intersections, - std::vector& intersectionFlags) { - int i = locate_segment(x, y, connections_a, connections_b); - if (i == -1) { - return false; - } - int other_connection = connections_b[i]; - connections_b[i] = static_cast(intersectionFlags.size() + 1); - connections_a.push_back(other_connection); - connections_b.push_back(static_cast(intersectionFlags.size())); - if (!(_grid[x][y] & IntersectionFlags::GAP)) { - _grid[x][y] |= - (x % 2 == 0 ? IntersectionFlags::COLUMN : IntersectionFlags::ROW); - connections_a.push_back(static_cast(intersectionFlags.size())); - connections_b.push_back(static_cast(intersectionFlags.size() + 1)); - } - double xOffset = _grid[x][y] & IntersectionFlags::ROW ? 0.5 : 0; - double yOffset = _grid[x][y] & IntersectionFlags::COLUMN ? 0.5 : 0; - intersections.push_back( - static_cast(minx + (x + xOffset) * unitWidth)); - intersections.push_back( - static_cast(miny + (_height - 1 - y - yOffset) * unitHeight)); - intersections.push_back( - static_cast(minx + (x - xOffset) * unitWidth)); - intersections.push_back( - static_cast(miny + (_height - 1 - y + yOffset) * unitHeight)); - intersectionFlags.push_back(_grid[x][y]); - intersectionFlags.push_back(_grid[x][y]); - return true; - } - int _width, _height; std::vector> _grid; -- cgit 1.4.1