CGAL:给定两条线/向量/方向的旋转变换矩阵

发布于 2024-07-17 03:19:51 字数 81 浏览 4 评论 0原文

如何通过 CGAL 中两条线/向量/方向之间的角度生成旋转点/其他点的变换矩阵?

2D 正是我所需要的。 3D 是我喜欢的。

How do I generate a transformation matrix for rotating points/others by the angle between two lines/vectors/directions in CGAL?

2D is what I need. 3D is what I love.

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

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

发布评论

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

评论(1

究竟谁懂我的在乎 2024-07-24 03:19:51

根据手册,您可以使用这些工具和:

Aff_transformation_2<内核>; t ( const Rotation, Direction_2d, Kernel::RT num, Kernel::RT den = RT(1))

<块引用>

在方向 d 指示的角度上近似旋转,使得 d 给出的旋转的正弦和余弦与近似旋转之间的差异最多为 num/den。
前提条件:num/den>0 且 d != 0。

Aff_transformation_2<内核>; t.operator* ( s) 组成两个仿射变换。

Aff_transformation_2<内核>; t.inverse() 给出逆变换。

有了它们,您应该能够计算与两个方向相对应的矩阵,并使用以下恒等式:

Mat(d1-d2) === Mat(d1)*Inv(Mat(d2))

得到您想要的。

According to the manual you have these tools to work with:

Aff_transformation_2<Kernel> t ( const Rotation, Direction_2<Kernel> d, Kernel::RT num, Kernel::RT den = RT(1))

approximates the rotation over the angle indicated by direction d, such that the differences between the sines and cosines of the rotation given by d and the approximating rotation are at most num/den each.
Precondition: num/den>0 and d != 0.

Aff_transformation_2<Kernel> t.operator* ( s) composes two affine transformations.

Aff_transformation_2<Kernel> t.inverse () gives the inverse transformation.

With them you should be able to compute the matrices corresponding to the two directions and use an identity along the lines of:

Mat(d1-d2) === Mat(d1)*Inv(Mat(d2))

to get what you want.

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