test/plane_partitioner_test.cpp
// Verify that the edge_first_coincident is not changed if it is already
// non-null.
Verify that the edge_first_coincident is not changed if it is already
non-null.
Verify that the edge_first_coincident is not changed if it is already non - null .
TEST(PlanePartitioner, NoResplit) {
  PlanePartitioner<BSPPolygon<>> partitioner;
  std::vector<BSPPolygon<>> input{
    MakeRectangle(0, 0, 0, 2, 2),
  };
  CollectorVisitor<BSPPolygon<>, PolygonFilter> visitor1(PolygonFilter(0));
  std::vector<BSPContentInfo> content_info{
    BSPContentInfo{false,
                   true, 0},
  };
  partitioner.Run(input.begin(), input.end(), 2,
                  true, content_info, visitor1);
  ASSERT_THAT(visitor1.polygons(), ElementsAre(input[0]));
  CollectorVisitor<BSPPolygon<>, PolygonFilter> visitor2(PolygonFilter(0));
  partitioner.Run(visitor1.polygons().begin(), visitor1.polygons().end(),
                  2, true, content_info,
                  visitor2);
  ASSERT_EQ(visitor2.polygons().size(), 1);
  const BSPPolygon<>& visitor1_polygon = visitor1.polygons()[0];
  const BSPPolygon<>& visitor2_polygon = visitor2.polygons()[0];
  ASSERT_EQ(visitor1_polygon, visitor2_polygon);
  for (size_t i = 0; i < visitor1_polygon.vertex_count(); ++i) {
    EXPECT_EQ(visitor2_polygon.edge(i).edge_first_coincident.split,
              visitor1_polygon.edge(i).edge_first_coincident.split);
  }
}
TEST ( PlanePartitioner , NoResplit ) { PlanePartitioner < BSPPolygon < > > partitioner ; std :: vector < BSPPolygon < > > input { MakeRectangle ( 0 , 0 , 0 , 2 , 2 ) , } ; CollectorVisitor < BSPPolygon < > , PolygonFilter > visitor1 ( PolygonFilter ( 0 ) ) ; std :: vector < BSPContentInfo > content_info { BSPContentInfo { false , true , 0 } , } ; partitioner . Run ( input . begin ( ) , input . end ( ) , 2 , true , content_info , visitor1 ) ; ASSERT_THAT ( visitor1 . polygons ( ) , ElementsAre ( input [ 0 ] ) ) ; CollectorVisitor < BSPPolygon < > , PolygonFilter > visitor2 ( PolygonFilter ( 0 ) ) ; partitioner . Run ( visitor1 . polygons ( ) . begin ( ) , visitor1 . polygons ( ) . end ( ) , 2 , true , content_info , visitor2 ) ; ASSERT_EQ ( visitor2 . polygons ( ) . size ( ) , 1 ) ; const BSPPolygon < > & visitor1_polygon = visitor1 . polygons ( ) [ 0 ] ; const BSPPolygon < > & visitor2_polygon = visitor2 . polygons ( ) [ 0 ] ; ASSERT_EQ ( visitor1_polygon , visitor2_polygon ) ; for ( size_t i = 0 ; i < visitor1_polygon . vertex_count ( ) ; ++ i ) { EXPECT_EQ ( visitor2_polygon . edge ( i ) . edge_first_coincident . split , visitor1_polygon . edge ( i ) . edge_first_coincident . split ) ; } }
Verify that the edge_first_coincident is not changed if it is already
non-null.
Verify that the edge_first_coincident is not changed if it is already non - null .
/*id=*/ /*minx=*/ /*miny=*/ /*maxx=*/ /*maxy=*/ /*has_interior_polygons=*/ /*has_border_polygons=*/ /*pwn=*/ /*drop_dimension=*/ /*pos_normal=*/ /*drop_dimension=*/ /*pos_normal=*/