Lipko Posted May 17, 2022 Report Share Posted May 17, 2022 (edited) Hi all! I want to create a smooth curve through given points in 2D and I'm having trouble with using the built in interpolation functions in Labview. I need something like this: I found this thread from more than 10 years ago and I can't find the interpolation vi it's using, and I don't really understand what the other similar vis are doing. It's only for a drawing application so it's not really important in details how the interpolation works (nurbs/bézier/whatever), it only needs to look okay. Thanks for any hints in advance! Edited May 17, 2022 by Lipko Quote Link to comment
Lipko Posted May 24, 2022 Author Report Share Posted May 24, 2022 (edited) I managed to solve it with some thinkering. I used 3rd order Bézier curves to interpolate between neighbour points. The tangents in the points (which are the other two control points of the Bézier curve besides the end points) is calculated by the angle bisector of the two adjacent segments. The length of these control tangents are calculated from the length of the corresponding segment multiplied by a fix value ("strength"). Though it could be easily changed to have a separate strength value for each point. Implemented closed and open version of the curve. Note, that for some reason I havent looked into yet, the curve or some sections of it can suddenly snap into a seemingly opposite winding after a certain amount of deformity. The curve looks okay for my needs so I don't think I will fix that any time soon. Attached a small quick demo. curve_through_points_demo.vi The Bézier functio is also my "work" (copied the code into a formula node), I'm surprised that these basic geometry stuff are not implemented in Labview. by default 2D_curve_through_points.vi 2D_3rd_order_Bezier_curve.vi 2D_ccw_angle.vi 2D_3rd_order_Bezier_point.vi Edited May 24, 2022 by Lipko Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.