# Documentation

### This is machine translation

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

# `plot`::`Implicit3d`

Contour surfaces of a function from R^3 to R

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::Implicit3d(`f`, `x = xmin .. xmax`, `y = ymin .. ymax`, `z = zmin .. zmax`, <`a = amin .. amax`>, `options`)
```

## Description

```plot::Implicit3d(f(x, y, z), x = xmin..xmax , y = ymin..ymax , z = zmin..zmax )``` plots the surfaces where the smooth function `f` is zero.

```plot::Implicit3d(f, x = xmin..xmax , y = ymin..ymax , z = zmin..zmax )``` plots the (two-dimensional part of the) zeroes of f in the given range, i.e., the set .

`plot::Implicit3d` assumes that f is regular almost everywhere on this surface, which means that f must be differentiable and at least two of its partial derivatives must be nonzero.

`plot::Implicit3d` evaluates the given function on an equidistant, three-dimensional mesh, the coarsity of which can be set with the attributes `XMesh`, `YMesh`, and `ZMesh` for each of the three directions, or with the combining attribute `Mesh` that sets all three of these simultaneously.

After finding an initial triangulation of the surface from the numerical data on the initial grid, `plot::Implicit3d` optionally performs adaptive subdivision of the triangles. To make a long story short: If the initial calculation misses details altogether, adaptive refinement will not find them either. On the other hand, if the initial calculation shows spurious spikes, adaptive refinement will result in a much more realistic image, at the expense of time; the higher the value of `AdaptiveMesh`, the more. Increasing `AdaptiveMesh` by one may in extreme cases increase calculation time by a factor of eight or more!

The details of the algorithm are as follows: On top level, the “effective adaptive level” is set to the value of the attribute `AdaptiveMesh`. If, for a given edge, the effective adaptive level is positive and the edge is not very short already, compared with the size of the complete image, and inserting a new point on the implicit surface near the middle of this edge would cause the two new edges to have an angle of less than 170 degrees, then the edge is split, the adjoining triangles are split accordingly (taking into account all their edges) and all the new edges caused by this operation are examined with an effective adaptive level reduced by one.

To plot other contours than zeroes, use the option `Contours`.

## Attributes

AttributePurposeDefault Value
`AdaptiveMesh`adaptive sampling`0`
`AffectViewingBox`influence of objects on the `ViewingBox` of a scene`TRUE`
`Color`the main color`RGB::Red`
`Contours`the contours of an implicit function[`0`]
`Filled`filled or transparent areas and surfaces`TRUE`
`FillColor`color of areas and surfaces`RGB::Red`
`FillColor2`second color of areas and surfaces for color blends`RGB::CornflowerBlue`
`FillColorType`surface filling types`Dichromatic`
`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`
`Function`function expression or procedure
`Legend`makes a legend entry
`LegendText`short explanatory text for legend
`LegendEntry`add this object to the legend?`TRUE`
`LineColor`color of lines`RGB::Black.[0.15]`
`LineWidth`width of lines`0.35`
`LineColor2`color of lines`RGB::DeepPink`
`LineStyle`solid, dashed or dotted lines?`Solid`
`LineColorType`line coloring types`Flat`
`LineColorFunction`functional line coloring
`LineColorDirection`the direction of color transitions on lines[`0`, `0`, `1`]
`LineColorDirectionX`x-component of the direction of color transitions on lines`0`
`LineColorDirectionY`y-component of the direction of color transitions on lines`0`
`LineColorDirectionZ`z-component of the direction of color transitions on lines`1`
`Mesh`number of sample points[`11`, `11`, `11`]
`MeshVisible`visibility of irregular mesh lines in 3D`FALSE`
`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
`PointStyle`the presentation style of points`FilledCircles`
`PointsVisible`visibility of mesh points`FALSE`
`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`
`XContours`contour lines at constant x values[`Automatic`, `15`]
`XMax`final value of parameter “x”
`XMesh`number of sample points for parameter “x”`11`
`XMin`initial value of parameter “x”
`XName`name of parameter “x”
`XRange`range of parameter “x”
`YContours`contour lines at constant y values[`Automatic`, `15`]
`YMax`final value of parameter “y”
`YMesh`number of sample points for parameter “y”`11`
`YMin`initial value of parameter “y”
`YName`name of parameter “y”
`YRange`range of parameter “y”
`ZContours`contour lines at constant z values[`Automatic`, `15`]
`ZMax`final value of parameter “z”
`ZMesh`number of sample points for parameter “z”`11`
`ZMin`initial value of parameter “z”
`ZName`name of parameter “z”
`ZRange`range of parameter “z”

