Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need enhancement to handle defective polygon constraints #56

Open
gwlucastrig opened this issue Jan 9, 2021 · 6 comments
Open

Need enhancement to handle defective polygon constraints #56

gwlucastrig opened this issue Jan 9, 2021 · 6 comments

Comments

@gwlucastrig
Copy link
Owner

The LogoCDT demonstration application uses Java fonts to provide polygons for rendering constrained Delaunay triangulations. The original implementation was developed using Java 8 and used the font "Arial Black", Bold, 72 pt. However, when running tests in preparation for the 2.1.5 release, we discovered that the CDT was failing. The problem was due to the way more recent versions of Java handled that font specification.

The picture below illustrates the problem. In Java 11, the lowercase letter "a" is formed so that the upper part of the letter touches the lower loop. This geometry violates the requirement that polygon constraints must not intersect themselves. Thus the constraint formed from the letter a is not valid.

This issue requests an enhancement to the current Tinfour API's capabilities for detecting problematic geometries. In the present implementation, some bad geometries can slip through the test procedures.

In the mean time, the LogoCDT module will be modified to use the font "Arial Black", Plain, 72 pt.

ConstrainedPolygonDefect

@mlthlschr
Copy link

Maybe an idea could be to add a geometry validation with JTS. This validation logic would not be part of the core package but of a different one, e.g. utils. One could use the package, in case the validity can not be guaranteed, or omit the package entirely if the validity of the geometries can be guaranteed.

With that, you could keep the core package clean of external dependencies, but would offer some convenience functions for others who do not mind having some additional dependencies.

@gwlucastrig
Copy link
Owner Author

That's a good idea. And I'm pleased to see that you addressed the dependency issues. Also, I think JTS is a perfect choice for the task.

@micycle1
Copy link
Contributor

micycle1 commented May 13, 2021

Sounds like IsSimpleOp?

A Geometry is simple if and only if the only self-intersections are at boundary points.

Another idea: rather than using such a technique to reject inputs (validation logic), perhaps degenerate polygon constraints could be fixed with JTS' new GeometryFixer (see here) and then processed. Alternatively, I believe .buffer(0) is a simple solution to fix problems like the one in this issue.

@gwlucastrig
Copy link
Owner Author

Thanks. I just read Martin Davis' discussion from the link you provided for Fixing Invalid Geometry with HTS It's great to see that they provide that function, since I've needed something like it more times than I can count.

While I wouldn't want to give Tinfour an additional external dependency on JTS, most of the applications I've written that use Tinfour also happen to use JTS. So it would be a good fit.

@nicolas-f
Copy link

Hi,
Maybe its the same issue. I've prepared a specific unit test for this here:

https://github.com/nicolas-f/Tinfour/blob/issue_constraint/core/src/test/java/org/tinfour/utils/TriangleRegressionConstraintTest.java

@gwlucastrig
Copy link
Owner Author

Thanks. I will look at this and incorporate it into the test suite this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants