29

I have a curve (say JTS edge):

enter image description here

How to find all curve direction change points that surpasses given angle using JTS (Java) or NTS (C#):

enter image description here

DuckQueen
  • 772
  • 10
  • 62
  • 134
  • As some pointers in the right direction... for each polygon, you can take the exterior ring and then start iterating through computing the angles as you go. – GeoJim May 31 '18 at 20:25
  • 2
    As far as computing the angles at each point [this](https://stackoverflow.com/questions/1211212/how-to-calculate-an-angle-from-three-points) might help. You don't say if you care about internal vs. external angles, so I'll leave that for you to figure out... – DavidW Jun 05 '18 at 21:47
  • The question isn't unclear. It could use some context though. What is the overarching goal? – N-ate Aug 06 '18 at 21:31

1 Answers1

1

I did some research and made some tests on JTS, and the best way I found is:

  • Create polygons and use the function union
  • Then iterate over the Coordinates, and create a sub-array on each "hard angle" (negative scalar product) and when the sum of angle reaches 180 (don't take the last angle to avoid non-function issues)
  • Then I change the base to an orthonormal base with x(firstElemOfSubArray, lastElemOfSubArray) by computing the base-changing matrix, and I then recompute the sub-array in a new coordinate system
  • I then create a function using org.apache.commons.math3.analysis.interpolation.SplineInterpolator to interpolate the function of the course, and then I get the derivative and search the extrema (don't take elements with an ordinate that is too low). With its absysse you can find which point is an inflexion point
  • So the point you search for are first elements of each sub array, and its inflections points (if there are any)