# How to cut parallelogram with intersecting line?

I have a very specific set of circumstances under which I need to break a parallelogram into 2 pieces. The parallelogram obviously always have 4 vertices and the intersecting line intersects the polygon exactly 2 times. In the order in which the intersecting line points are given, the polygon area to the right of the line is the area of interest. I feel this could be solved using a linked list implementation in code but am unsure where to start. Additionally, if there is a simply geometry function to get the job done, that is acceptable too (I've tried intersection and difference but neither applies to the situation). An example is attached below.

Notes:

• Polygon vertices are given in clockwise order starting from the upper-right-most point.

• The intersecting line can have 2 or more points. (In the case of 2, that means that the same intersecting ling segments intersects 2 of the parallelogram's sides.

• It's possible the intersecting line only intersects one side of the polygon.

The area of interest is the upper-right area of the polygon that is closed off by the line. This implies that in this case, the intersecting lines' vertex order is 1) the point to the right, 2) the point in the center, 3) the point at the top.

These are a few more possible cases where the area of interest is shaded (please excuse my poor drawings!).

• Aside from very complex gerrymandering in North Dakota, what is the point of the exercise? Jan 6 '15 at 11:31
• The US SPC (Storm Prediction Center) issues severe weather watches initially as parallelograms of arbitrary size (representative of geographic area). Over time, they are trimmed by area as storms move through. Thus, as time progresses, it only makes sense to display the valid portion rather than the entire polygon. For this I need to cut the polygon down to size manually as only the initial boxes' and update lines' lat/lon coordinates are given. Jan 6 '15 at 19:39
• Ok - thanks for that (and sorry if the comment was a little sarcastic!). Its always useful to know a little about the data. The problem as I see it is that trimming of the original polygons is essentially arbitrary - or it is at least from your drawings. Are you thinking that the path of the storm could essentially trim the original polygon to the right or the left of the path? If so that really makes things complex as its a subjective decision. You could derive a minimum bounding box based on the path of the storm and then clip the polygon - or you could just buffer the path to an (see below) Jan 7 '15 at 21:12
• arbitrary distance (possibly based on the strength of the storm - this would be trial and error on your part) and use that to clip the original polygons. These are just a few suggestions - and not an answer (sorry). I've voted the question up as its a tricky one and should get more attention! Jan 7 '15 at 21:14
• Not the best analogy but one that works; imagine you are cutting the grass in a square yard. You make progress in rows roughly halfway and decide to take a break. If you walk the line of your progress in the right order, everything to the right of your path within the yard is left. The yard represents the polygon and your path is the line. The order of the coordinates is know and in "to the right of a line" order. You have given me an idea though. My potential solution is listed below...I'll try it out and update with results. Jan 8 '15 at 1:46