CGAL:给定两行/矢量/方向的旋转变换矩阵 [英] CGAL: Transformation Matrix for Rotation given two lines/vectors/directions

查看:292
本文介绍了CGAL:给定两行/矢量/方向的旋转变换矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

2D是我需要的。 3D是我喜欢的。根据 Kernel_23_ref / Class_Aff_transformation_2.htmlrel =nofollow noreferrer>手册,您可以使用这些工具:


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


近似于由方向d表示的角度上的旋转,使得由d给出的旋转的正弦和余弦与近似旋转之间的差值每个最大为num / den。
前提条件:num / den> 0且d!= 0。

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

Aff_transformation_2< Kernel> t.inverse()给出了逆变换。


使用它们,您应该能够计算与两个方向相对应的矩阵,并使用以下几行的标识:

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

可以得到您想要的。

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.

解决方案

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.

这篇关于CGAL:给定两行/矢量/方向的旋转变换矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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