Translate rotate and scale STL surfaces

95 ビュー (過去 30 日間)
Nataliya Perevoshchikova
Nataliya Perevoshchikova 2019 年 1 月 30 日
編集済み: Brice Kabore 2020 年 5 月 11 日
I imported three STL files (3d) as patch data. I merged nodes. These objects can be plotted with faces and vertices. My next step is to rotate, translate and scale one surface to two surfaces based on vertices. Vizually, I know where should be insertion points of fitted surface to two surfaces.
What would be steps to perform these operations?
  1 件のコメント
Brice Kabore
Brice Kabore 2020 年 5 月 11 日
編集済み: Brice Kabore 2020 年 5 月 11 日
For translation
[V, F]=stlread("isopoison.stl"); %although the new stlread version gives a different structure
P=(8,0,0)% translate in x by 8
V = V+ P
For scaling
scale=2.0
V=V*scale% or V(:,1)=V(:,1)*scale
For rotatation you can use this function basically creating a rotation matrix that will be multiplied by V which contain your vertices indice is the axis, 1 for x axis 2 for y ...
function vertex = rotation(V, indice, angle)
% [V, F]=stlread("isopoison.stl");
% angle=-pi/2;
Rz = [ cos(angle), -sin(angle), 0 ;
sin(angle), cos(angle), 0 ;
0, 0, 1 ];
Ry = [ cos(angle), 0, sin(angle) ;
0, 1, 0 ;
-sin(angle), 0, cos(angle) ];
Rx = [ 1, 0, 0 ;
0, cos(angle), -sin(angle);
0, sin(angle), cos(angle) ];
if(indice==1)
vertex = V*Rx;
end
if(indice==2)
vertex = V*Ry;
end
if(indice==3)
vertex = V*Rz;
end
end

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

回答 (1 件)

KSSV
KSSV 2019 年 1 月 30 日
You need to know about geometric transformations...read here https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/geometry/geo-tran.html
  2 件のコメント
Nataliya Perevoshchikova
Nataliya Perevoshchikova 2019 年 1 月 30 日
Thank you KSSV.
Do you think it would be possibel to tranform geometric objects based on new coordinate system? What I mean by this is to create a new coordinate system of two geometrical objects (Wx, Wz, Wy) where Wx and Wx will be based on minimum distance between vertices from two geometris and max distance between vertices of one geometry, respectively. Wz will be multiplication of Wx and Wz. Same way define coordinate system for object which will be fitted. Somehow translate object to objects based on coordinate systems.
KSSV
KSSV 2019 年 1 月 30 日
It should be possible...

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

カテゴリ

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