HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

Find and sort 2d array elements like radar

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
elementsarraylikeradarfindandsort

Problem

I don't know relevant keywords about this algorithm.
I can show you visually

Any ideas are appreciated

Solution

For each of your points in the field, calculate the red angle:


Then sort all the (point, angle)-tuples by the angle.

Context

StackExchange Computer Science Q#121113, answer score: 9

Revisions (0)

No revisions yet.