I needed some PHP code that finds the area of the minimum bounding rectangle (MBR) of a polygon. I came across a lot of pieces of useful info scattered across the web, but none of these pieces provided enough of a solution. If you are looking for a good implementation that finds the MBR in JAVA then check out Bart Kiers' code. I started porting Bart's implementation to PHP, and although it is a great implementation, it is very tightly coupled with the nuissances of JAVA and several abstractions that Bart implemented. So, I found Godfried Toussaint's 1983 whitepaper on "Solving geometric problems with the rotating calipers" and the Wikipedia page for "Rotating Calipers" and used them to code a simple and brief implementation in PHP. I hope this implementation proves useful in its current form or as a good template for those wishing to create a similar implementation in the language of their choice.
My code can be found on GitHub under the project name BbsRotatingCalipers.
No comments:
Post a Comment