union_ of two valid polygons sharing an edge returns empty (argument order dependent)
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Two valid, non-overlapping cartesian polygons that share one edge. union_(a, b) and union_(b, a) should both return one polygon with area(a) + area(b). With union_(b, a) the result is empty on all versions I tried, including develop.
The vertices of a along the shared side are nearly collinear (the shared edge lies on a line through three of them). The data comes from a land cover coverage after ST_CoverageSimplify (GEOS); GEOS computes the union correctly.
#include <boost/geometry.hpp>
#include <iostream>
namespace bg = boost::geometry;
typedef bg::model::d2::point_xy<double> Point;
typedef bg::model::polygon<Point> Polygon;
typedef bg::model::multi_polygon<Polygon> MultiPolygon;
int main() {
MultiPolygon a, b, u1, u2;
bg::read_wkt("MULTIPOLYGON(((7.5766965679702691 55.1955384390566266,7.5769710638206007 55.1955418668735760,"
"7.5776907371234223 55.1955508539257096,7.5777041477885838 55.1955510213938609,"
"7.5724506758568699 55.1833987553893692,7.5766965679702691 55.1955384390566266)))", a);
bg::read_wkt("MULTIPOLYGON(((7.5776907371234223 55.1955508539257096,7.5769710638206007 55.1955418668735760,"
"7.5786734102424926 55.1979584470965179,7.5776907371234223 55.1955508539257096)))", b);
bg::correct(a); bg::correct(b);
bg::union_(a, b, u1);
bg::union_(b, a, u2);
std::cout << "valid " << bg::is_valid(a) << bg::is_valid(b)
<< ", area a+b " << bg::area(a) + bg::area(b)
<< ", union(a,b) " << u1.size() << " polygon(s) area " << bg::area(u1)
<< ", union(b,a) " << u2.size() << " polygon(s) area " << bg::area(u2) << "\n";
}
| Boost.Geometry | union(a, b) | union(b, a) |
|---|---|---|
| 1.83 | 1 polygon, area of a only (b dropped) |
empty |
1.83 with BOOST_GEOMETRY_USE_RESCALING |
correct | correct |
| 1.87 | b dropped |
empty |
| 1.89, 1.92 | correct | empty |
| develop (fd21a751b2, 2026-11-04) | correct | empty |
Expected area: 6.951063106e-06 (a: 6.089138509e-06, b: 8.619245973e-07, intersection area 0).
Compiled with g++ 14.2, -O2 -std=c++17 (newer versions: Boost.Geometry and Boost.Core headers of that tag, rest of Boost 1.83).
Context: tilemaker combines adjacent polygons of the same class with union_ (binary reduction). On a land cover coverage this drops whole polygons; on OpenStreetMap land use data it happens rarely (2 cases in an extract of Denmark).
- Ngôn ngữ chính
- C++
- Star
- 519
- Fork
- 241
- Merge trung bình
- 4 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của boostorg/geometry
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 57/100
boostorg/geometry#1523 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
LLM generated regression case in differenceCó thể đã có người làm @barendgehrels đã nhận 11 ngày trước. Đang mởbug
boostorg/geometry#1511 · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
difference() produces invalid (self-intersecting) result for valid polygon-with-hole inputCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
boostorg/geometry#1490 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
boostorg/geometry#1476 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
I cannot get Dissolve to compile in version 1.91Có thể làm lại được @barendgehrels đã nhận 160 ngày trước và không có pull request nào đang mở. Đang mở
boostorg/geometry#1472 · 8 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của boostorg/geometry
Issue tương tự
-
agent:WSL code-review linux pri:medium refactoring
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
kind/enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
psi29a/d2decomped#691 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
CachyOS/packageinstaller#144 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
(S1 - Need confirmation)
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
CleverRaven/Cataclysm-DDA#89715 ·
Maintainer thường phản hồi trong vòng 1 ngày