필터 지우기
필터 지우기

Rotate points about center line to create cylinder

조회 수: 3 (최근 30일)
Diondra
Diondra 2015년 11월 18일
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')

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by