Added some new routines for fitting an infinite cylinder to a set of 3D points
uses a (novel?) hybrid non-linear/linear estimation method
no real error checking or validation to speak of
This was a fun exercise. I tried to include comments to help explain what's going on, but reach out if you have any questions. I didn't test it on a ton of inputs, but it seems to work well on 5 or more reasonably-selected points. Robustness checking could/should be added (check number of points, check if all points are in a plane, check residual fit metric, etc).
There might be a direct solution for the 3D case, but I could only derive the 2D case in a reasonable amount of time. Luckily, that left only two bounded parameters to iterate over which is a pretty cool outcome. I came up with this solution approach on my own, but this is probably a "solved" problem which may have a known-best method out there. Let me know if you come across something significantly different/better.
Added some new routines for fitting an infinite cylinder to a set of 3D points
This was a fun exercise. I tried to include comments to help explain what's going on, but reach out if you have any questions. I didn't test it on a ton of inputs, but it seems to work well on 5 or more reasonably-selected points. Robustness checking could/should be added (check number of points, check if all points are in a plane, check residual fit metric, etc).
There might be a direct solution for the 3D case, but I could only derive the 2D case in a reasonable amount of time. Luckily, that left only two bounded parameters to iterate over which is a pretty cool outcome. I came up with this solution approach on my own, but this is probably a "solved" problem which may have a known-best method out there. Let me know if you come across something significantly different/better.