|Perl Monk, Perl Meditation|
circular area in a coordinates grid (AoA)by Discipulus (Abbot)
|on Mar 19, 2019 at 21:34 UTC||Need Help??|
Discipulus has asked for the wisdom of the Perl Monks concerning the following question:
I have an array of arrays full of o and, given the coordinates of one element and a radius I want to change all elements around the center into x
My AoA can be eventually big so I do not want to process every element of the AoA.
The sub ( illuminate in the example below ) must not complain if a point is outside of the AoA (for example giving a corner as vertex).
A pure perl solution will be the best, but also using modules will be ok.
Sorry if I only have the below sketch but I'm very scarce in trig and until now I can only figure to hardcode series of coordinates relative to the vertex (that is silly..)
PS the above code displays the AoA before the change: I want to be able to select into @to_change the serie of elements falling inside the circle.
minor changes to explain better
UPDATE June 24 2019 see also 2d field of view, vision algorithm in grid (ray casting)
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.