-
Notifications
You must be signed in to change notification settings - Fork 468
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
originToDirectedEdges does not return edges in clock-wise/sorted order ? #695
Comments
OpenGL seems to like counter-clock-wise, well as long as it's in clock-wise or counter-clock-wise order then it should be interexchangeable, but not random order: |
H3 edges are given in direction order, which is based internally on IJK axes. They don't go around the cell in order. I believe the sequence is consistent, but there may be some vagaries around icosahedron edges (and of course with pentagons). This snippet from the H3 codebase may be helpful:
I believe that should be the order of edge output as well. |
OK thanks ! I think this will be usefull in two things:
Maybe a new technique can be created where simply "lines/edges" between two points can be backface culled away by pretending they were triangles and determining their clock winding order. Though then the CPU has to do this determination instead of OpenGL, but probably does not cost that much CPU. Could be an adventage to do it per line, it still needs information about wielding order. However I also came up with idea of using normal to detect if it points towards camera or not... theoretically I think this should work... but calculating a correct normal also needs some kind of winding order... So there seem to be two backface culling techniques: one based on winding order of 2D triangles, one based on 3D winding order of 3D triangles using normals... hmmm... However the 3D face normal method might not work well for perspective and wireframes, something I think I noticed as well. This thread seems to be about this as well, not sure, it's a bit vague matter: "Moreover, it is possible to have a triangle with normal pointed away from view direction and yet faced to the camera." Maybe opposite is possible to... towards view direction, but away from camera... It might still be possible to use normals. This document seems to describe the fov which happens for perspective and also a technique which it calls normal masks: " Not sure how usefull or accurate this is, just exploring different implementation options for back face culling to make it better to look at, possibly easier to implement and maybe it allows more shapes, like points, lines to be backface culled and hopefully also somewhat better performance ! ;) For now this document seems to be about polygons only... "proper" backface culling for points or line segments would be nice too. |
I was expecting this function/api:
originToDirectedEdges
to return the edges in sorted order, for example clockwise.
But it does not seem to do that ???
Is there a way to fix this, perhaps compute angles and re-sort the array ? I could use some math help here ! ;) :)
"
Provides all of the directed edges from the current H3Index. edges must be of length 6, and the number of directed edges placed in the array may be less than 6. If this is the case, one of the members of the array will be 0.
"
Later I use this function/api to get the destination H3Index:
getDirectedEdgeDestination
"
Returns the destination hexagon from the unidirectional edge H3Index.
"
Additional notes to describe the problem:
The first api call does not sort the edges in clock-wise order... so it seems to be unsorted... this is a problem when trying to visualize the triangles between the centers.
I want to create a triangle from center of hexagon, to center of neighbour hexagon, and then to next neighbour hexagon.
(So these 3 points for a triangle)
The next neighbour hexagon should be in clock-wise order to get a nice triangle.
Otherwise 180 degree triangles could occur and this looks bad.
The text was updated successfully, but these errors were encountered: