MCPcopy Create free account
hub / github.com/PDAL/PDAL / findShape

Method findShape

filters/private/hexer/BaseGrid.cpp:114–150  ·  view source on GitHub ↗

Walk one contiguous segment of the boundary

Source from the content-addressed store, hash-verified

112
113// Walk one contiguous segment of the boundary
114void BaseGrid::findShape(HexId root)
115{
116 m_paths.push_back(Path(root));
117 Path& path = m_paths.back();
118
119 const Segment first(root, 0);
120 Segment cur(root, 0);
121
122 do {
123 // removes possible roots that are passed over, and sets information
124 // to be used in parentOrChild()
125 if (cur.horizontal())
126 {
127 // all hexagons with non-dense neighbors at edge 0 are possible roots.
128 if (cur.edge == 0)
129 m_possibleRoots.erase(cur.hex);
130
131 // if path is at edge 3, normalize to edge 0 of hex across edge 3
132 // so hexagons can be processed separately in parentOrChild()
133 HexId pathHex = (cur.edge == 0 ? cur.hex : edgeHex(cur.hex, 3));
134 m_hexPaths.insert({pathHex, &path});
135
136 // here we set the minimum I or J coordinate, to be used for finding
137 // parents and children from m_hexPaths
138 setMinCoord(pathHex);
139 }
140 // adds the first point of the segment to the path
141 path.addPoint(findPoint(cur));
142 cur = nextSegment(cur);
143
144 // left.hex: the hexagon we would "walk into" moving clockwise from the
145 // current segment.
146 } while (cur != first);
147
148 // The first point and last point must be the same.
149 path.addPoint(findPoint(cur));
150}
151
152// Determine whether a path is enclosed within another
153void BaseGrid::findParentPaths()

Callers

nothing calls this directly

Calls 6

PathClass · 0.85
horizontalMethod · 0.80
setMinCoordFunction · 0.70
eraseMethod · 0.45
insertMethod · 0.45
addPointMethod · 0.45

Tested by

no test coverage detected