# Get the number of bends of a polyline

I am trying to get the number of curves/bends of a polyline. I know that I can accomplish this by getting the vertices of the polyline, and check the from and to and compare their angles, if they match then no bend, if they don't match then that's a bend/curve. I am hoping that arcobjects might have an existing function that accomplishes that, any ideas ? the pictures below shows the required.

``````public static int GetNumberOfCurves(this Ipolyline crntEdge)
{
// what I can do here is cast the polyline into IPointCollection
// get each point and get the from and to and compare the angles.
// but I am hoping there is something within the Apis that can get thosen curves
}
``````
• I doubt there is an IBendiness interface, so you'll likely need to code this yourself. You should also consider whether a curve with two major inflection points through 40 vertices is 39 bends or three. – Vince Sep 29 '15 at 12:58
• I don't think that there is. If you don't want to loop through all points, use ITopologicalOperator.Simplify() then count the number of vertices -2 – radouxju Sep 29 '15 at 13:29
• I'd use IConstructAngle.ConstructThreePoint for points 1 through n-2, to see if they are smaller than some threshold angle. – Kirk Kuykendall Sep 29 '15 at 20:54