Triangular mesh between points
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have the XYZ coordinates of a set of points if joined create the shape shown in the image, i was thinking of copying this array and changing the Z Value to generate the exact same shape at a different Z value. But i need help in generating a triangular mesh between these two shapes similar to the image attached
1 Kommentar
Antworten (1)
Vinayak
am 4 Jan. 2024
Hi Ahmed,
As you have not attached the images or data, the below code assumes you have a shape with 10 points in the form of a 10X3 matrix. I modifed the third column (z-index) while creating a new shape.
% Sample Shape (Decagon)
theta = linspace(0, 2*pi, 10); % 10 points to create the star
radius1 = 1;
x1 = radius1 * cos(theta);
y1 = radius1 * sin(theta);
z1 = zeros(size(x1)); % Set a constant height for Shape 1
shape1 = [x1', y1', z1'];
% Slightly modify Z values for Shape 2
shape2 = shape1;
shape2(:, 3) = shape2(:, 3) + 5 * rand(size(shape1, 1), 1);
% Combine points
combinedPoints = [shape1; shape2];
triangulation = delaunayTriangulation(combinedPoints(:, 1), combinedPoints(:, 2), combinedPoints(:, 3));
% Plot the original shapes
figure;
scatter3(shape1(:, 1), shape1(:, 2), shape1(:, 3), 'r', 'filled');
hold on;
scatter3(shape2(:, 1), shape2(:, 2), shape2(:, 3), 'b', 'filled');
tetramesh(triangulation,'FaceAlpha',0.1);
0 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!