Module Mlpost.Arrow
Draw arrows and build new forms of arrows.
Drawing Arrows
val simple : ?color:Color.t -> ?brush:Brush.t -> ?pen:Pen.t -> ?dashed:Dash.t -> Path.t -> Command.t
Draw a simple arrow following the given path.
- parameter color
the color of the arrow
- parameter pen
the pen to use to draw the body of the arrow
- parameter dashed
the dash pattern to use to draw the body of the arrow
val draw : ?kind:kind -> ?tex:string -> ?pos:float -> ?anchor:Command.position -> Path.t -> Command.t
Draw an arrow following the given path.
- parameter kind
the kind of arrow (default is
triangle_full
)
- parameter tex
add a LaTeX label
- parameter pos
label position on the path
- parameter anchor
label anchor
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.t
kind
the kind of arrow (default istriangle_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 distance
val point_to_point : (Point.t, Point.t) arrow_from_to
Use
point_to_point a b
to draw an arrow froma
tob
.
val box_to_box : (Box.t, Box.t) arrow_from_to
Use
box_to_box
to draw an arrow froma
tob
, stopping at the box boundaries. The arguments are the same as those ofpoint_to_point
.
val point_to_box : (Point.t, Box.t) arrow_from_to
Use
point_to_box
to draw an arrow froma
tob
, stopping at the box boundaries. The arguments are the same as those ofpoint_to_point
.
val box_to_point : (Box.t, Point.t) arrow_from_to
Use
box_to_point
to draw an arrow froma
tob
, stopping at the box boundaries. The arguments are the same as those ofpoint_to_point
.
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.
val implies : kind
An arrow made of two parallel lines and a classic head.
val iff : kind
An arrow made of two parallel lines, a classic head and a classic foot.
Heads
val make_head : ?cut:Path.t -> Command.t -> head_description
Head description constructor. The command parameter is used to draw the head.
- parameter cut
a path that can be used to cut the arrow body lines (only used by heads and feet, not by belts)
type head
= Point.t -> Point.t -> head_description
If
h
is a head,h p d
returns a head description used to draw the head at pointp
with directiond
. Directiond
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 -> head
A simple head with two straight lines.
- parameter color
the color of the head; default is black
- parameter pen
the pen used to draw the head; default is
Brush.Pen.default
- parameter dashed
if given, the head is drawn using that dash_style
- parameter angle
the angle between the two lines in degrees, default is 60 degrees
- parameter size
the length of the two lines, default is 4bp
Building Your Own Kinds
val empty : kind
The 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 -> kind
Add a line to a body. The line will be parallel to the path used to draw the arrow.
- parameter dashed
the dash style used to draw the line (default is plain)
- parameter color
the color of the line (default is black)
- parameter pen
the pen used to draw the line (default is
Brush.Pen.default
)
- parameter from_point
from
0.
(foot of the arrow) to1.
(head of the arrow), the line will start from this point
- parameter to_point
from
0.
(foot of the arrow) to1.
(head of the arrow), the line will end at this point
- parameter dist
the distance between the path of the arrow and this line (positive values are on the right of the arrows)
val add_head : ?head:head -> kind -> kind
Add a head at the end of the arrow.
- parameter head
the kind of head to add (default is
head_classic
)
val add_foot : ?head:head -> kind -> kind
Add a foot (an inverted head) at the beginning of the arrow.
- parameter head
the kind of head to add (default is
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.
- parameter clip
if
true
, the arrow lines will be clipped after the belt (or before if therev
istrue
) (default isfalse
)
- parameter rev
if
true
, the head will be drawn in the opposite direction (default isfalse
)
- parameter point
the point where to draw the arrow (
0.
for the beginning, and1.
for the end, or any number in-between) (default is0.5
)
- parameter head
the kind of head to add (default is
head_classic
)
Miscellaneous
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.