How to write axes on an imported mesh

Hello everyone,
I need help on a specific topic on Matlab.
I need to import on Matlab a meshed sphera created in Rhino7 and to insert in Matlab an axis passing through that sphera.
How can I insert the axis?
Thank you in advance

10 Comments

Can you show/attach illustration/code/datafiles that we can see and touch what you're dealing with?
In MATLAB, the axes is an object into which objects are placed and are children of; not the other way 'round; you don't place an axes onto an object; there are no graphics that aren't an axes in a figure.
So, to display this external object in the beginning it would have to have displayed in an axes already -- unless, of course, it's some external object of its own that MATLAB has no way to import and so you're stuck at that point.
Anyways, need to start off with showing us what this thing is and from whence it came...
Geraldina Berti
Geraldina Berti on 27 Sep 2023
Moved: dpb on 27 Sep 2023
Geraldina Berti
Geraldina Berti on 27 Sep 2023
Moved: dpb on 27 Sep 2023
But we need code as text (paste and format with the "CODE" button (the LH icon in section that's to represent indented code lines) and then attach the image file with the paperclip in "INSERT" section.
Geraldina Berti
Geraldina Berti on 27 Sep 2023
Moved: dpb on 27 Sep 2023
to make you understand my statement, I have to put this meshed object on matlab and I need to define and axis passing through its center and another axis (parallel to the first one) at a certain distance; later on I'll have to give the nodes a certain angular velocity with respect to those axis in order to make the body rotate.
Sfera=fullfile(toolboxdir('lidar'),'lidardata', ...
'surfaceMesh','Sfera.stl');
mesh=readSurfaceMesh(Sfera)
surfaceMeshShow(mesh)
It's not possible to attach a .stl file
You can zip it first...or save the resulting mesh object you read as a .mat file and attach it. "More than one way to skin a cat..." :)
unzip('Analisi Matlab.zip')
mesh=readSurfaceMesh('Analisi Matlab')
readSurfaceMesh requires Lidar Toolbox.
surfaceMeshShow(mesh)
Looks as though the Lidar TB isn't available to the Answers forum interactive session....
Maybe you need this folder too

Sign in to comment.

Answers (1)

You can use quiver3. In the example below I plot the 3 coordinate axes, you can modify accoridng to your vectors
clear variables, close all
% unzip
unzip('Sfera.zip');
% load stl file
tri = stlread('Sfera.stl');
% plot triangulation
figure, axis equal, hold on
view([1 1 1])
trisurf(tri,'FaceAlpha',0.5);
% plot three coordinate axes
vx = [1 0 0];
vy = [0 1 0];
vz = [0 0 1];
quiver3([0 0 0],[0 0 0],[0 0 0],... % starting points
[vx(1) vy(1) vz(1)],[vx(2) vy(2) vz(2)],[vx(3) vy(3) vz(3)],... % vectors
10,... % scaling
'filled','LineWidth',3); % appearance params

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products

Release

R2023b

Asked:

on 27 Sep 2023

Edited:

on 28 Sep 2023

Community Treasure Hunt

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

Start Hunting!