Skip to content

Neighbouring triangles #61

Answered by micycle1
micycle1 asked this question in Q&A
Feb 23, 2021 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

I've gone with building up a map of edges-->triangles during TriangleCollector.visitSimpleTriangles() and then to find neighbours for a given a triangle, querying the map using the dual of each of its edges.

Curiously, I get ABYSMAL performance when putting (edge, triangle) pairs into the map using the IQuadEdge object itself as a key (e.g. map.put(t.getEdgeA(), t);). It would seem as though the objects' hashes are colliding but I'm not sure why this is since when I print the hashcodes they seem to be unique. This may be worth an issue in itself.

Using edges as keys:

Using the hashcode as the key (map.put(t.getEdgeB().hashCode(), t);) results in expected put() performance:

In which case…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@micycle1
Comment options

@gwlucastrig
Comment options

Answer selected by micycle1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants