向心Catmull-Rom花键如何工作? [英] How does the centripetal Catmull–Rom spline work?

查看:137
本文介绍了向心Catmull-Rom花键如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自此站点,该站点似乎具有有关Catmull的最详细信息-Rom样条曲线,似乎需要四个点来创建样条曲线.但是,它没有提到点p0和p3如何影响p1和p2之间的值.

From this site, which seems to have the most detailed information about Catmull-Rom splines, it seems that four points are needed to create the spline. However, it does not mention how the points p0 and p3 affect the values between p1 and p2.

我的另一个问题是如何创建连续的样条曲线?通过使p4 = p2来定义点p1,p2与p4,p5连续是否容易(也就是说,假设我们有p0,p1,p2,p3,p4,p5,p6,...,pN ).

Another question I have is how would you create continuous splines? Would it be as easy as defining the points p1, p2 to be continuous with p4, p5 by making p4 = p2 (that is, assuming we have p0, p1, p2, p3, p4, p5, p6, ..., pN).

一个更普遍的问题是,如何计算Catmull-Rom样条曲线的切线?

A more general question is how would one calculate tangents on Catmull-Rom splines? Would it have to involve taking two points on the spline (say at 0.01, 0.011) and getting the tangent based on Pythagoras, given the position coordinates those input values give?

推荐答案

看看等式2-它描述了控制点如何影响线.您可以看到点P0P3进入了沿着曲线从P1P2绘制点的方程式.您还将看到方程式在t == 0时给出P1,在t == 1时给出P2.

Take a look at equation 2 -- it describes how the control points affect the line. You can see points P0 and P3 go into the equation for plotting points along the curve from P1 to P2. You'll also see that the equation gives P1 when t == 0 and P2 when t == 1.

该示例方程式可以被概括.如果您有点R0R1,... RN,则可以通过将等式2与P0 = RK - 1P1 = RKP2 = RK + 1P3 = RK + 2一起使用,在RKRK + 1之间绘制点.

This example equation can be generalized. If you have points R0, R1, … RN then you can plot the points between RK and RK + 1 by using equation 2 with P0 = RK - 1, P1 = RK, P2 = RK + 1 and P3 = RK + 2.

除非添加额外的控制点以代替R - 1RN + 1,否则无法从R0R1或从RN - 1RN进行绘图.通常的想法是,您可以选择要添加到序列开头和结尾的任何点,以便为自己提供计算样条曲线的所有参数.

You can't plot from R0 to R1 or from RN - 1 to RN unless you add extra control points to stand in for R - 1 and RN + 1. The general idea is that you can pick whatever points you want to add to the head and tail of a sequence to give yourself all the parameters to calculate the spline.

您可以通过在两个样条之间放置一个控制点来将它们连接在一起.假设您有R0R1,...,RNS0S1,... SM,它们可以合并为R0R1,...,RN - 1S2,... SM.

You can join two splines together by dropping one of the control points between them. Say you have R0, R1, …, RN and S0, S1, … SM they can be joined into R0, R1, …, RN - 1, S1, S2, … SM.

要计算任意点的切线,只需采用等式2的导数即可.

To compute the tangent at any point just take the derivative of equation 2.

这篇关于向心Catmull-Rom花键如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