Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.1.0 - English


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

  • nf3d — Rectangular facets to plot3d parameters
  • surf — 3D surface plot
  • cylinder — Computes cylinder coordinates

History

VersionDescription
2025.1.0 Function sphere introduced.
Report an issue
<< secto3d 3d_plot surf >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu May 22 12:51:00 CEST 2025