geometry - Find all pixels a given radius from a point, confined within an arc -
i'm working on autonomous rover navigates partially ultrasound proximity sensors. before implement hardware want testing of our algorithms simulator, writing.
one task i'm having problem ultrasound sensor has 60 grade field of view. if object detected, point along 60 grade arc @ radius may have object, points below radius guaranteed not have object.
what need write function given (x,y) coordinate , bearing (i'm restricting 4 cardinals now) , have homecoming me list of pixels within radius , list of pixels @ radius. repeated scans multiple locations , bearings objects can found.
my initial thought work iterative-ly. start @ row in front end of sensor , sweep , forth in progressively wider scans (1,1,3,3,5,5,7,7,etc). radii stop aligning rows. new search path figure out how draw arc pixels, step radius first collision.
this question asks similar question, interested in specific points believe fundamentally different problem.
how calculate points(longitude,latitude) within given radius given point (longitude,latitude)?
you can utilize floodfill method integer points in sector. precalculate starting , ending angles
s_angle = center_bearing - pi/6 e_angle = center_bearing + pi/6
important values:
s_cos = cos(s_angle) s_sin = sin(s_angle) e_cos = cos(e_angle) e_sin = sin(e_angle)
border conditions sector floodfill:
(x-x0)*s_sin-(y-y0)*s_cos >= 0 //point left starting ray (x-x0)*e_sin-(y-y0)*e_cos <= 0 //point right ending ray (x-x0)^2+(y-y0)^2 <= r^2 //point in range
(probably may need exchange >= , <= in first inequalities pair)
geometry pixel computational-geometry geometric-arc
No comments:
Post a Comment