Project the areas on the 3d model(car)

6 ビュー (過去 30 日間)
Umut Ege Ulucay
Umut Ege Ulucay 2020 年 5 月 7 日
回答済み: darova 2020 年 5 月 15 日
Hello everyone,
I need help about some coding. I have the 3d model of a car and some areas around the car(actually at the side doors in the photo). I want that areas to be in the shape of 3d model. It is actually ok for the side door but imagine plotting it for the front, it would not be as same curvature as the front of the car has. How can I do it? Any ideas? It may be the projection of the areas on 3d model or something? If it even exist.
I use stlRead to read the 3d model and fill3 to plot the areas(as I have x y z coordinates).
  4 件のコメント
darova
darova 2020 年 5 月 12 日
Did you try to cut out the door only? something like inpolygon
clc,clear
cla
d1 = [0.4104 0.6557
0.2142 0.4443
0.2160 0.1739
0.7047 0.1807
0.6934 0.6489
0.4104 0.6557];
xd = d1(:,1);
yd = d1(:,2);
x = rand(100,1);
y = rand(100,1);
in = inpolygon(x,y,xd,yd);
plot(x,y,'.r')
hold on
plot(xd,yd)
plot(x(in),y(in),'or')
hold off
legend('all points','door','points inside')
You can draw the door manually using impoly
p = impoly;
p.getPosition
Umut Ege Ulucay
Umut Ege Ulucay 2020 年 5 月 15 日
Yes, you actually gave me a good idea to change my point of view. I can work with inpolygon but I need to make it in 3d. I will look for it thanks a lot but, you can give me idea if you still have so. Thank you

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

採用された回答

darova
darova 2020 年 5 月 15 日
Here is a simple example. Should be heplfull
clc,clear
[x,y,z] = sphere(30);
ix = x > 0; % select half of the sphere only
% door coordinates
d1 = [0.4104 0.6557
0.2142 0.4443
0.2160 0.1739
0.7047 0.1807
0.6934 0.6489
0.4104 0.6557];
yd = d1(:,1)-0.5;
zd = d1(:,2);
gd = [2; length(yd); yd(:); zd(:)]; % door geometry
dl = decsg(gd); % decomposition of geometry
[p,e,t] = initmesh(dl); % create mesh
ydt = p(1,:)'; % Y coord of the door
zdt = p(2,:)'; % Z coord of the door
xdt = griddata(y(ix),z(ix),x(ix),ydt,zdt); % interpolate X coord
ff.vertices = [xdt ydt zdt];
ff.faces = t(1:3,:)';
ff.facecolor= 'yellow';
surf(x,y,z,'facecolor','none','edgecolor',[1 1 1]*0.8)
line(yd*0+1.2,yd,zd,'linew',2)
patch(ff)
axis vis3d equal

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurfaces, Volumes, and Polygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by