-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_sphere.m
More file actions
24 lines (19 loc) · 732 Bytes
/
get_sphere.m
File metadata and controls
24 lines (19 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function [x, y, z] = get_sphere(radius, height, x_center, y_center)
% get_sphere - generates sphere in 3D.
% x_center - center point of cylinder in x-axis
% y_center - center point of cylinder in y-axis
% height - height of sphere on z-axis, this parameter is used for
% better user experience of visualizing rotation of sphere
% radius - radius of sphere on all x, y and z-axis.
% [x, y, z] - points which are used to visualize sphere using surf
% Mateusz Rzeczyca, AGH University of Science and Technology, 25.01.2020
% Make unit sphere
[x, y, z] = sphere;
% Scale to desire radius.
x = x * radius;
y = y * radius;
z = z * radius * height;
% Translate sphere to new location.
x = x + x_center;
y = y + y_center;
end