将坐标变换到另一个坐标系

发布于 2024-12-19 01:53:13 字数 231 浏览 5 评论 0原文

所以我在 3D 坐标系(红色)中拥有矩形(蓝色)的四个角坐标。我想创建一些矩阵,将红色坐标系中矩形上的任何给定点转换为绿色坐标系中的(2D)点。

illustration

我想这类似于从 3D 模型中的相机到屏幕的转换,但我没有坐标和相机的向量。您是否可以推荐这方面的文章或想法,或者您是否有可以分享的矩阵/算法?

So I have four coordinates of corners of a rectangle (blue) in a 3D coordinate system (red). I want to create some matrix to convert any given point on the rectangle in the red coordinate system into a (2D) point in the green coordinate system.

illustration

I guess this resembles a transformation from a camera in a 3D model to the screen, but I don't have coordinates and vectors of the camera. Are there articles or ideas you can recommend on this or do you even have a matrix/algorithm to share?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感情洁癖 2024-12-26 01:53:13

从一种坐标系转换到另一种坐标系时,主要作用是对齐这些系统。这里你需要的是:

  • 将蓝色矩形的左下角点(2D 坐标系的原点)平移到 3D 坐标系的原点 (T)
  • 将两个系统的 x 轴旋转对齐 (R1)
  • 将另一个轴(y 轴)与另一个旋转对齐。 (R2)

在线性代数变换中,以相反的顺序应用,因此给定 3D 空间中的点 p,您可以通过以下方式获得结果:

R2 * R1 * T * p

有关 平移矩阵旋转Matrix 是关于如何计算这些矩阵的良好资源。

最后提醒一下,您需要使用坐标的齐次形式,即; p(x,y,z,1)

When making transitions from one coordinate system to other the principal action is to align those systems. Here what you need is to:

  • Translate the lower left corner point of the blue rectangle ( origin of the 2D coordinate system) to the origin of the 3D coordinate system (T)
  • Align the x axis of the two systems with a rotation (R1)
  • Align the other axis (y -axis) with another rotation. (R2)

In linear algebra transformations are applied in reverse order, hence given point p in 3D space, you get the result by:

R2 * R1 * T * p

Wikipedia articles about Translation Matrix and Rotation Matrix are good resources about how to compute these matrices.

As a final reminder, you need to use homogenous form of the coordinate, i.e.; p(x,y,z,1)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文