[Math] Algorithm of cutting a polygon into equal parts

algorithmspolygons

I have a convex polygon. I need to divide it into 4 equal parts using the two slit. For example, if I have a square, I have to cut it along the diagonals. Are there some common algorithm for this action?

Best Answer

If $P$ is a polygon it is possible to find a line parallel to any fixed direction which divides $P$ in two region of any given area (of course not larger than the area of $P$).

Suppose that the line is vertical (otherwise you can rotate the polygon or adapt the algorithm). Let $p_1=q_1=(x_1,y_1)$ be the vertex of $P$ which has least possible first coordinate $x_1$. Then enumerate the upper and lower vertices starting from $p_1$ by increasing first coordinate: $p_1,p_2,\dots$ are the upper part of the boundary, $q_1,q_2,\dots$ are the lower part of the boundary. Now consider all vertical lines passing through these points and compute the intersection with the edges on the other side of the polygon. For example suppose that between $p_2$ and $q_2$ the point which is left-most is $p_1$. Then you can find a point on the segment $q_1 q_2$ such that it has the same first coordinate of $p_2$. Adding such points, you may assume that the points $p_k$ and $q_k$ have the same $x$-coordinate.

Now you have subdivided your polygon into a finite union of trapezoids with vertical bases. Finding the area of such trapezoids is very easy. So if you want to find a cut with given area, you pass along these trapezoids until you pass the target area. Then you must divide the last trapezoid with a vertical line, so to get the correct total area. Again this is very simple since the area of the trapezoid is a linear function of the $x$ coordinate of the vertical cutting line.

addendum: Notice that the algorithm, as described, can fail if the polygon is not convex.

Related Question