## Examples

### Example 1

The set of x, y, z where x2 + y2 + z2 = 1 form a sphere:

```plot(plot::Implicit3d(x^2 + y^2 + z^2 - 1, x = -1.5..1.5, y = -1.5..1.5, z = -1.5..1.5), Scaling = Constrained)```

### Example 2

The set of zeroes of a product is the union of the zeroes of the individual functions:

```plot(plot::Implicit3d((x^2 + y^2 + z^2 - 1) * x, x = -1.5..1.5, y = -1.5..1.5, z = -1.5..1.5), Scaling = Constrained)```

Note that this image is largely dominated by artifacts caused by the coarse evaluation mesh. Increasing this mesh improves the graphics, but increases computation time:

```plot(plot::Implicit3d((x^2 + y^2 + z^2 - 1) * x, x = -1.5..1.5, y = -1.5..1.5, z = -1.5..1.5, Mesh = [21, 9, 9], AdaptiveMesh = 2), Scaling = Constrained)```

### Example 3

With `MeshVisible = TRUE`, the internal triangulation becomes visible:

```plot(plot::Implicit3d(z^2 - sin(z - x^2*y^2) = 0, x = -1 .. 1, y = -1 .. 1, z = 0 .. 1, AdaptiveMesh = 2, MeshVisible = TRUE, LineColor = RGB::Black.[0.25])):```

### Example 4

Using functions that are not continuously differentiable, it is possible to generate sharp edges in the images:

```plot(plot::Implicit3d(min(x^2 + y^2 + z^2 - 2, -z), x = -2..2, y = -2..2, z = -1.5..0.5), Axes = None, Scaling = Constrained)```

Just like in the preceding example, these sharp corners are prime sources of artifacts, which may require a finer initial mesh and/or adaptive mesh refinement:

```im := plot::Implicit3d(min(x^2 + y, y^2 - z), x = -2..2, y = -2..2, z = 0..1): plot(im)```

`plot(im, AdaptiveMesh = 3)`

### Example 5

Animating `plot::Implicit3d` objects takes a lot of time. It is easy and fast, though, to add an animated camera object:

```plot(plot::Implicit3d(sin(x)+sin(y)+sin(z), x=-5..5, y=-5..5, z=-5..5), plot::Camera([42*sin(t),42*cos(t),42*cos(t-sin(t))], [0,0,0], PI/12, t=0..2*PI), AnimationStyle=Loop)```

## Parameters

 `f` A real-valued expression or an equation in `x`, `y`, `z`, and possibly the animation parameter. `f` is equivalent to the attribute `Function`. `x`, `y`, `z` `x`, `y`, `z` are equivalent to the attributes `XName`, `YName`, `ZName`. `xmin .. xmax`, `ymin .. ymax`, `zmin .. zmax` Real-valued expressions, possibly in the animation parameter. The image is plotted with `x` in the range ```xmin ≤ x ≤ xmax```, ```ymin ≤ y ≤ ymax``` and ```zmin ≤ z ≤ zmax```. `xmin` .. `xmax`, `ymin` .. `ymax`, `zmin` .. `zmax` are equivalent to the attributes `XRange`, `XMin`, `XMax`, `YRange`, `YMin`, `YMax`, `ZRange`, `ZMin`, `ZMax`. `a` Animation parameter, specified as `a```` = amin..amax```, where `amin` is the initial parameter value, and `amax` is the final parameter value.