Skip to content

Latest commit

 

History

History
39 lines (23 loc) · 3.46 KB

File metadata and controls

39 lines (23 loc) · 3.46 KB
layout title nav_order has_children parent grand_parent has_toc
default
Contour
1
false
Contour Plots
Examples
false

Contour

contour(X, Y, Z);

See result

example_contour_1

More examples:

example_contour_2 example_contour_3 example_contour_4 example_contour_5 example_contour_6 example_contour_7 example_contour_8

All these subcategories depend on the contours type. They also depend on lazy evaluation for generating the contour lines. When the function draw is called in the contours class, it preprocesses all contour lines for a three-dimensional function.

Although it is relatively simple to show a heatmap with the values for the -axis, calculating contour lines relative to the -axis is more complex than it might seem at first. We provide the function contourc for calculating contour lines. This function uses an adaptation of the algorithm adopted by Matplotlib.

The algorithm creates a quad grid defined by the and values. It uses this grid to infer a contour line passing through positions with the same value. The algorithm sweeps through the grid twice to generate these lines. The first sweep looks for lines that start on the boundaries. The second sweep looks for interior closed loops.

Filled contours are closed polygons for pairs of contour levels. Some polygons for filled contours might be holes inside other polygons. The algorithm needs to keep track of these relationships so that we can render the polygons in their accurate order. To avoid an extra step that identifies this relationship between the polygons, the sweeping algorithm already identifies which polygons are holes for each level.

Once we find the quads with the contour line, the line is generated by interpolating the values around that quad.