18

I am developing an application for sampling Glebe for agriculture purpose. In That a user can select a a Glebe by tapping on map which will create a polygon according to the number of taps. I am able to create that polygon and able to get the area of the polygon. But Now I need to divide it into equal areas.

For example, If the polygon's area is 50m^2 then it'll be divided into 50 areas of 1 m^2. Same functionality has been done in Agri Precision App. Find below image. I need to divide the polygon same as below image and show the points inside it.

The polygon

For getting Area, I am using Google Map Utilty Lib It has an algo also for Grid Clustering. I want same like above image. In above image, they have divided area per 5 Hectares. Since all area is 85 Hectares, so total points should be shown will be 17. That is what How it works.

So my question is:

How to find those points according to the area of the polygon on Map so that I can draw these points on Map?

TheLittleNaruto
  • 8,325
  • 4
  • 54
  • 73
  • I can't see the connection between these 17 isolated points and a subdivision of the quadrilateral into 17 tiles of equal area. This figure is not a solution to the queried problem, please provide a better explanation. –  Jan 15 '14 at 07:18
  • Just for reference I have put that image. Main issue is to divide polygon with equal areas.That's what my actual need is at the moment. – TheLittleNaruto Jan 15 '14 at 07:23
  • Sorry but this image is irrelevant and misleading. –  Jan 15 '14 at 08:36
  • I am sorry for that irrelevant image. I'll update it right away. Please give me a minute – TheLittleNaruto Jan 15 '14 at 08:45
  • 1
    I believe [this](http://www.cs.princeton.edu/courses/archive/fall05/cos226/lectures/geometry.pdf) can help you out. It is a presentation about algorithms that can be used for spatial purposes. – Yordan Lyubenov Jan 15 '14 at 10:06

2 Answers2

3

No constraint has been given on the shape of the glebes, so here is a solution that will fulfill the problem statement by building a star-shaped decomposition. It assumes that the polygon is convex:

  • Arbitrarily select a main vertex.

  • Triangulate the polygon by joining the main vertex to every edge in turn, giving triangles of areas A1, A2, A3...

  • Start a trip around the polygon, from the main vertex. If the first triangle is larger than the desired area (A1 > A), find the point along the edge such that it will subdivide the triangle in a sub-triangle of the desired area. Continue the trip from here with the remaining sub-triangle (having area A1-A). Otherwise, subtract the area of the first triangle from the desired area and continue the trip (A now A-A1).

This is very similar to splitting a sequence of N intervals on the real line into K intervals of equal length.

My guess is that a star-shape decomposition will not suit you.

  • Thanks Yves, Your idea is quite good, What I want to know is how to achieve the equation for the same algo as you mentioned ? – TheLittleNaruto Jan 15 '14 at 09:04
  • All you need is the formula for the area of a triangle (http://en.wikipedia.org/wiki/Triangle#Using_coordinates). And to divide a triangle in a subtriangle of given area, you just divide an edge in the same ratio (use the parametric equation of the line segment). –  Jan 15 '14 at 09:27
  • @YvesDaoust Your answer is quite good but it would be batter if you add basic equation & code to achieve that so questioner can get idea from where to start. – Chintan Khetiya Jan 15 '14 at 09:31
  • @YvesDaoust If you dont mind can we discuss [here](http://chat.stackoverflow.com/rooms/19132/java-and-android-era) – TheLittleNaruto Jan 15 '14 at 09:38
  • Thanks, I am able to develop equation according to this algo. But due to some Google Map limitation I am not able to do perfectly as I want. – TheLittleNaruto Jan 18 '14 at 05:50
3

If your polygon is convex, a solution can be obtained by solving the following sub-problem: "Given a convex polygon of area A, find the horizontal line that splits it in two parts of respective areas B and A-B."

This is readily done by scanning the vertices from top to bottom with a moving horizontal and computing the covered area (this forms a decomposition of the polygon into trapezoids). At some point you will exceed the area B. By linear interpolation between the current and previous vertexes, you will determine the exact ordinate of the horizontal.

You will use the sub-problem solution as follows:

1) compute the integer square root, let N, of the number of desired tiles, let M.

2) slice the polygon N times, each time obtaining the area of N tiles. There will be a remainder of M-N^2 tiles.

3) slice every slice using verticals to singulate the final tiles.

The tiles will have a much more acceptable shape (rectangles when they don't meet any edge).