フィルターのクリア

I have a list of triangles of the mesh and point cloud. the question is :how to determine each point belongs to a triangle

2 ビュー (過去 30 日間)
I have a list of triangles of the mesh and point cloud. the question is :how to determine each point belongs to a triangle
  5 件のコメント
amina lk
amina lk 2016 年 2 月 28 日
thank you i resolt my prob of projection by this file joint
amina lk
amina lk 2016 年 2 月 28 日
thank you i resolt my prob of projection by this file joint

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

採用された回答

Roger Stafford
Roger Stafford 2016 年 2 月 26 日
Let the points (x1,y1), (x2,y2), and (x3,y3) be the three vertices of a triangle, and let (x,y) be some arbitrary point. Define:
c1 = (x2-x1)*(y3-y1)-(x3-x1)*(y2-y1);
p1 = (x2-x) *(y3-y) -(x3-x) *(y2-y) ;
c2 = (x3-x2)*(y1-y2)-(x1-x2)*(y3-y2);
p2 = (x3-x) *(y1-y) -(x1-x) *(y3-y) ;
c3 = (x1-x3)*(y2-y3)-(x2-x3)*(y1-y3);
p3 = (x1-x) *(y2-y) -(x2-x) *(y1-y) ;
Then the point (x,y) lies inside or on the triangle if:
sign(c1)*sign(p1) >= 0 & sign(c2)*sign(p2) >= 0 & sign(c3)*sign(p3) >= 0
  2 件のコメント
amina lk
amina lk 2016 年 2 月 27 日
thank you but if i added the coordinate z
Roger Stafford
Roger Stafford 2016 年 2 月 27 日
編集済み: Roger Stafford 2016 年 2 月 27 日
Two points.
1) My apologies! I made the computations more complicated than they need be. The quantities c1, c2, and c3 are all identically equal, so you need only calculate one of them. They are each twice the signed area of the (straight-lined) triangle. with the sign determined by whether (x1,y1), (x2,y2), (x3,y3) are in counterclockwise or clockwise order around the triangle.
2) In answer to your question of triangles in three-dimensional space, that is a somewhat different situation. Your arbitrary point (x,y,z) has to be shown to lie in the same plane as that of the triangle, if that is what you mean by "belongs to", in addition to satisfying three inequalities. Do you want me to show how this is to be determined?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePoint Cloud Processing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by