Skip to content

Conversation

@D0ubleD0uble
Copy link

polygon_winner

Strategy for length heuristic combined with AABB collision detection.

This heuristic specializes to the AoC input generation and doesn't generalize to any input shape generation.

One of the points is always on a massive horizontal distance compared to adjacent points. If the input were rotated 90 degrees, this solution would stop working.

this means we don't need to compare every vertex to every other vertex, we can compare a handful to the others.

This idea can probably be taken further yet.

Strategy for length heuristic combined with AABB collision detection. This heuristic specializes to the AoC input generation and doesn't generalize to any input shape generation. One of the points is always on a massive horizontal distance compared to adjacent points. If the input were rotated 90 degrees, this solution would stop working. this means we don't need to compare every vertex to every other vertex, we can compare a handful to the others. This idea can probably be taken further yet.
crate unused and included rect_area fn
@maneatingape
Copy link
Owner

maneatingape commented Dec 10, 2025

Thanks for the PR!

We could go even further, for all input I've seen not only is the notch from from the left (smaller x) so the maximum point is always either the top or bottom of the notch on the right hand side. Also the notch always seem to be always index 248 and 249.

For part we could also split the input into above and below the notch, then do a pairwise check between the two halves. This would still be n^2 complexity but with half the n for a 4x speedup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants