Skip to content

Commit

Permalink
use fast sweep skip for box id generation, cutouts for areas >= 100 a…
Browse files Browse the repository at this point in the history
…nchor points
  • Loading branch information
patrickbr committed May 14, 2024
1 parent 618d8f5 commit 337c7ac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
11 changes: 2 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,9 @@ enable_testing()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/build")

find_package(OpenMP)

# set compiler flags, see http://stackoverflow.com/questions/7724569/debug-vs-release-in-cmake
set(CMAKE_CXX_FLAGS "-march=native -Ofast -fno-signed-zeros -fno-trapping-math -Wall -Wno-format-extra-args -Wextra -Wformat-nonliteral -Wformat-security -Wformat=2 -Wextra -Wno-implicit-fallthrough -Wno-narrowing -pedantic")
set(CMAKE_C_FLAGS "-march=native -Ofast -fno-signed-zeros -fno-trapping-math -Wall -Wno-format-extra-args -Wextra -Wformat-nonliteral -Wformat-security -Wformat=2 -Wextra -Wno-implicit-fallthrough -Wno-narrowing -pedantic")

if (OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
set(CMAKE_CXX_FLAGS "-march=native -Ofast -ffast-math -fno-signed-zeros -fno-trapping-math -Wall -Wno-format-extra-args -Wextra -Wformat-nonliteral -Wformat-security -Wformat=2 -Wextra -Wno-implicit-fallthrough -Wno-narrowing -pedantic")
set(CMAKE_C_FLAGS "-march=native -Ofast -ffast-math -fno-signed-zeros -fno-trapping-math -Wall -Wno-format-extra-args -Wextra -Wformat-nonliteral -Wformat-security -Wformat=2 -Wextra -Wno-implicit-fallthrough -Wno-narrowing -pedantic")

set(CMAKE_CXX_FLAGS_DEBUG "-Og -g -DLOGLEVEL=3")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DLOGLEVEL=2")
Expand Down
18 changes: 9 additions & 9 deletions src/spatialjoin/Sweeper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ using util::geo::intersectsLineStrict;
using util::geo::LineSegment;
using util::geo::webMercToLatLng;

const static size_t CUTOUTS_MIN_SIZE = 2000;
const static size_t CUTOUTS_MIN_SIZE = 100;
const static size_t OBB_MIN_SIZE = 100;

// _____________________________________________________________________________
Expand Down Expand Up @@ -134,14 +134,6 @@ void Sweeper::add(const I32Polygon& poly, const std::string& gid,
const auto& hull = util::geo::convexHull(poly);
I32XSortedPolygon spoly(poly);

if (!_cfg.useFastSweepSkip) {
spoly.setInnerMaxSegLen(std::numeric_limits<int32_t>::max());
spoly.getOuter().setMaxSegLen(std::numeric_limits<int32_t>::max());
for (auto& inner : spoly.getInners()) {
inner.setMaxSegLen(std::numeric_limits<int32_t>::max());
}
}

double areaSize = area(poly);
double outerAreaSize = outerArea(poly);
BoxIdList boxIds;
Expand All @@ -155,6 +147,14 @@ void Sweeper::add(const I32Polygon& poly, const std::string& gid,
}
}

if (!_cfg.useFastSweepSkip) {
spoly.setInnerMaxSegLen(std::numeric_limits<int32_t>::max());
spoly.getOuter().setMaxSegLen(std::numeric_limits<int32_t>::max());
for (auto& inner : spoly.getInners()) {
inner.setMaxSegLen(std::numeric_limits<int32_t>::max());
}
}

util::geo::I32Polygon obb;
obb = util::geo::convexHull(util::geo::getOrientedEnvelope(poly));

Expand Down
2 changes: 1 addition & 1 deletion src/util
Submodule util updated 2 files
+111 −62 geo/Geo.h
+7 −7 tests/TestMain.cpp

0 comments on commit 337c7ac

Please sign in to comment.