Triangular mesh generation and manipulation.
Library mesh
Module Mesh . LaTeX
type color = int

RGB Color representation 0xRRGGBB. It will be converted to TeX by the functions below.

val save : ?edge:( int -> color option ) -> 'l t -> string -> unit

save mesh file saves the mesh as LaTeX PGF commands. You can input the file in a tikzpicture environment to render the mesh.

  • parameter edge

    allows to specify the color of each edge. If the function returns None, the edge is not drawn. Default: all are black.

val write : ?edge:( int -> color option ) -> 'l t -> out_channel -> unit

Same as save but write the command to the channel.

val level_curves : ?boundary:( int -> color option ) -> 'l t -> 'l vec -> ?level_eq:( float -> float -> bool ) -> (float * color) list -> string -> unit

level_curves mesh z levels file outputs into file LaTeX PGF commands to display the level curves at levels of the P1 FEM surface with values z on the mesh mesh. Each level is a couple (l, c) where l is the level value and c is the RGB color to be used to display it. The output is done as TeX macros \meshline{R,G,B}{x1}{y1}{x2}{y2}, \meshpoint{point number}{x}{y} and \meshtriangle{R,G,B}{x1}{y1}{x2}{y2}{x3}{y3}, so it is easily customizable from within LaTeX. Default values for these macros are provided if they are not defined.

  • parameter boundary

    specifies the color of the boundary edges given their marker value. Returning None means that one does not want the border with that marker to be printed.

  • parameter level_eq

    an approximate equality for levels that are judged not to be distinguishable. It is expected that l1 = l2 implies level_eq l1 l2. This function is mainly used not to draw the boundary edges at levels given in levels.

val super_level : ?boundary:( int -> color option ) -> 'l t -> 'l vec -> float -> color -> string -> unit

super_level mesh z level color file outputs into file the LaTeX PGF command to display the super-level { (x,y) | z(x,y) > l }. You can customize the output by defining \meshfilltriangle{R,G,B}{x1}{y1}{x2}{y2}{x3}{y3} and \meshfillquadrilateral{R,G,B}{x1}{y1}{x2}{y2}{x3}{y3}{x4}{y4}.

val sub_level : ?boundary:( int -> color option ) -> 'l t -> 'l vec -> float -> color -> string -> unit

sub_level mesh z level color file same as super_level except that the sub-level { (x,y) | z(x,y) < l } is drawn.