How can I create 2D projections from a 3D object?
55 ビュー (過去 30 日間)
古いコメントを表示
I know I can use "radon" for creating 1D projections from 2D, but how can I get 2D projections from 3D objects (such as from a 3D file like an STL file).
0 件のコメント
回答 (2 件)
Mike Garrity
2016 年 5 月 10 日
The basic idea is that you take keep the faces of your geometry, but project the vertices onto the plane. That does mean that you've got multiple conincident polys, so it's not good for things like area computation. But if you just want the visual result, it works well and it's simple.
2 件のコメント
Thomas Cornew
2018 年 5 月 10 日
Hello Mike,
How would I approach this problem if I was trying to solve for the area of the 2d projection?
Naveen Pathak
2021 年 6 月 7 日
Hi Mike,
I have a simliar problem. Please, could you help me to plot the following:
Thank you.
Y.S.
2023 年 3 月 29 日
2 methods I found that I want to place here for future reference:
[1] fast, but only works for convex shapes. Assuming you have a struct (fvIn) with vertices & faces
fvIn.vertices(:,3)=0; % squash all Z coords
verts = fvIn.vertices;
faces = fvIn.faces;
a = verts(faces(:, 2), :) - verts(faces(:, 1), :); % compute area of all triangles
b = verts(faces(:, 3), :) - verts(faces(:, 1), :);
c = cross(a, b, 2);
area2 = 1/2 * sum(sqrt(sum(c.^2, 2))); % Calculate total area, but this gives double the area because the shape is squashed
Ap = area2/2; %
[2] slow, but works for all shapes
Loop over all triangles, project them on the Z=0 plane, create a polyshape and combine(union) it with the other projected triangles
P = fvIn.vertices(fvIn.faces(1,:),1:2);
psSurfTot = polyshape(P);
for N = 2:size(fvIn.faces,1)
P = fvIn.vertices(fvIn.faces(N,:),1:2);
psSurfTMP = polyshape(P);
psSurfTot = union(psSurfTot,psSurfTMP);
end
% calculate projected area
Ap = area(psSurfTot);
I am still looking for a fast method that works for all shapes, but havent found any
2 件のコメント
Naveen Pathak
2023 年 3 月 30 日
Thanks "Y.S." at least you showed a kind gesture.
Matlab people are worth-less to help.
However, I have already solved this problem few months ago :)
Seung Jae Lee
2023 年 4 月 5 日
Hi, Naveen. How could you solve this problem? Can you please share your findings?
参考
カテゴリ
Help Center および File Exchange で Map Display についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!