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

Method findPoint

filters/private/hexer/H3grid.cpp:53–72  ·  view source on GitHub ↗

Returns the second endpoint in a segment to be used as a hexagon's vertex

Source from the content-addressed store, hash-verified

51
52// Returns the second endpoint in a segment to be used as a hexagon's vertex
53Point H3Grid::findPoint(Segment& s)
54{
55 DirEdge dir_edge;
56 if (PDALH3cellsToDirectedEdge(ij2h3(s.hex), ij2h3(edgeHex(s.hex, s.edge)), &dir_edge) != E_SUCCESS) {
57 std::ostringstream oss;
58 oss << "Can't get directed edge between hexagons (" << s.hex.i <<
59 ", " << s.hex.j <<") and (" << edgeHex(s.hex, s.edge).i <<", " <<
60 edgeHex(s.hex, s.edge).j << ").";
61 throw hexer_error(oss.str());
62 }
63
64 CellBoundary edge_bound;
65
66 if (PDALH3directedEdgeToBoundary(dir_edge, &edge_bound) != E_SUCCESS)
67 throw hexer_error("unable to get cell boundary from directed edge!");
68 double x = PDALH3radsToDegs(edge_bound.verts[1].lng);
69 double y = PDALH3radsToDegs(edge_bound.verts[1].lat);
70
71 return Point{x, y};
72}
73
74HexId H3Grid::edgeHex(HexId hex, int edge) const
75{

Callers 1

collectHexagonFunction · 0.45

Calls 3

hexer_errorClass · 0.85
strMethod · 0.80
ij2h3Function · 0.70

Tested by

no test coverage detected