How to find curve corner points using JTS or NTS?
Asked Answered
V

1

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

Velasquez answered 30/5, 2018 at 21:38 Comment(3)
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.Phaedrus
As far as computing the angles at each point this might help. You don't say if you care about internal vs. external angles, so I'll leave that for you to figure out...Mesenchyme
The question isn't unclear. It could use some context though. What is the overarching goal?Cymose
L
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)
Lycaonia answered 18/6, 2018 at 23:29 Comment(1)
that's a whole project i need to finish this then push it some whereCircumvolution

© 2022 - 2024 — McMap. All rights reserved.