在两个点之间创建一条曲线,每个点都有归一化向量 [英] Creating a curve between two points each with normalized vectors

查看:151
本文介绍了在两个点之间创建一条曲线,每个点都有归一化向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我需要一种写方法来在两个点之间创建一条曲线,每个点的归一化向量指向任意方向.我一直在尝试设计这样一种方法,但无法将自己的头全神贯注于数学.

So I need a write method to create a curve between two points, with each point having a normalized vector pointing in an arbitrary direction. I have been trying to devise such a method but haven't been able to wrap my head around the math.

在这里,由于一张图片值一千字,这就是我所需要的:

Here, since a picture is worth a thousand words this is what I need:

在图片中,向量垂直于红线.我认为向量必须加权相同,其权重等于点之间的距离.必须确保两个点在彼此相反的顶部之上时,它们仍然看起来都像一条平滑曲线(图片中的顶部曲线).另外,我需要对曲线进行积分以找到其长度.我不知道为什么我没想到如何计算所有这些,但我还没有.

In the picture, the vectors are perpendicular to the red lines. I believe the vectors need to be weighted the same with a weight equivalent to the distance between the points. It needs to be so that when two points are on top of each other pointing in opposite directions it still all looks like one smooth curve (top curve in the picture). Also, I need to integrate the curves to find their lengths. I don't know why I haven't been able to think of how to calculate all of this but I haven't.

我也正在使用csharp,语言并不重要.

Also I'm using csharp the language doesn't really matter.

推荐答案

立方贝塞尔曲线确实可以达到要求的效果.每个曲线段需要四个控制点.其中两个定义端点,另两个定义端点处的切线方向.剩下两个自由度,告诉控制点沿着切线的距离.

Cubic Bezier will indeed achieve the requested effect. You need four control points per curve segment. Two define the endpoints and two others the directions of the tangents at the endpoints. There are two degrees of freedom left, telling how far the control points can be along the tangents.

不能通过分析来计算弧长,您将需要数值方法.此其他问题为您提供了有用的信息.

The arc length cannot be computed analytically and you will need numerical methods. This other question gives you useful information.

这篇关于在两个点之间创建一条曲线,每个点都有归一化向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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