Question about visualizing surface meshes, questions about MuPAD integration

3 views (last 30 days)
Brian
Brian on 13 Jun 2013
Hello, I want to visualize a mesh shell (not necessarily a STL file, but any mesh triangle surface) file better than I am currently doing it. What I do right now is import the points and connectivity of the surface mesh, and use plot3 to make a system of lines.
This has worked pretty well for meshes around 1MB to 20 MB, but gets horribly slow for anything larger. The data I import are two matrices: a n X 3 of xyz coordinates for one, and a m X 3 matrix of point connectivity. The point matrix has an x coord list in the first column, the y list in the second column, and the z list int the third column. My point connectivity matrix has three column entries in each row with indexes for points, and each row is a triangular element. The number of rows I have directly corresponds to the number of surface triangles I have.
To plot the shell, I use the command:
for i=1:length(vSurfFaceMx)
% Plot
hold on
plot3([ptMx(vSurfFaceMx(i,1),1),ptMx(vSurfFaceMx(i,2),1),ptMx(vSurfFaceMx(i,3),1), ptMx(vSurfFaceMx(i,1),1)], ...
[ptMx(vSurfFaceMx(i,1),2),ptMx(vSurfFaceMx(i,2),2),ptMx(vSurfFaceMx(i,3),2), ptMx(vSurfFaceMx(i,1),2)], ...
[ptMx(vSurfFaceMx(i,1),3),ptMx(vSurfFaceMx(i,2),3),ptMx(vSurfFaceMx(i,3),3), ptMx(vSurfFaceMx(i,1),3)], 'Linewidth', 1);
end
and I take the three column point indexes and their respective coordinates to plot a system of lines.
What I have tried in MuPAD is something very similar, which has a similar loading time but is much more fluid once it plots. To do this, I use the command:
plot::SurfaceSTL(filename, <UseNormals = b>, <a = amin .. amax>, options)
to create a surface plot of a STL. It doesn't seem to load any faster, but once its loaded its much more easy to manipulate.
I was wondering, is there a way to use MuPAD visualization commands from a MATLAB command window? I know that there are evalin and feval commands that you can use:
y = evalin(symengine,'MuPAD_Expression');
But I don't know how to use commands for visualization. Would something along the lines of:
plot3(symengine,'plot(plot::SurfaceSTL("pig shell.stl"), CameraDirection = [15, 13, 22], MeshVisible = TRUE, Filled = FALSE)');
work? I've tried with no avail.
Thanks for your time!

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by