Credits | Overview | Plotting Styles | Commands | Terminals |
---|
The set hidden3d command enables hidden line removal for surface plotting (see splot). Some optional features of the underlying algorithm can also be controlled using this command.
Syntax:
set hidden3d {defaults} | { {front|back} {{offset <offset>} | {nooffset}} {trianglepattern <bitpattern>} {{undefined <level>} | {noundefined}} {{no}altdiagonal} {{no}bentover} } unset hidden3d show hidden3d
In contrast to the usual display in gnuplot, hidden line removal actually treats the given function or data grids as real surfaces that can't be seen through, so plot elements behind the surface will be hidden by it. For this to work, the surface needs to have 'grid structure' (see splot datafile about this), and it has to be drawn with lines or with linespoints.
When hidden3d is set, both the hidden portion of the surface and possibly its contours drawn on the base (see set contour) as well as the grid will be hidden. Each surface has its hidden parts removed with respect to itself and to other surfaces, if more than one surface is plotted. Contours drawn on the surface (set contour surface) don't work.
hidden3d also affects 3D plotting styles points, labels, vectors, and impulses even if no surface is present in the graph. Unobscured portions of each vector are drawn as line segments (no arrowheads). Individual plots within the graph may be explicitly excluded from this processing by appending the extra option nohidden3d to the with specifier.
Hidden3d does not affect solid surfaces drawn using the pm3d mode. To achieve a similar effect purely for pm3d surfaces, use instead set pm3d depthorder. To mix pm3d surfaces with normal hidden3d processing, use the option set hidden3d front to force all elements included in hidden3d processing to be drawn after any remaining plot elements, including the pm3d surface.
Functions are evaluated at isoline intersections. The algorithm interpolates linearly between function points or data points when determining the visible line segments. This means that the appearance of a function may be different when plotted with hidden3d than when plotted with nohidden3d because in the latter case functions are evaluated at each sample. Please see set samples and set isosamples for discussion of the difference.
The algorithm used to remove the hidden parts of the surfaces has some additional features controllable by this command. Specifying defaults will set them all to their default settings, as detailed below. If defaults is not given, only explicitly specified options will be influenced: all others will keep their previous values, so you can turn on/off hidden line removal via set {no}hidden3d, without modifying the set of options you chose.
The first option, offset, influences the linetype used for lines on the 'back' side. Normally, they are drawn in a linetype one index number higher than the one used for the front, to make the two sides of the surface distinguishable. You can specify a different linetype offset to add instead of the default 1, by offset <offset>. Option nooffset stands for offset 0, making the two sides of the surface use the same linetype.
Next comes the option trianglepattern <bitpattern>. <bitpattern> must be a number between 0 and 7, interpreted as a bit pattern. Each bit determines the visibility of one edge of the triangles each surface is split up into. Bit 0 is for the 'horizontal' edges of the grid, Bit 1 for the 'vertical' ones, and Bit 2 for the diagonals that split each cell of the original grid into two triangles. The default pattern is 3, making all horizontal and vertical lines visible, but not the diagonals. You may want to choose 7 to see those diagonals as well.
The undefined <level> option lets you decide what the algorithm is to do with data points that are undefined (missing data, or undefined function values), or exceed the given x-, y- or z-ranges. Such points can either be plotted nevertheless, or taken out of the input data set. All surface elements touching a point that is taken out will be taken out as well, thus creating a hole in the surface. If <level> = 3, equivalent to option noundefined, no points will be thrown away at all. This may produce all kinds of problems elsewhere, so you should avoid this. <level> = 2 will throw away undefined points, but keep the out-of-range ones. <level> = 1, the default, will get rid of out-of-range points as well.
By specifying noaltdiagonal, you can override the default handling of a special case can occur if undefined is active (i.e. <level> is not 3). Each cell of the grid-structured input surface will be divided in two triangles along one of its diagonals. Normally, all these diagonals have the same orientation relative to the grid. If exactly one of the four cell corners is excluded by the undefined handler, and this is on the usual diagonal, both triangles will be excluded. However if the default setting of altdiagonal is active, the other diagonal will be chosen for this cell instead, minimizing the size of the hole in the surface.
The bentover option controls what happens to another special case, this time in conjunction with the trianglepattern. For rather crumply surfaces, it can happen that the two triangles a surface cell is divided into are seen from opposite sides (i.e. the original quadrangle is 'bent over'), as illustrated in the following ASCII art:
C----B original quadrangle: A--B displayed quadrangle: |\ | ("set view 0,0") | /| ("set view 75,75" perhaps) | \ | |/ | | \ | C--D | \| A D
If the diagonal edges of the surface cells aren't generally made visible by bit 2 of the <bitpattern> there, the edge CB above wouldn't be drawn at all, normally, making the resulting display hard to understand. Therefore, the default option of bentover will turn it visible in this case. If you don't want that, you may choose nobentover instead.
See also hidden line removal demo (hidden.dem) and complex hidden line demo (singulr.dem).