en fr

# Library - solids

Library solids implements functions which create solid shapes in 3D. Solids are generated with parametric equations and displayed with surf. When called without output argument, with an optional trailing string argument for the edge style, the solid is displayed with the current scaling and color map. With output arguments, arrays X, Y, Z expected by surf or mesh are produced. They can be modified to move, scale or stretch the solids.

The following statement makes available functions defined in solids:

use solids

## Functions

### cone

Cone.

#### Syntax

use solids
cone
cone(cap)
cone(cap, n)
cone(cap, n, style)
(X, Y, Z) = cone
(X, Y, Z) = cone(n)

#### Description

Without output argument, cone draws a cone approximated by a polyhedron. The optional first input argument, a logical value which is true by default, specifies if the cap is included. The optional second input argument, an integer, specifies the number of discrete values for the parameter which describes its surface.

By default, edges are not drawn. An optional third input argument, a string, specifies the edge style; it corresponds to the style argument of surf.

With three output arguments, cone produces the X, Y, and Z arrays expected by surf or mesh, and it does not display anything.

### crosscap

Cross-cap.

#### Syntax

use solids
crosscap
crosscap(n)
crosscap(n, style)
(X, Y, Z) = crosscap
(X, Y, Z) = crosscap(n)

#### Description

Without output argument, crosscap draws a cross-cap (a self-intersecting surface) approximated by a polyhedron. With an input argument, crosscap(n) draws a cross-cap where the two parameters which describe its surface are sampled with n discrete values.

By default, edges are not drawn. An optional second input argument, a string, specifies the edge style; it corresponds to the style argument of surf.

With three output arguments, crosscap produces the X, Y, and Z arrays expected by surf or mesh, and it does not display anything.

### cylinder

Cylinder.

#### Syntax

use solids
cylinder
cylinder(cap)
cylinder(cap, n)
cylinder(cap, n, style)
(X, Y, Z) = cylinder
(X, Y, Z) = cylinder(n)

#### Description

Without output argument, cylinder draws a cylinder approximated by a polyhedron. The optional first input argument, a logical value which is true by default, specifies if caps are included. The optional second input argument, an integer, specifies the number of discrete values for the parameter which describes its surface.

By default, edges are not drawn. An optional third input argument, a string, specifies the edge style; it corresponds to the style argument of surf.

With three output arguments, cylinder produces the X, Y, and Z arrays expected by surf or mesh, and it does not display anything.

### klein

Klein bottle.

#### Syntax

use solids
klein
klein(p)
klein(p, n)
klein(p, n, style)
(X, Y, Z) = ...

#### Description

Without output argument, klein draws a Klein bottle approximated by a polyhedron. With an input argument, klein(p) uses parameters stored in structure p. The following fields are used:

FieldDescriptionDefault value
dtube variation0.5
hhalf height3

With two input arguments, klein(p,n) draws a Klein bottle where the two parameters which describe its surface are sampled with n discrete values.

By default, edges are not drawn. An optional third input argument, a string, specifies the edge style; it corresponds to the style argument of surf.

With three output arguments, klein produces the X, Y, and Z arrays expected by surf or mesh, and it does not display anything.

### klein8

Figure 8 Klein bottle immersion.

#### Syntax

use solids
klein8
klein8(r)
klein8(r, n)
klein8(r, n, style)
(X, Y, Z) = ...

#### Description

Without output argument, klein8 draws a figure 8 Klein bottle immersion (a closed, self-intersecting surface with one face) approximated by a polyhedron. With an input argument, klein8(r) draws the surface with a main radius of r (the default value is 1).

With two input arguments, klein8(r,n) samples the two parameters which describe its surface with n discrete values.

By default, edges are not drawn. An optional third input argument, a string, specifies the edge style; it corresponds to the style argument of surf.

With three output arguments, klein8 produces the X, Y, and Z arrays expected by surf or mesh, and it does not display anything.

### sphere

Sphere.

#### Syntax

use solids
sphere
sphere(n)
sphere(n, style)
(X, Y, Z) = sphere
(X, Y, Z) = sphere(n)

#### Description

Without output argument, sphere draws a sphere approximated by a polyhedron. With an input argument, sphere(n) draws a sphere where the two parameters which describe its surface are sampled with n discrete values.

By default, edges are not drawn. An optional second input argument, a string, specifies the edge style; it corresponds to the style argument of surf.

With three output arguments, sphere produces the X, Y, and Z arrays expected by surf or mesh, and it does not display anything.

### sphericon

Sphericon.

#### Syntax

use solids
sphericon
sphericon(n)
sphericon(n, style)
(X, Y, Z) = sphericon
(X, Y, Z) = sphericon(n)

#### Description

Without output argument, sphericon draws a sphericon (a 3D shape made from a bicone with a 90-degree apex, cut by a plane containing both apices, where one half is rotated by 90 degrees) approximated by a polyhedron. With an input argument, sphericon(n) draws a sphericon where the two parameters which describe its surface are sampled with n discrete values.

By default, edges are not drawn. An optional second input argument, a string, specifies the edge style; it corresponds to the style argument of surf.

With three output arguments, sphericon produces the X, Y, and Z arrays expected by surf or mesh, and it does not display anything.

### torus

Torus.

#### Syntax

use solids
torus
torus(r)
torus(r, n)
torus(r, n, style)
(X, Y, Z) = ...

#### Description

Without output argument, torus draws a torus approximated by a polyhedron with a main radius of 1 and a tube radius of 0.5. With an input argument, torus(r) draws a torus with tube radius r. With two input arguments, torus(r,n) draws a torus where the two parameters which describe its surface are sampled with n discrete values.

By default, edges are not drawn. An optional third input argument, a string, specifies the edge style; it corresponds to the style argument of surf.

With three output arguments, torus produces the X, Y, and Z arrays expected by surf or mesh, and it does not display anything.