How to post-process output data of SurfaceIntersection function???
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Still looking for answer:
In the example Surface/Surface Intersection of the function SurfaceIntersection by Jaroslaw Tuszynski to find intersection between two objects( #2 and #3).
% Create Surface#1
[x,y] = pol2cart((0:2)'*2*pi/3,40);
Surface1.vertices = [0 0 110; x y [0; 0; 0]];
Surface1.faces = [1 2 3; 1 3 4; 1 4 2; 2 3 4];
%Create Surface #2
load tetmesh;
TR = triangulation(tet,X);
[Surface2.faces, Surface2.vertices] = freeBoundary(TR);
% Create Surface #3
Surface3.vertices = [x y [30; 30; 30]; y x [60; 60; 60]];
Surface3.faces = [1:3;4:6];
% Plot them
clf; hold on
%S=Surface1; trisurf(S.faces, S.vertices(:,1),S.vertices(:,2),S.vertices(:,3),'FaceAlpha', 0.5, 'FaceColor', 'r');
S=Surface2; trisurf(S.faces, S.vertices(:,1),S.vertices(:,2),S.vertices(:,3),'FaceAlpha', 0.5, 'FaceColor', 'g');
S=Surface3; trisurf(S.faces, S.vertices(:,1),S.vertices(:,2),S.vertices(:,3),'FaceAlpha', 0.5, 'FaceColor', 'b');
view([3 1 1])
axis equal
title ('Three test surfaces')
legend({'#2', '#3'});
%[intersect12, Surf12] = SurfaceIntersection(Surface1, Surface2);
%[intersect13, Surf13] = SurfaceIntersection(Surface1, Surface3);
[intersect23, Surf23] = SurfaceIntersection(Surface3, Surface2);
clf; hold on
%S=Surf12; trisurf(S.faces, S.vertices(:,1),S.vertices(:,2),S.vertices(:,3),'EdgeColor', 'r', 'FaceColor', 'r');
%S=Surf13; trisurf(S.faces, S.vertices(:,1),S.vertices(:,2),S.vertices(:,3),'EdgeColor', 'g', 'FaceColor', 'g');
S=Surf23; trisurf(S.faces, S.vertices(:,1),S.vertices(:,2),S.vertices(:,3),'EdgeColor', 'b', 'FaceColor', 'b');
title ('Surface/Surface intersections')
legend({'#2/#3'});
view([3 1 1])
axis equal
zlim([0 80])
The result Surf23.edges is (60x2 double) array, every row represents the ID# of points that make the edge of intersection Surface#2 and Surface#3. These edges (blue lines) look like 5 separate continuous groups in the plot, which represents the free boundary of the legs of Surface#2. as shown in the pictures attached.
What I'm wishing for is to post process the data points of these 5 lines(continuous polygons of edges) and store it in a (C= 5x1 cell) array. each line (continuous polygons of edges) is (Nx3 double) inside the C array? Sorted from beginning to end in one direction (CW or CCW)
In other words, how can I get every group of continuous polygon in a separate (Nx3 double) array.Sorted from beginning to end in one direction (CW or CCW)?
And in general, if there was more than 5 continuous lines (continuous polygons of edges), is it possible to have every continuous line in a separate double array Nx3 ,as long as they are connected through a vertex, ? and these double arrays will be inside Cell array=Mx1, where M=Number of lines (continuous polygons)??
Help would be appreciated.
Thank you so much.
3 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!