Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/src/boolean/compare_segments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,19 @@ where
// left and right endpoints. I think in order to properly support self-overlapping
// segments we must return Ordering::Equal if and only if segments are the same
// by identity (the Rc::ptr_eq above).
less_if(se_old_l.contour_id < se_new_l.contour_id)
if se_old_l.contour_id != se_new_l.contour_id {
less_if(se_old_l.contour_id < se_new_l.contour_id)
} else {
let old_raw = Rc::into_raw(se_old_l.clone());
let new_raw = Rc::into_raw(se_new_l.clone());
let res = less_if((old_raw as *const _ as *const ()) > (new_raw as *const _ as *const ()));
unsafe {
Rc::from_raw(old_raw);
Rc::from_raw(new_raw);
}
res

}
} else {
// Fallback to purely temporal-based comparison. Since `less_if` already
// encodes "earlier-is-less" semantics, no comparison is needed.
Expand Down
83 changes: 83 additions & 0 deletions tests/fixtures/generic_test_cases/daef_foo_tri2.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"features": [
{
"geometry": {
"coordinates": [
[
[62.5, 62.5],
[187.5, 187.5],
[237.5, 62.5],
[62.5, 62.5]
],
[
[162.5, 62.5],
[362.5, 187.5],
[362.5, 62.5],
[162.5, 62.5]
]
],
"type": "Polygon"
},
"properties": {},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[0, 240],
[300, 240],
[150, 30],
[0, 240]
]
],
"type": "Polygon"
},
"properties": {},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[
[62.5, 62.5],
[126.78571428571429, 62.5],
[100, 100],
[62.5, 62.5]
]
],
[
[
[173.21428571428572, 62.5],
[181.85483870967744, 74.5967741935484],
[173.21428571428572, 62.5]
]
],
[
[
[187.5, 187.5],
[214.42307692307693, 120.19230769230768],
[300, 240],
[187.5, 187.5]
]
],
[
[
[237.5, 62.5],
[362.5, 62.5],
[362.5, 187.5],
[237.5, 62.5]
]
]
],
"type": "MultiPolygon"
},
"properties": {
"operation": "diff"
},
"type": "Feature"
}
],
"type": "FeatureCollection"
}
43 changes: 43 additions & 0 deletions tests/fixtures/generic_test_cases/daef_holed_tri2.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"features": [
{
"geometry": {
"coordinates": [
[
[0, 0],
[300, 0],
[150, 300],
[0, 0],
[0, 300],
[0, 0]
],
[
[60, 60],
[150, 240],
[240, 60],
[60, 60]
]
],
"type": "Polygon"
},
"properties": {},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[0, 240],
[300, 240],
[150, 30],
[0, 240]
]
],
"type": "Polygon"
},
"properties": {},
"type": "Feature"
}
],
"type": "FeatureCollection"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"features": [
{
"geometry": {
"coordinates": [],
"type": "Polygon"
},
"properties": {},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[
75,
75
],
[
275,
225
],
[
75,
375
],
[
75,
75
]
],
[
[
175,
225
],
[
375,
75
],
[
375,
375
],
[
175,
225
]
]
],
"type": "Polygon"
},
"properties": {},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[
[
75,
75
],
[
275,
225
],
[
75,
375
],
[
75,
75
]
],
[
[
175,
225
],
[
375,
75
],
[
375,
375
],
[
175,
225
]
]
],
[
[]
]
],
"type": "MultiPolygon"
},
"properties": {
"operation": "xor"
},
"type": "Feature"
}
],
"type": "FeatureCollection"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"features": [
{
"geometry": {
"coordinates": [
[
[75, 75],
[275, 225],
[75, 375],
[75, 75]
],
[
[175, 225],
[375, 75],
[375, 375],
[175, 225]
]
],
"type": "Polygon"
},
"properties": {},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
],
"type": "Polygon"
},
"properties": {},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[
[75, 75],
[275, 225],
[75, 375],
[75, 75]
],
[
[175, 225],
[375, 75],
[375, 375],
[175, 225]
]
],
[
[
]
]
],
"type": "MultiPolygon"
},
"properties": {
"operation": "xor"
},
"type": "Feature"
}
],
"type": "FeatureCollection"
}
Loading