Library
Module
Module type
Parameter
Class
Class type
Adaptive sampling of 2D curves.
Representation of a 2D sampling. This can be thought as a path, with possible "jumps" because of discontinuities or leaving the "domain". The parameter says whether the sampling comes from evaluating a function, so it makes sense to refine it, or is just a sequence of points.
val fn :
?n:int ->
?viewport:Gg.Box2.t ->
?init:float list ->
?init_pt:(float * float) list ->
(float -> float) ->
float ->
float ->
[ `Fn ] t
fn f a b
returns a sampling of the graph of f
on the interval [a
, b
] by evaluating f
at n
points. For the optional arguments, see param
.
val param :
?n:int ->
?viewport:Gg.Box2.t ->
?init:float list ->
?init_pt:(float * (float * float)) list ->
(float -> float * float) ->
float ->
float ->
[ `Fn ] t
param f a b
returns a sampling of the range of f
on the interval [a
, b
] by evaluating f
at n
points (or less).
val uniform : ?n:int -> (float -> float) -> float -> float -> [ `Fn ] t
uniform f a b
returns a sampling of the graph of f
on n
equidistant points in the interval [a
, b
] (the boundaries a
and b
being always included — so n >= 2
). The resulting sampling may have less than n
points because evaluations returning points with NaN components are discarded (they split the path).
val of_path : (float * float) list -> [ `Pt ] t
Use the provided path as the sampling.
val to_list : _ t -> (float * float) list list
to_list t
return the sampling as a list of connected components of the path, each of which is given as a list of (x,y) couples.
of_seq seq
convert the sequence of points seq
to a sampling.
to_seq t
convert t
to a sequence of connected compononent.
clip t b
returns the sampling t
but clipped to the 2D box. A path that crosses the boundary will get additional nodes at the points of crossing and the part outside the bounding box will be dropped. (Thus a path entirely out of the bounding box will be removed.)
module P2 : sig ... end
Interface using Gg.p2
to represent points.
val to_channel : _ t -> out_channel -> unit
to_channel t ch
writes the sampling t
to the channel ch
. Each point is written as "x y" on a single line (in scientific notation). If the path is interrupted, a blank line is printed. This format is compatible with gnuplot.
val to_file : _ t -> string -> unit
to_file t fname
saves the sampling t
to the file fname
using the format described in to_channel
.
val to_latex :
_ t ->
?n:int ->
?arrow:string ->
?arrow_pos:float ->
?color:Gg.color ->
string ->
unit
to_latex t fname
saves the sampling t
as PGF/TikZ commands.
val to_latex_channel :
_ t ->
?n:int ->
?arrow:string ->
?arrow_pos:float ->
?color:Gg.color ->
out_channel ->
unit
to_latex_channel t ch
writes the sampling t
as PGF/TikZ commands to the channel ch
. See to_latex
for the meaning of optional arguments.