-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow bridges to wrap around corners.
- Loading branch information
Showing
15 changed files
with
3,546 additions
and
2,848 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#define BOOST_TEST_MODULE outline_bridges tests | ||
#include <boost/test/unit_test.hpp> | ||
|
||
#include <vector> | ||
|
||
#include "geometry.hpp" | ||
#include "bg_operators.hpp" | ||
|
||
#include "outline_bridges.hpp" | ||
|
||
using namespace std; | ||
using outline_bridges::makeBridges; | ||
|
||
BOOST_AUTO_TEST_SUITE(outline_bridges_tests) | ||
|
||
BOOST_AUTO_TEST_CASE(box) { | ||
linestring_type_fp path{{0,0}, {0,10}, {10,10}, {10,0}, {0,0}}; | ||
auto ret = makeBridges(path, 4, 2); | ||
|
||
vector<size_t> expected_ret{1,4,7,10}; | ||
linestring_type_fp expected_path{ | ||
{0,0}, | ||
{0,4}, | ||
{0,6}, | ||
{0,10}, | ||
{4,10}, | ||
{6,10}, | ||
{10,10}, | ||
{10,6}, | ||
{10,4}, | ||
{10,0}, | ||
{6,0}, | ||
{4,0}, | ||
{0,0}, | ||
}; | ||
BOOST_CHECK_EQUAL(ret, expected_ret); | ||
BOOST_CHECK_EQUAL(path, expected_path); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE(rectangle) { | ||
linestring_type_fp path{{0,0}, {0,1}, {10,1}, {10,0}, {0,0}}; | ||
auto ret = makeBridges(path, 2, 2); | ||
|
||
vector<size_t> expected_ret{0,1,3,4,5,7,8}; | ||
linestring_type_fp expected_path{ | ||
{0,0}, | ||
{0,1}, | ||
{0.5,1}, | ||
{9.5,1}, | ||
{10,1}, | ||
{10,0}, | ||
{9.5,0}, | ||
{0.5,0}, | ||
{0,0}, | ||
}; | ||
BOOST_CHECK_EQUAL(ret, expected_ret); | ||
BOOST_CHECK_EQUAL(path, expected_path); | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.