Rotate points about center line to create cylinder
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have the code below which outputs this kind of ellipse-shaped scatter plot. I'd like to ultimately rotate the arrays holding the points a number of times to create a 3D representation - something like a cylinder or ellipse. I believe this can be done by rotating around the yz plane but so far my attempts have yielding nothing. Any help would be greatly appreciated.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/151928/image.jpeg)
subplot(5, 2, k); hold off;
[x_comp, y_comp, intensity] = improfile(I, normal_x, normal_y);
values = [x_comp, y_comp, intensity];
improfile(I, normal_x, normal_y), grid on;
title(['Voxel Gradients along Ray ' num2str(k) ' '])
xlabel('x')
ylabel('y')
zlabel('Intensity')
first_index = find(intensity > 65, 1, 'first');
last_index = find(intensity > 65, 1, 'last');
first_x(k) = x_comp(first_index);
first_y(k) = y_comp(first_index);
last_x(k) = x_comp(last_index);
last_y(k) = y_comp(last_index);
first = horzcat(first_x, first_y);
last = horzcat(last_x, last_y);
end
pause(2);
close
bounds = vertcat(first, last);
add = ones(size(bounds, 1), 1);
bounds = horzcat(bounds, add);
bounds_x = bounds(:, 1);
bounds_y = bounds(:, 2);
bounds_z = bounds(:, 3);
imshow(I, []); hold on;
scatter(bounds_x, bounds_y, '*', 'r')
title('Cylinder Boundary Points')
xlabel('x')
ylabel('y')
hold off;
close
figure
rotate3d on
scatter3(bounds_x, bounds_y, bounds_z, '*', 'r')
hold on;
xlabel('x')
ylabel('y')
zlabel('z')
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!