Good idea -- squares would be even faster.
I would consider whether I could define my areas in terms of "rectangles" in lat-lon coordinates (never mind real-world distances) -- then all the computations become subtractions.
Good idea -- squares would be even faster.
I would consider whether I could define my areas in terms of "rectangles" in lat-lon coordinates (never mind real-world distances) -- then all the computations become subtractions.
not
not at
Anyone
So much is going to depend on the size/shape/number of areas involved. If there are a lot of areas, and the shapes are complex, and have to be accurately defined, consider a larger processor with more RAM. However if the areas are reasonably small, consider the 'flat earth' solution. If you assume the world is flat, you can calculate a distance from a 'point', using simple pythagorean triangle solutions. Do this in integer arithmetic, woking to perhaps 1m resolution. Then define each area, in terms of a number of points, and radii round them. Overlap circles to cover more complex shapes. The test for a few dozen circles could be done in a few mSec, even on a PIC. Obviously if the circles are large, this will start to become significantly in error, but for reasonable sized circles, it will be pretty accurate.
Best Wishes
Hiya
This is a question for all the code warriors out there doing stuff with picmicros or whatever else type micro... I have a project to do "geofencing" using a gps. Basically the gps is not any problem but when it comes to defining a go-nogo area and be able to dtect if one is in the area or not at any given time in realtime i am a little lost in how to do this in a microcontroller based design. Anyone have ideas about code to define and area using gps co-ords and realtime detection?
Much appreciated
In article , Tim Wescott wrote: [....]
Doing rotated squares generally requires multiplies but you can do one at a 45 with just adds and subtracts if you are willing to prescale the constants. Instead of tiling the shape in rectangles in the normal rotation, you can mix in some at the 45 degree angle .This could define a smoother shape with less squares.
Have something to add? Share your thoughts — no account required.
Ask the community — no account required