简体   繁体   English

C#样条插值,用于在点阵列之间插值键

[英]C# Spline Interpolation for interpolating a key between array of points

I need an interpolation function for interpolating a point: 我需要一个插值函数来插值一个点:

var times = new List<double>();
var offsets = new List<double>();
..
..
..//I fill times and offsets arrays with some points
..
var newTime= splineInterpolate(cursorOffset, offsets.ToArray(), times.ToArray())

It depends on what kind of interpolation you want. 这取决于您想要哪种插值。 If you don't want the interpolation function to pass through the control points, you can use a Bezier curve (you can choose the order of the curve). 如果不希望插值功能通过控制点,则可以使用贝塞尔曲线 (可以选择曲线的顺序)。

If you want the curve to pass through the control points, a popular choice is a cubic Hermite spline . 如果您希望曲线通过控制点,则常用的选择是三次Hermite样条曲线 There are many types of hermite splines like cardinal and catmull-rom splines (which are C1 and C2 continuous). 埃尔米特花键有很多类型,例如基数和catmull-rom花键(C1和C2连续)。

If you just do a simple Google search, you will come across thousands of results for splines with their implementation in C# provided. 如果仅进行简单的Google搜索,就会发现花键的成千上万个结果及其在C#中的实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM