Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
S.IsocurveAdditional utilities for drawing and inspecting curves defined by an implicit equation.
type info = {grid_size : int * int;grid : plot_object;Plottig this object will draw the initial grid. This field is empty if debug=false in the call of compute_level.
boxes : plot_object;Plotting this object will draw the cells where subsampling has been performed.
*)steps : int;depth : int;poles : int;Number of sign changes of f that have not been considered as zeros, but rather as poles (where the function diverges or is highly discontinuous.)
message : Buffer.t;Reading this string willl give you some debug information.
*)}val compute_level :
?debug:bool ->
?pixel_size:(int * int) ->
?grid_size:(int * int) ->
?sub_size:(int * int) ->
?steps:int ->
?better:int ->
?depth:int ->
(Points.point -> float) ->
(Points.point * Points.point) ->
plot_object * infoUse compute f (p0, p1) to compute (an approximation) of the level set f p = 0 inside the box delimited by the diagonal points p0,p1.
This is essentialy the same as Plt.implicit_curve but returns both a plot_object and an info value. Use this version only if you need to obtain debug information.
The meaning of the optional parameters is as follows.
pixel_size is a hint to size in pixels of the box where the curve will be drawn; it is used to detect the resolution at which the computations should be made. The default is (500,500).grid_size is size of the initial sampling of the function f. For instance, if grid_size=(7,5) the (x,y) region where the implicit curve is sought is divised into 7x5 cells; hence there are 8=7+1 sampling points in the horizontal (x) direction, and 6=5+1 sampling points in the vertical direction. By default grid_size is automatically detected by looking at the function oscillations, starting from an initial size of (34,34). Specifying this parameter skips this detection, resulting in less evaluations of the function.Note however that sub-sampling will be applied (if sub_size is not (1,1)) in the cells where the curvature of the levelset is high.
sub_size is the size of the sub-grid recursively used for a better approximation of the curve in cells where the curvature seems too high. The default is (2,2).depth is the maximum number of recursive subdivisions of cells. By default it is computed in such a way that the smallest sub-cell is not smaller than the required pixel resolution. You may reduce it for fastest computation. depth=4 is typically a good choice.steps is the maximum number of steps used by the Newton method to determine the position of the curve on the cells boundaries. Currently the default is 4.better is a quick way to obtain a more precise curve without setting any other parameter. You can first try better=1 , then better=2, etc. Using a negative number will degrade the precision of the curve. Of course the default is 0.In the image below we plot the initial grid (in green) and the recursive subgrids (in cyan). We see that the curve looks nice and smooth while the initial grid was not a priori fine enough.

(Image obtained by the heart.ml example.)
val print_info : info -> unit