<< secto3d 3d_plot surf >>

Scilab Help >> Biblioteca de Gráficos > 3d_plot > sphere

sphere

Computes sphere coordinates

Syntax

[x, y, z] = sphere(n)

Arguments

n

Number of faces. Default value is 20.

Can be scalar or a vector of size 1 x 2 (number of faces for longitude and latitude)

x, y, z

Computed coordinates returned as (n+1) x (n+1) matrices.

Description

sphere returns the Cartesian coordinates of a sphere (without drawing it). The returned sphere has a radius equal to 1 and is centered on origin.

Examples

Sphere centered on origin with radius equal to 1:

scf();
[x, y, z] = sphere(40);
surf(x, y, z);
gcf().color_map = jet(64);
gca().isoview = "on";

Sphere centered on origin with radius equal to 3:

scf();
[x, y, z] = sphere(40);
surf(3 * x, 3 * y, 3 * z);
gcf().color_map = parula(64);
gca().isoview = "on";

Sphere centered on (1,2,3) with radius equal to 1:

scf();
[x, y, z] = sphere(40);
surf(x + 1, y + 2, z + 3);
gcf().color_map = autumn(64);
gca().isoview = "on";

Sphere centered on origin with a vector n:

scf();
[x, y, z] = sphere([20 40]);
surf(x, y, z);
gcf().color_map = parula(64);
gca().isoview = "on";

See also

History

VersionDescription
2025.1.0 Function sphere introduced.

Report an issue
<< secto3d 3d_plot surf >>