Failed to load a mesh from gptoolbox. I am missing something, what is it?

조회 수: 4 (최근 30일)
% 1. Load a Mesh
[V, F] = readOFF('D:\Conferences and Workshops\SG Summer\MFC - S\codes\gptoolbox-master\gptoolbox-master\mesh.off');
% 2. Display the Mesh
figure;
trisurf(F, V(:,1), V(:,2), V(:,3), 'FaceColor', 'cyan', 'EdgeColor', 'none');
axis equal;
lighting gouraud;
camlight;
title('Original Mesh');
xlabel('X');
ylabel('Y');
zlabel('Z');
% Define the number of iterations and timestep for smoothing
num_iterations = 100;
time_step = 0.01;
% 3. Mean Curvature Flow (MCF) - Explicit Method
V_explicit = V; % Copy the vertices for the explicit method
for iter = 1:num_iterations
% Compute the Laplace-Beltrami operator and mean curvature normal
L = cotmatrix(V_explicit, F);
HN = -L * V_explicit;
% Update vertex positions
V_explicit = V_explicit + time_step * HN;
end
% Display the smoothed mesh - Explicit Method
figure;
trisurf(F, V_explicit(:,1), V_explicit(:,2), V_explicit(:,3), 'FaceColor', 'cyan', 'EdgeColor', 'none');
axis equal;
lighting gouraud;
camlight;
title('MCF - Explicit Method');
xlabel('X');
ylabel('Y');
zlabel('Z');
% 3. Mean Curvature Flow (MCF) - Semi-Implicit Method
V_implicit = V; % Copy the vertices for the implicit method
for iter = 1:num_iterations
% Compute the Laplace-Beltrami operator
L = cotmatrix(V_implicit, F);
% Solve (I - time_step * L) * V_new = V_old
V_implicit = (speye(size(V_implicit, 1)) - time_step * L) \ V_implicit;
end
% Display the smoothed mesh - Semi-Implicit Method
figure;
trisurf(F, V_implicit(:,1), V_implicit(:,2), V_implicit(:,3), 'FaceColor', 'cyan', 'EdgeColor', 'none');
axis equal;
lighting gouraud;
camlight;
title('MCF - Semi-Implicit Method');
xlabel('X');
ylabel('Y');
zlabel('Z');
I get this error:
shittyday (%sorry this is the name of the script)
Error using fscanf
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in readOFF (line 27)
OFFheader = upper(fscanf( fp, '%s\n', 1 ));
Error in shittyday (line 2)
[V, F] = readOFF('D:\Conferences and Workshops\SG Summer\MFC - S\codes\gptoolbox-master\gptoolbox-master\mesh.off');
  댓글 수: 12
ehsan
ehsan 2024년 8월 13일
@VinayYour demo worked and gave this output
ehsan
ehsan 2024년 8월 13일
편집: Walter Roberson 2024년 8월 13일
@Vinay oh, I think there is not any filename.off in the gptoolbox package I downloaded. The package is on this git: https://github.com/geometry-processing/gptoolbox/tree/master

댓글을 달려면 로그인하십시오.

채택된 답변

Vinay
Vinay 2024년 8월 13일
Hii eshan,
The issue is due to the filename is incorrect or not present.You can use the correct file while loading the data in the "load_mesh" function.
You can use different "off" files from the given link
I hope this helps!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by