How can I move a point parallel to a created plane?

1 回表示 (過去 30 日間)
CA
CA 2018 年 4 月 23 日
コメント済み: CA 2018 年 4 月 24 日
I have created a triangle plane from three (x,y,z) coordinates, and a separate point which is in the centre of the triangle. I need to be able to move this point parallel to my created plane. Does anyone have any ideas how to do this? I have only managed to move this point perpendicular to my plane, using the cross function.

採用された回答

Benjamin Großmann
Benjamin Großmann 2018 年 4 月 23 日
編集済み: Benjamin Großmann 2018 年 4 月 23 日
Assuming your points are called p1, p2 and p3: One simple approach would be to define a coordinate system (non-orthonormal) with axes (p2-p1) and (p3-p1) as in-plane axes and the cross-product of these axes as third axis. You can then move the point inside this coordinate system and transfrom it in the world system for plotting and further calculations. The z-axis of this triangle-system is perpendicular to the triangle plane.
clearvars
close all
clc
p1 = [8 3 7]';
p2 = [5 9 2]';
p3 = [3 8 1]';
points = [p1 p2 p3];
% Transformation from world frame to triangle frame
% non-orthonormal transformation (normalization possible)
T = [p2-p1 p3-p1 cross(p2-p1,p3-p1) p1; 0 0 0 1];
% Move the point in the Triangle frame and transform to world frame
point_in_triangle_system = [1 1 0 1]'; % the last "1" is for homogenization
point_in_world_system = T*point_in_triangle_system;
% plot triangle and point
fill3(points(1,:),points(2,:),points(3,:),'b','FaceAlpha',0.5)
hold on
plot3(point_in_world_system(1),point_in_world_system(2),point_in_world_system(3),'kx')
If you provide your code, some more specific help is possible; Furthermore, I am pretty sure that Robotics System Toolbox contains functions for the transformation.
  1 件のコメント
CA
CA 2018 年 4 月 24 日
Thank you! This is exactly the concept I was looking for.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by