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

Update order of vertexes, and add closing vertex for Oracle. #142

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

at88mph
Copy link
Member

@at88mph at88mph commented Feb 24, 2023

Ensure Polygon vertices are in counter-clockwise order.
Ensure Polygons are closed before sending to Oracle.

@at88mph
Copy link
Member Author

at88mph commented Feb 28, 2023

I've included a namespace fix for the table reader as well, but it may not be the right way to fix it.

processOrdinateParameters();
}

private void ensureCounterClockwise() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the algorithm here is for a polygon on a flat plane, so is approximate. I don't know what "edgeSum" is but this looks less complex than the code in caom2 which does this by computing the area via triangulation.

Is this calculation going to work in edge cases:

  1. near or includes the pole
  2. overlaps the meridian (longitude=0) so some vertices have longitude near 360 and others near 0
  3. is is larger than half the sphere

It's probably OK to not support #3 (for now), but it should be detected and rejected. 1 and 2 need to be taken into account somehow.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. The sum of the edges indicates a clockwise direction if it's a positive number, and counter-clockwise if it's negative, and assumes a flat plane. I hadn't realized it needed to be more complex than that, thanks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the GrahamScan in CAOM-2 a place to start learning about how to handle those three cases? Is this the "winding" method?

cadc-tap/src/main/java/ca/nrc/cadc/vosi/TableReader.java Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

2 participants