S2ClosestEdgeQuery returns Result.edge_id() == -1

13 views
Skip to first unread message

Timothy Yau

unread,
Nov 11, 2022, 2:56:39 PM11/11/22
to s2geometry-io
Hi all,

I've run into some unexpected behavior of S2ClosestEdgeQuery, where certain queries return a Result with edge_id() == -1. I've reproduced the issue in a test here, and this is an example run showing the problem: http://sponge2/f554f805-0ebb-4389-89f8-a7dddcf8dd69

This seems like a bug to me, but I couldn't find a Buganizer component for the C++ S2 library. Does anyone know I might get this investigated and fixed?

Timothy

Eric Engle

unread,
Nov 11, 2022, 3:43:43 PM11/11/22
to Timothy Yau, s2geometry-io
The edge_id==-1 case occurs when the result represents the interior of the shape, in which case there is no edge ID per se, but the other Result fields are still useful. See Result::is_interior for more about this and a more readable method for your code to handle this case.

Kind regards,

- Eric

--
You received this message because you are subscribed to the Google Groups "s2geometry-io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to s2geometry-i...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/s2geometry-io/3e75bc3d-5932-468f-9e25-4a0f6a3a1630n%40googlegroups.com.

Timothy Yau

unread,
Nov 11, 2022, 4:55:17 PM11/11/22
to s2geometry-io
Thanks for the clarification! I'll use Result::is_interior to filter out the non-edges, as I'm looking for edges only.

Timothy

Reply all
Reply to author
Forward
0 new messages