Skip to content

Bug in S2PolygonBuilder #4

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. Add the following test to s2polygonbuilder_test.cc:

TEST(S2PolygonBuilder, Basic) {
  std::vector<uint64> cell_ids({1152921504606846976ULL,   
                                3458764513820540928ULL,
                                5764607523034234880ULL,  
                                8070450532247928832ULL,
                                10376293541461622784ULL, 
                                12682136550675316736ULL});
  S2PolygonBuilder builder(S2PolygonBuilderOptions::DIRECTED_XOR());
  for (uint64 val : cell_ids) {
    S2Loop cell_loop{S2Cell(S2CellId(val))};
    builder.AddLoop(&cell_loop);
  }
  S2Polygon polygon;
  ASSERT_TRUE(builder.AssemblePolygon(&polygon, NULL));
  ASSERT_GT(polygon.num_loops(), 0);   // <- fails here
}

The test fails though at it should pass since those s2cells have boundary.
it seems that the builder does not handle properly the adding of edges.

Original issue reported on code.google.com by ro...@ubimo.com on 20 May 2013 at 6:31

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions