gpt4 book ai didi

c++ - 如何计算插值三角曲面的主曲率?

转载 作者:行者123 更新时间:2023-11-30 00:52:03 27 4
gpt4 key购买 nike

在 3D 三角形网格中给定 3 个顶点及其法线,我在三角形表面上对它们进行插值。我想计算该表面上每个点的主曲率 k1、k2。

我的代码大致如下所示:

Vertex v1,v2,v3,v12,p,vp; // Vertex is an structure of x,y,z and some operators
v1 = ...; v2 = ...; v3 = ...;
Vertex n1,n2,n3,n12,n;//normals
n1 = ...; n2 = ...; n3 = ...;
int interLevels = ceil(sqrt(tArea(v1,v2,v3)));
for (float a=0; a<=1;a+=1.0f/interLevels){
v12 = v1*a+v2*(1-a);
n12 = n1*a+n2*(1-a);
for (float b=0; b<=1;b+=1.0f/interLevels){
p = v12*b+v3*(1-b);
n = n12*b+n3*(1-b);
normalize(n);

Vertex k1,k2;

}
}

我们如何计算 k1 和 k2?仅依赖于给定的输入就足够了吗,还是我应该考虑附近的顶点?

最佳答案

至少有两种方法可以解决这个问题

方法一

您可以利用主曲率是 shape operator 的特征值这一事实- 在其两个切 vector 上定义的空间上的线性函数。

程序:

1. compute shape operator:

求两个切 vector 然后计算

enter image description here

你会发现一个矩阵

enter image description here

2. and then the eigenvalues of this matrix are principal curvatures k1, k2

方法二

我们将利用给定点 P 处的曲面 S 的主曲率是方程实域中的根的事实

(EG-F^2)k^2 - (EN-2FM+GL)k + LN-M^2 = 0      (1)

其中 k 是主曲率,系数取自第一和第二基本形式。它们是根据参数方程给出的。为了获得这些根,我们将使用这样一个事实,即我们可以找到矩阵 A 的特征值,而不是从 (1) 计算 k1k2 ,其中 A 定义为

enter image description here

矩阵F1包含第一基本形式的系数

enter image description here

矩阵 F2 包含第二基本形式的系数

enter image description here

关于c++ - 如何计算插值三角曲面的主曲率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20022719/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com