locationtech / locationtech/jts
Geometry.buffer with fixed precision removes hole
Open
Nobody has claimed this yet.
type-bug
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 475
- Avg merge
- 14d 10h
- Merged PRs (30d)
- 1
Description
Calling Geometry.buffer(double) on a Polygon with interior ring that was created using a GeometryFactory with a fixed PrecisionModel might remove the interior ring:
public void testBufferRemovesHole() throws ParseException {
GeometryFactory gf = new GeometryFactory(new PrecisionModel(1000));
Geometry geom = new WKTReader(gf).read("POLYGON ((0 0, 0 4, 4 4, 4 0, 2 0, 0 0), (2 0, 3 1, 2 2, 1 1, 2 0))");
assertTrue(geom.isValid());
geom = geom.buffer(0.001);
assertTrue(geom.isValid());
assertEquals(1, ((Polygon)geom).getNumInteriorRing());
}
first reported: https://github.com/NetTopologySuite/NetTopologySuite/issues/638
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied testBufferRemovesHole reproduction and trace the Geometry.buffer(double) entry point through the fixed-precision buffering path. Add the regression test, then verify that buffering the shown polygon preserves one interior ring and produces valid geometry.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100