Algosim documentation: sphere

sphere

Creates a new sphere.

Syntax

Description

sphere(a, r) creates a sphere of radius r centred at a.

If omitted, a defaults to ❨0, 0, 0❩ and r to 1.

Consequently, sphere(a, r) is equivalent to ellipsoid(a, ❨r, r, r❩).

The object is shown in the current scene and a reference to the object is returned.

The AdjustVisual function can be used to adjust the appearance of the sphere. See Visual settings for a list of applicable settings.

Examples

sphere()

Image 1

scene("balls"); for(k, 1, 10, sphere(10⋅RandomVector(3), RandomReal())); scene("balls")

Image 2

scene("balls"); for(k, −10, 10, if(k ≠ 0, sphere(❨0, 0, k❩, abs(k)/2.5))); scene("balls")

Image 3

See also