将2d样条函数f(t)变换为f(x) [英] Transform 2d spline function f(t) into f(x)
问题描述
我想要高效地找到样条线上的y坐标,例如 x = 0.0, x = 0.1, x = 0.2等,或以另一种方式接近,有效地转换 f x,y 我现在正在使用一个4x4常量()风格的函数到 f ( x )函数中。矩阵和四个二维控制点来描述样条,使用Hermite或Catmull-Rom样条的矩阵常量,并将它们插入从0到1的 t 三次函数。 b
$ b
给定矩阵和控制点,在x轴上获得这些y值的最好方法是什么?
编辑:I应该加上一个足够好的近似值来绘制就足够了。 你的问题表明你要均匀分布空格 x 坐标,并且大致的解决方案都是正确的。所以我建议使用以下算法: 这将放大网格点,在每一步中平分参数空间,并为所有网格点提供合适的参数。 So I've got a special case set of cubic splines, whose 2d control points will always result in a curve that will never cross itself in the x axis. That is, the curves look like they could be a simple polynomial function such that y=f(x). I want to efficiently create an array of y coordinates along the spline that correspond to evenly-spaced x coordinates running the length of the spline segment. I want to efficiently find the y coordinates along the spline where, for instance, x=0.0, x=0.1, x=0.2, etc., or approached another way, effectively transform the fx,y(t) style function into an f(x) function. I'm currently using a 4x4 constant matrix and four 2d control points to describe the spline, using matrix constants for either Hermite or Catmull-Rom splines, and plugging them into a cubic function of t going from 0 to 1. Given the matrix and the control points, what's the best way to obtain these y values over the x axis? EDIT: I should add that an approximation good enough to draw is sufficient. Your question states that you want evenly spaces x coordinates, and approximate solutions are all right. So I propose the following algorithm: This will zoom in on the grid points, bisecting the parameter space in each step, and will come up with suitable parameters for all your grid points. 这篇关于将2d样条函数f(t)变换为f(x)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!