Rotate points about center line to create cylinder

2 visualizzazioni (ultimi 30 giorni)
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.
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')

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by