필터 지우기
필터 지우기

Creating Surface From Bounding Planes

조회 수: 1 (최근 30일)
ALis
ALis 2024년 1월 24일
댓글: ALis 2024년 1월 29일
Hello,
I have a 4d plot of points (NxNxNxN) for a given set of conditions. Calculating a set of points for each instance is computationally intensive. Is there a way for me to make a transparent hull while keeping the GPM color association of the outer surface? I tried convex hull but I didn't like the triangulated look of the mesh and couldn't figure out how to get the 4th dimension to display correctly.
  댓글 수: 2
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2024년 1월 24일
Is that really 4D plot or 3D?
Matt J
Matt J 2024년 1월 24일
4D if you inlcude the spatial color variation, I suppose...

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

채택된 답변

nick
nick 2024년 1월 29일
Hi Alis,
I understand from your query that you are interested in plotting transparent hull of the 4d plot with the color association. You prefer to avoid using a convex hull due to the triangulated appearance of the mesh edges.
You can eliminate the triangular mesh edges by setting the "EdgeColor" property of "trisurf" to "none" and proceed with the convex hull. Additionally, you can set "FaceAlpha" to 0.5 to create a semi-transparent surface. Here is an example demonstrating how to set the surface color:
% Generate some example 3D data
num_points = 100; % Number of points
points = rand(num_points, 3) * 100; % Random points in a 100x100x100 cube
% Generate random GPM values between 50 and 200 for each point
gpm_values = 50 + (200-50) * rand(num_points, 1);
% Calculate the convex hull
[K, v] = convhull(points);
% Map GPM values to a colormap. Adjust the range [50, 200] if necessary.
gpm_colormap = gpm_values; % This will be used for color association
gpm_colormap(gpm_colormap < 50) = 50; % Thresholding values below 50 to 50
gpm_colormap(gpm_colormap > 200) = 200; % Thresholding values above 200 to 200
% Create a figure
figure;
% Plot the convex hull with GPM color association
trisurf(K, points(:,1), points(:,2), points(:,3), gpm_colormap, 'FaceAlpha', 0.5, 'EdgeColor', 'none');
% Set the colormap (you may choose a different colormap if you wish)
colormap(jet(256));
% Add a colorbar to the figure to show the GPM value association
colorbar;
caxis([50, 200]); % Set the color axis scaling to match the GPM range
% Label the axes for clarity
xlabel('X-axis');
ylabel('Y-axis');
zlabel('Z-axis');
title('Convex Hull with GPM Color Association');
You may refer to the following documentation to learn more about the "trisurf" function :
Hope this helps.
  댓글 수: 1
ALis
ALis 2024년 1월 29일
Perfect, exactly what I needed. Wasn't aware that I could remove the triangulation of trisurf. Thank you very much!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by