Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# `plot`::`Waterman`

Waterman polyhedra

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```plot::Waterman(`r`, <`a = amin .. amax`>, `options`)
```

## Description

`plot::Waterman(r)` creates the Waterman polyhedron of radius r.

Waterman polyhedra, invented around 1990 by Steve Waterman, form a vast family of polyhedra. Some of them have a number of nice properties like multiple symmetries, or very interesting and regular shapes. Some other are just a bunch of faces formed out of irregular convex polygons.

Waterman polyhedra result from the examination of balls in face-centered cubic close packing (which is one of the two densest packings of equally sized balls in 3D space, according to the Kepler Conjecture, proofed by Hales and Ferguson, 1997-2005). A single layer of spheres (of radius ) in this packing looks like this:

The close packing results from placing several of these layers over one another, shifted to optimally fill the gaps (in very much the same way your grocery store puts apples and oranges on display):

Given a radius r and a center c (which we let default to [0, 0, 0]), now consider all those centers of spheres in this packing which fall into the sphere of radius r around c:

The convex hull of these points is the Waterman polyhedron of the given radius and center:

## Attributes

AttributePurposeDefault Value
`AffectViewingBox`influence of objects on the `ViewingBox` of a scene`TRUE`
`Center`center of objects, rotation center[`0`, `0`, `0`]
`CenterX`center of objects, rotation center, x-component`0`
`CenterY`center of objects, rotation center, y-component`0`
`CenterZ`center of objects, rotation center, z-component`0`
`Color`the main color`RGB::SafetyOrange`
`Filled`filled or transparent areas and surfaces`TRUE`
`FillColor`color of areas and surfaces`RGB::SafetyOrange`
`FillColor2`second color of areas and surfaces for color blends`RGB::CornflowerBlue`
`FillColorType`surface filling types`Flat`
`FillColorFunction`functional area/surface coloring
`FillColorDirection`the direction of color transitions on surfaces[`0`, `0`, `1`]
`FillColorDirectionX`x-component of the direction of color transitions on surfaces`0`
`FillColorDirectionY`y-component of the direction of color transitions on surfaces`0`
`FillColorDirectionZ`z-component of the direction of color transitions on surfaces`1`
`Frames`the number of frames in an animation`50`
`Legend`makes a legend entry
`LegendText`short explanatory text for legend
`LegendEntry`add this object to the legend?`FALSE`
`LineColor`color of lines`RGB::Grey40.[0.4]`
`LineWidth`width of lines`0.25`
`LineColor2`color of lines`RGB::DeepPink`
`LineStyle`solid, dashed or dotted lines?`Solid`
`LinesVisible`visibility of lines`TRUE`
`LineColorType`line coloring types`Flat`
`LineColorFunction`functional line coloring
`LineColorDirection`the direction of color transitions on lines[`0`, `1`, `1`]
`LineColorDirectionX`x-component of the direction of color transitions on lines`0`
`LineColorDirectionY`y-component of the direction of color transitions on lines`1`
`LineColorDirectionZ`z-component of the direction of color transitions on lines`1`
`Name`the name of a plot object (for browser and legend)
`ParameterEnd`end value of the animation parameter
`ParameterName`name of the animation parameter
`ParameterBegin`initial value of the animation parameter
`ParameterRange`range of the animation parameter
`PointSize`the size of points`1.5`
`PointStyle`the presentation style of points`FilledCircles`
`PointsVisible`visibility of mesh points`FALSE`
`Radius`radius of circles, spheres etc.
`Shading`smooth color blend of surfaces`Smooth`
`TimeEnd`end time of the animation`10.0`
`TimeBegin`start time of the animation`0.0`
`TimeRange`the real time span of an animation`0.0` .. `10.0`
`Title`object title
`TitleFont`font of object titles[`" sans-serif "`, `11`]
`TitlePosition`position of object titles
`TitleAlignment`horizontal alignment of titles w.r.t. their coordinates`Center`
`TitlePositionX`position of object titles, x component
`TitlePositionY`position of object titles, y component
`TitlePositionZ`position of object titles, z component
`Visible`visibility`TRUE`
`VisibleAfter`object visible after this time value
`VisibleBefore`object visible until this time value
`VisibleFromTo`object visible during this time range
`VisibleAfterEnd`object visible after its animation time ended?`TRUE`
`VisibleBeforeBegin`object visible before its animation time starts?`TRUE`

## Examples

### Example 1

With increasing radius, Waterman polyhedra get ever closer to spheres:

```plot(plot::Waterman(r, r=0..10, PointsVisible, PointSize=1, LineColor=RGB::Black, Color=RGB::Red.[0.75]), plot::Sphere(r, [0,0,0], r=0..10, Color=RGB::Yellow.[0.3]), CameraDirection=[2,10,1])```

### Example 2

Waterman polyhedra have a rather general definition and can be made from spheres centered anywhere:

`plot(plot::Waterman(5, Center=[0,0,0]))`

`plot(plot::Waterman(5, Center=[0,0,1]))`

To translate or scale a Waterman polyhedron, use `plot::Translate3d` and `plot::Scale3d`:

```n := 3: r := i -> 3/2+sqrt(i+1): plot(plot::Translate3d([i mod n, i div n, 0], plot::Scale3d([1/(3*r(i)) \$ 3], plot::Waterman(r(i), Color=RGB::random()))) \$ i = 0..n^2-1, Axes=None)```

### Example 3

As usual, many attributes can be animated, although by the nature of Waterman polyhedra, the resulting animation will not be smooth:

```plot(plot::Waterman(5, Center=[a/PI, cos(a), 0], a=0..2*PI), AnimationStyle=BackAndForth, CameraDirection=[0,0.1,1])```

### Example 4

The `LineColorFunction` and `FillColorFunction` attributes can be set to functions which get indices of the currently painted surfacepolygon and its current vertex as fourth and fifth argument, repectively. This allows to color the polygons individually:

```colors := [RGB::random() \$ i = 1..42]: plot(plot::Waterman(5, FillColorFunction=((x,y,z,i) -> colors[i])))```

Another way of getting random colors which remain constant for each polygon is to use a procedure with `option remember`:

```col := proc(n) option remember; begin RGB::fromHSV([360*frandom(), 1, 1]); end: plot(plot::Waterman(7, FillColorFunction=((x,y,z,i) -> col(i))))```

## Parameters

 `r` An arithmetical expression: the radius of the polyhedron (see below for details). `r` is equivalent to the attribute `Radius`. `a` Animation parameter, specified as `a```` = amin..amax```, where `amin` is the initial parameter value, and `amax` is the final parameter value.

## Algorithms

`plot::Waterman` uses `plot::hull` (and therefore, the Geometry Centre's qhull code) to compute the convex hull of the coordinates. Most of the remaining code has been contributed by Mirek Majewski.