Reputation: 738
Suppose I have a vector of points as polar coordinates.
Suppose one of those points acts as a probe for which I want to find all the other points within a certain distance.
Is there an algorithm to do this without converting them to Cartesian form?
Upvotes: 6
Views: 773
Reputation: 4146
Be careful, if you plan to scale up your algorithm to many points, probing for points nearby is better done using a spatial index. I'm not aware of the existence of spatial indexes using polar coordinates, and I'm sure they would be a bit complex to implement/use. So if you have:
ask yourself the question whether you should use Cartesian coordinates and a spatial index.
Do the math yourself according to your typical use case:
Using cartesian alongside polar coordinates:
Using polar coordinates only:
Be aware that trigs are bloody expensive in computation time.
Upvotes: 2