Rotate line about a point

68 ビュー (過去 30 日間)
Vadim Koller
Vadim Koller 2020 年 9 月 28 日
回答済み: Amrtanshu Raj 2020 年 10 月 2 日
How can i rotate a line about its end point? Also how can I keep the line sizes equal. I'm trying to represent the moving coordinate frame for the end effector of an robotic arm and I want to represent the change in x and y axis based on the rotation matrix.
Thank you

回答 (1 件)

Amrtanshu Raj
Amrtanshu Raj 2020 年 10 月 2 日
Hi,
You can simply translate the vector to the origin Multiply the point by the rotation Matrix and then again translate the point back to the rotation point (end point). The following code may help.
Rotation_matrix = eul2rotm([pi/2,0,0]) %rotation matrix
point1 = [1,2,0]; %end point of line, we will rotate about this point
point2 = [4,5,0]; %end point of line
Point2new = point1 + [point2-point1]* Rotation_matrix

カテゴリ

Help Center および File ExchangeSplines についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by