Mlpost.ArrowDraw arrows and build new forms of arrows.
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!
If you need to place a label which is not TeX but any picture, if you need to place it at a symbolic position on the path, or if you need to place more than one label, you cannot do it directly using the draw commands. First draw the arrow, then use functions such as Command.label.
val simple :
?color:Color.t ->
?brush:Brush.t ->
?pen:Pen.t ->
?dashed:Dash.t ->
Path.t ->
Command.tDraw a simple arrow following the given path.
val draw :
?kind:kind ->
?tex:string ->
?pos:float ->
?anchor:Command.position ->
Path.t ->
Command.tDraw an arrow following the given path.
type ('a, 'b) arrow_from_to =
?kind:kind ->
?tex:string ->
?pos:float ->
?anchor:Command.position ->
?style:Path.joint ->
?outd:Path.direction ->
?ind:Path.direction ->
?sep:Num.t ->
'a ->
'b ->
Command.tkind the kind of arrow (default is triangle_full)tex add a LaTeX labelpos label position on the pathanchor label anchoroutd the outgoing direction, at the beginning of the arrowind the ingoing direction, at the end of the arrowsep add a little separation of the given distanceval point_to_point : (Point.t, Point.t) arrow_from_toUse point_to_point a b to draw an arrow from a to b.
val box_to_box : (Box.t, Box.t) arrow_from_toUse box_to_box to draw an arrow from a to b, stopping at the box boundaries. The arguments are the same as those of point_to_point.
val point_to_box : (Point.t, Box.t) arrow_from_toUse point_to_box to draw an arrow from a to b, stopping at the box boundaries. The arguments are the same as those of point_to_point.
val box_to_point : (Box.t, Point.t) arrow_from_toUse box_to_point to draw an arrow from a to b, stopping at the box boundaries. The arguments are the same as those of point_to_point.
val classic : kindA simple arrow with one line and two straight lines for the head.
val triangle : kindA simple arrow with a triangular head. Same as classic but with an extra line and some clipping.
val triangle_full : kindA simple arrow with a triangular head filled with black.
val implies : kindAn arrow made of two parallel lines and a classic head.
val iff : kindAn arrow made of two parallel lines, a classic head and a classic foot.
val make_head : ?cut:Path.t -> Command.t -> head_descriptionHead description constructor. The command parameter is used to draw the head.
type head = Point.t -> Point.t -> head_descriptionIf h is a head, h p d returns a head description used to draw the head at point p with direction d. Direction d is normalized before being given to the function.
val head_classic :
?color:Color.t ->
?brush:Brush.t ->
?pen:Pen.t ->
?dashed:Dash.t ->
?angle:float ->
?size:Num.t ->
headA simple head with two straight lines.
val head_triangle :
?color:Color.t ->
?brush:Brush.t ->
?pen:Pen.t ->
?dashed:Dash.t ->
?angle:float ->
?size:Num.t ->
headSame as head_classic except that the two lines are joined together to form a triangle.
Same as head_triangle except that the triangle is not drawn (hence the absence of pen properties) but is filled with the given color.
Start from the empty kind empty and add features to it using add_line, add_head, ...
val empty : kindThe empty kind with no line nor head.
val add_line :
?brush:Brush.t ->
?dashed:Dash.t ->
?color:Color.t ->
?pen:Pen.t ->
?from_point:float ->
?to_point:float ->
?dist:Num.t ->
kind ->
kindAdd a line to a body. The line will be parallel to the path used to draw the arrow.
Add a foot (an inverted head) at the beginning of the arrow.
Add an arrow head at any point of an arrow.
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.tDraw a thick arrow.