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

Convex Hull of One Point #288

Open
randallwhitman opened this issue Dec 21, 2021 · 3 comments
Open

Convex Hull of One Point #288

randallwhitman opened this issue Dec 21, 2021 · 3 comments

Comments

@randallwhitman
Copy link
Contributor

Expected: non-empty degenerate polygon.
Actual: empty geometry.
Is there a different way I should be calling the convex-hull operator?
Relates SF4H-181.

  private static class OnePointCursor extends GeometryCursor {
    private boolean flag = true;
    OnePointCursor() {}
    public Geometry next() {
      if (flag) {
        flag = false;
        return new Point(1.2, 3.4);
      } else
        return null;
    }
    public int getGeometryID() {
      throw new UnsupportedOperationException();
    }
  }

  @Test
  public static void testOnePoint() {
    GeometryCursor geomCursor = new OnePointCursor();
    GeometryCursor convexResult = OperatorConvexHull.local().execute(geomCursor, true, null);
    Geometry result = convexResult.next();
    System.err.println(result);  // {"rings":[]}
    assertFalse(result.isEmpty());  // junit.framework.AssertionFailedError
  }

cc @JordanMLee

@JordanMLee
Copy link

works for me
image

@stolstov
Copy link
Member

A point polygon, or polygon which is degenerate to a line is not valid for many operations, so I am not sure what would you be able to use it for.
The merge=false version of the operator returns point if convex hull is a point, or a line if convex hull is a line.
The merging version should probably do the same.

@randallwhitman
Copy link
Contributor Author

Btw, I tested with Geometry-2.2.4 ; I believe Jordan tested with something else.

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

3 participants