Skip to content

Commit

Permalink
maybe fix stderr references
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Jul 28, 2024
1 parent b287069 commit edd14a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
16 changes: 9 additions & 7 deletions src/s2/s2boolean_operation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
// - GraphEdgeClipper: a helper class that does the actual work of the
// EdgeClippingLayer.

#include "cpp-compat.h"

#include "s2/s2boolean_operation.h"

#include <cfloat>
Expand Down Expand Up @@ -425,8 +427,8 @@ void GraphEdgeClipper::Run() {
}
--i;
if (s2builder_verbose) {
std::cout << "input edge " << a_input_id << " (inside=" << inside << "):";
for (VertexId id : a_vertices) std::cout << " " << id;
cpp_compat_cout << "input edge " << a_input_id << " (inside=" << inside << "):";
for (VertexId id : a_vertices) cpp_compat_cout << " " << id;
}
// Now for each B edge chain, decide which vertex of the A chain it
// crosses, and keep track of the number of signed crossings at each A
Expand Down Expand Up @@ -454,12 +456,12 @@ void GraphEdgeClipper::Run() {
left_to_right);
if (a_index >= 0) {
if (s2builder_verbose) {
std::cout << std::endl << " " << "b input edge "
cpp_compat_cout << std::endl << " " << "b input edge "
<< b_input_edges[bi].input_id() << " (l2r=" << left_to_right
<< ", crossing=" << a_vertices[a_index] << ")";
for (const auto& x : b_edges[bi]) {
const Graph::Edge& e = g_.edge(x.id);
std::cout << " (" << e.first << ", " << e.second << ")";
cpp_compat_cout << " (" << e.first << ", " << e.second << ")";
}
}
// Keep track of the number of signed crossings (see above).
Expand All @@ -475,7 +477,7 @@ void GraphEdgeClipper::Run() {
S2_LOG(ERROR) << "Failed to get crossed vertex index.";
}
}
if (s2builder_verbose) std::cout << std::endl;
if (s2builder_verbose) cpp_compat_cout << std::endl;

// Finally, we iterate through the A edge chain, keeping track of the
// number of signed crossings as we go along. The "multiplicity" is
Expand Down Expand Up @@ -802,9 +804,9 @@ void EdgeClippingLayer::Build(const Graph& g, S2Error* error) {
GraphEdgeClipper(g, input_dimensions_, input_crossings_,
&new_edges, &new_input_edge_ids).Run();
if (s2builder_verbose) {
std::cout << "Edges after clipping: " << std::endl;
cpp_compat_cout << "Edges after clipping: " << std::endl;
for (size_t i = 0; i < new_edges.size(); ++i) {
std::cout << " " << new_input_edge_ids[i] << " (" << new_edges[i].first
cpp_compat_cout << " " << new_input_edge_ids[i] << " (" << new_edges[i].first
<< ", " << new_edges[i].second << ")" << std::endl;
}
}
Expand Down
12 changes: 7 additions & 5 deletions src/s2/s2builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
// Otherwise all layers are processed independently. For example, sibling
// edge pairs can only cancel each other within a single layer (if desired).

#include "cpp-compat.h"

#include "s2/s2builder.h"

#include <cstddef>
Expand Down Expand Up @@ -826,7 +828,7 @@ void S2Builder::CollectSiteEdges(const S2PointIndex<SiteId>& site_index) {
const S2Point& v0 = input_vertices_[edge.first];
const S2Point& v1 = input_vertices_[edge.second];
if (s2builder_verbose) {
std::cout << "S2Polyline: " << s2textformat::ToString(v0)
cpp_compat_cout << "S2Polyline: " << s2textformat::ToString(v0)
<< ", " << s2textformat::ToString(v1) << "\n";
}
S2ClosestPointQueryEdgeTarget target(v0, v1);
Expand Down Expand Up @@ -1252,9 +1254,9 @@ void S2Builder::SnapEdge(InputEdgeId e, vector<SiteId>* chain) const {
}
}
if (s2builder_verbose) {
std::cout << "(" << edge.first << "," << edge.second << "): ";
for (SiteId id : *chain) std::cout << id << " ";
std::cout << std::endl;
cpp_compat_cout << "(" << edge.first << "," << edge.second << "): ";
for (SiteId id : *chain) cpp_compat_cout << id << " ";
cpp_compat_cout << std::endl;
}
}

Expand Down Expand Up @@ -1330,7 +1332,7 @@ static void DumpEdges(const vector<S2Builder::Graph::Edge>& edges,
vector<S2Point> v;
v.push_back(vertices[e.first]);
v.push_back(vertices[e.second]);
std::cout << "S2Polyline: " << s2textformat::ToString(v)
cpp_compat_cout << "S2Polyline: " << s2textformat::ToString(v)
<< "(" << e.first << "," << e.second << ")" << std::endl;
}
}
Expand Down

0 comments on commit edd14a3

Please sign in to comment.