Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need an advice of framework for path on map validation

The problem I am facing is as follows:

Given two polygons defining the borders of a maze and a path in between (see picture below), I would like to know when I crossed the borders of the maze.

In respect to the inputs I have:

  • One file defining edges of the two polygons (only the points that connect straight lines)
  • One file with all waypoints I had visited, in the order of appearance

I need to calculate a score for that path based on the amount of time spent in the restricted zone.

What is the best way to do it? (Algorithm/Technology/Library) I have no technology restrictions so the solution can be anything e.g Java, C, Perl (this is my favorite), etc

I started working on a solution, but then I realized this issue must have been solved millions of times in the past and there's no reason for "reinventing the wheel" :)

I am new to Geographic/Geometric kind of problems, and I would greatly appreciate any advice of what approach should I take.

Cheers

example map

like image 946
aviad Avatar asked May 08 '12 08:05

aviad


1 Answers

This is a Point in polygon

  1. Build a list of polygons from "One file defining edges of the two polygons (only the points that connect straight lines)"
  2. Apply point_in_polygon() (perl implementation, your favorite) for each "waypoints I had visited"
like image 147
karpada Avatar answered Sep 19 '22 12:09

karpada