Select to view content in your preferred language

GeometryEngine.Cut inconsistent with result side order

1117
3
03-28-2022 01:32 PM
tempStephenRhea_NV5
Frequent Contributor

The GeometryEngine.Cut method is inconsistent with which side of the result gets returned first, meaning I have to do additional analysis to figure out which result item is on which side. Coming from ArcObjects, I'm accustomed to the first result being the left side and the second being the right, and that expectation appears to hold based on the documentation's code example. However, the first value returned when cutting a polygon is sometimes the left side and sometimes the right. The order is always the same for a given input, but different inputs may swap the order.

In the image below (created in GeoGebra), one set of inputs/outputs is in blue; the other in orange. Both cut lines are oriented southeast, and the points are the northernmost point of each result's side. The orange line (angle ~330 degrees) returns the left side at index 0, but the blue line (angle ~334 degrees) returns the right side at index 0.

Is the intent for developers to do further analysis to determine which result is the left side? Is there a "rule" for which side is at index 0?

Cut inconsistency.png

3 Replies
tempStephenRhea_NV5
Frequent Contributor

In case some clarity is needed for the drawing, the points labeled "Left" are from the first result, and the points labeled "Right" are from the second. That means that for the orange set, "vLeft" is the northernmost point in the first result, which matches the "left comes first" expectation from ArcObjects and the documentation. However, for the blue set, "vRight" is the northernmost point in the second result, which goes against the "left comes first" expectation.

Hopefully that helps.

0 Kudos
by Anonymous User
Not applicable

Hi Stephen,

The first geometry in the result should be the left one, but I can't reproduce this. Could you share with me the coordinates of the lines and the cutter line?

Thanks,

Annette

0 Kudos
Jeff-Reinhart
Frequent Contributor

I tried this using a polyline to cut a polygon. I can confirm that in the IReadOnlyList<geometry> returned from GeometryEngine.Cut(), the order of which geometry is left of the polyline and which geometry is right of the polyline is random in the list. I determined this by writing a custom flashing method following this post. This was necessary as I need to allow the user to pick which side of the split retains attributes and cannot use the Split() method as I cannot change the selections in the map.

Having to roll my own flashing method was frustrating enough. Learning that ArcObjects had a set order on the return for Cut() and that the Pro SDK does not brings another frustration. It is not fully featured, folks.

0 Kudos