Module Mlpost.Arrow


module Arrow: sig .. end


Draw simple or complex arrows.

To draw an arrow, choose your arrow kind, then call the draw function (giving the path that the arrow will follow) or the draw2 function (giving the starting and ending points of the arrow). If your favorite arrow kind does not exist, use the tools from this module to build your own!
type kind 
The abstract type for arrow kinds.

Drawing Arrows


val draw : ?kind:kind ->
?tex:string ->
?pos:Command.position -> Path.t -> Command.t
Draw an arrow following the given path.
kind : the kind of arrow (default is Arrow.triangle_full)
tex : add a LaTeX label
pos : label position
val draw2 : ?kind:kind ->
?tex:string ->
?pos:Command.position ->
?outd:Path.direction ->
?ind:Path.direction ->
Point.t -> Point.t -> Command.t
Use draw2 a b to draw an arrow from a to b.
kind : the kind of arrow (default is Arrow.triangle_full)
tex : add a LaTeX label
pos : label position
outd : the outgoing direction, at the beginning of the arrow
ind : the ingoing direction, at the end of the arrow

Built-in Kinds


val classic : kind
A simple arrow with one line and two straight lines for the head.
val triangle : kind
A simple arrow with a triangular head. Same as classic but with an extra line and some clipping.
val triangle_full : kind
A simple arrow with a triangular head filled with black.

Heads


type head = Point.t -> Point.t -> Command.t * Path.t 
If h is a head, h p d returns c, p where c is a command that can be used to draw the head at point p with direction d, and p is a path that can be used to cut the arrow lines. d is normalized before being given to the function.
val head_classic : ?color:Color.t ->
?pen:Pen.t ->
?dashed:Dash.t ->
?angle:float -> ?size:Num.t -> head
A simple head with two straight lines.
color : the color of the head; default is black
pen : the pen used to draw the head; default is Pen.default
dashed : if given, the head is drawn using that dash_style
angle : the angle between the two lines in degrees, default is 60 degrees
size : the length of the two lines, default is 4bp
val head_triangle : ?color:Color.t ->
?pen:Pen.t ->
?dashed:Dash.t ->
?angle:float -> ?size:Num.t -> head
Same as head_classic except that the two lines are joined together to form a triangle.
val head_triangle_full : ?color:Color.t ->
?angle:float -> ?size:Num.t -> head
Same as head_triangle except that the triangle is not drawn (hence the absence of pen properties) but is filled with the given color.

Building Your Own Kinds



Start from the empty kind empty and add features to it using add_line, add_head, ...
val empty : kind
The empty kind with no line nor head.
val add_line : ?dashed:Dash.t ->
?color:Color.t ->
?pen:Pen.t ->
?from_point:float ->
?to_point:float ->
?dist:Num.t -> kind -> kind
Add a line to a body. The line will be parallel to the path used to draw the arrow.
dashed : the dash style used to draw the line (default is plain)
color : the color of the line (default is black)
pen : the pen used to draw the line (default is Pen.default)
from_point : from 0. (foot of the arrow) to 1. (head of the arrow), the line will start from this point
to_point : from 0. (foot of the arrow) to 1. (head of the arrow), the line will end at this point
dist : the distance between the path of the arrow and this line (may be negative)
val add_head : ?head:head -> kind -> kind
Add a head at the end of the arrow.
head : the kind of head to add (default is Arrow.head_classic)
val add_foot : ?head:head -> kind -> kind
Add a foot (an inverted head) at the beginning of the arrow.
head : the kind of head to add (default is Arrow.head_classic)
val add_belt : ?clip:bool ->
?rev:bool ->
?point:float ->
?head:head -> kind -> kind
Add an arrow head at any point of an arrow.
clip : if true, the arrow lines will be clipped after the belt (or before if the rev is true) (default is false)
rev : if true, the head will be drawn in the opposite direction (default is false)
point : the point where to draw the arrow (0. for the beginning, and 1. for the end, or any number in-between) (default is 0.5)
head : the kind of head to add (default is Arrow.head_classic)

Miscellaneous



Warning: the following functions might be either deleted, modified and / or moved somewhere else. Don't use them if you need some backward compatibility.
val draw_thick : ?style:Path.joint ->
?boxed:bool ->
?line_color:Color.t ->
?fill_color:Color.t ->
?outd:Path.direction ->
?ind:Path.direction ->
?width:Num.t ->
?head_length:Num.t ->
?head_width:Num.t ->
Point.t -> Point.t -> Command.t
Draw a thick arrow.