Closed RobWalt closed 1 month ago
Very nice. Also worth having a look at https://github.com/tudelft3d/prepair (cc @hugoledoux) which uses a constrained triangulation approach for further inspiration if you're interested…
Lol that sounds a lot like what I did with SpadeBoolops. Now I wonder if I could just do a single polygon union to achieve the same 😅
Thanks a lot for the link! That's super useful!!
Watch out: the machinery used to achieve what we did is CGAL, which allows us to use a robust constrained Delaunay triangulation where we can intersect constraints and attach attributes to edges and triangles, and etc etc.
A standard triangulation doesn't allow you to do this, although if https://github.com/Stoeoef/spade is used it would be a good basis (I think, I haven't thoroughly tested it).
Since you have GEOS in rust, perhaps it's simpler to translate the algo of ST_MakeValid
(no docs AFAIK, the code is the ultimate docs here...).
I think I overengineered this a bit. I'm not seeing myself finishing it anytime soon, so I'll just gonna close this now. Feel free to pick it up or talk to me about the theoretical side of things
Description
While discouraging the handling of invalid geometries and prioritizing the maintenance of geometric validity as a fundamental principle, it is recognized that geometries may occasionally deviate from perfection. In such instances, we have to deal with checking the geometry and repairing it all on our own. That's why it's time for a trait in
geo
which does the job for us.This pull request introduces a new feature by implementing the
Validify
for the first two candidates: Self intersectingPolygon
s andMultiPolygon
s. The Validity trait serves to repair these invalid geometries by splitting them up into smaller polygons which fulfill the implicit invariants.Changes Made
Validify
traitsplit_into_valid
method on the trait and implement it forPolygon
andMultiPolygon
Usage Example
Testing
Validify
trait and methods used for the first implsDocumentation
Document everything about the
Validify
trait quiet heavily for the afterworld[x] I agree to follow the project's code of conduct.
[ ] I added an entry to
CHANGES.md
if knowledge of this change could be valuable to users.[ ] Usage examples in trait docs