9

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

1 Answer 1

5

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"
1
  • welcome to SO! thanks for the sharp answer - works like a charm!
    – aviad
    May 8, 2012 at 10:25

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.