How do I find the orthogonal projection of a point onto a plane

132 ビュー (過去 30 日間)
luc
luc 2015 年 3 月 16 日
回答済み: canadarunner 2024 年 5 月 15 日
Say I have a plane spanned by two vectors A and B. I have a point C=[x,y,z], I want to find the orthogonal projection of this point unto the plane spanned by the two vectors. How do I do this?
  2 件のコメント
Andrew Newell
Andrew Newell 2015 年 3 月 16 日
That's a math question. If you tell us the formula, we can tell you how to implement it.
luc
luc 2015 年 3 月 23 日
True, unfortunately I know how to implement it, but not the math.

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

採用された回答

Torsten
Torsten 2015 年 3 月 23 日
min: (x0+lambda*a0+mu*b0-x)^2 + (y0+lambda*a1+mu*b1-y)^2 + (z0+lambda*a2+mu*b2-z)^2
gives the distance squared from the point (x,y,z) to the plane
w=(x0,y0,z0)+lambda*(a0,a1,a2)+mu*(b0,b1,b2).
Differentiate the distance squared with respect to lambda and mu, set the partial derivatives to 0 and solve for lambda and mu.
If the result is lambda^, mu^, then
(x0,y0,z0)+(lambda^)*(a0,a1,a2)+(mu^)*(b0,b1,b2)
is the orthogonal projection of (x,y,z) onto the plane.
Best wishes
Torsten.

その他の回答 (2 件)

Noah
Noah 2019 年 10 月 3 日
This is an old post, but it deserves a simpler answer. Your plane is spanned by vectors A and B, but requires some point in the plane to be specified in 3D space. Call a point in the plane P. You can compute the normal (call it "n" and normalize it). Then the projection of C is given by translating C against the normal direction by an amount dot(C-P,n).
% compute the normal
n = cross(A, B) ;
n = n / sqrt(sum(n.^2)) ;
% project onto the plane
C_proj = C - dot(C - P, n) * n
  3 件のコメント
Nadezhda Lapina
Nadezhda Lapina 2021 年 5 月 7 日
編集済み: Nadezhda Lapina 2021 年 5 月 7 日
P is any point that belongs to the plane
Brent F
Brent F 2021 年 6 月 17 日
can also use norm:
n = n / norm(n)

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


canadarunner
canadarunner 2024 年 5 月 15 日
The vectorized version would be simply just
C_proj = C - (C - P) * n' * n;

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by