在3D空间中对三个3D点进行线性插值 [英] Linear interpolation of three 3D points in 3D space

查看:638
本文介绍了在3D空间中对三个3D点进行线性插值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个3D点,例如p1(x1,y1,z1)p2(x2,y2,z2)p3(x3,y3,z3). 我还有一点,但是我只知道该点的xy值,例如p4(x4,y4,Z),其中Z是我要计算的值.

I have three 3D points like p1(x1,y1,z1), p2(x2,y2,z2), p3(x3,y3,z3). I have another point, but I know only x, y value of that point like p4(x4,y4,Z), in which Z is the value I like to compute.

通过使用delaunay三角剖分方法进行检查,我确定p4(x4,y4)点位于由p1(x1,y1)p2(x2,y2)p3(x3,y3)形成的三角形内.如何计算点p4Z值?我喜欢在C编程中实现它.实际上,我正在尝试在MATLAB中实现griddata.

I am sure p4(x4,y4) point is inside a triangle formed by p1(x1,y1), p2(x2,y2), p3(x3,y3) by checking with delaunay triangulation approach. How can I compute Z value of point p4? I like to implement it in C programming. Actually I am trying to implement griddata in MATLAB.

谢谢

推荐答案

您可以在P1P2P3向量基础上表示P4坐标.

You can express P4 coordinates in the P1P2P3 vector basis.

x4 = x1 + A * (x2 - x1) + B * (x3 - x1)
y4 = y1 + A * (y2 - y1) + B * (y3 - y1)

这是一个易于解决的线性方程组.您必须找到A和B系数,然后使用它们来计算z坐标

This is easy-to-solve linear equation system. You have to find A and B coefficients, then use them to calculate z-coordinate

z4 = z1 + A * (z2 - z1) + B * (z3 - z1)

这篇关于在3D空间中对三个3D点进行线性插值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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