Mlpost.PathFixed Paths
Paths are the objects used to describe lines, curves, and more generally almost everything that is drawn with Mlpost
A direction is used to put constraints on paths:
vec p defines a direction by a point (interpreted as a vector)curl f changes the curling factor of the extremity of a path; higher curling factor means flatter curvesnoDir means no particular directionval curl : float -> directionval noDir : directionA knot is the basic element of a path, and is simply a point with an incoming and outgoing direction constraint
Build a knot from a point; the optional arguments are the incoming directions. Warning they are going in the same direction.
A joint is the connection between two knots in a path. It is either
jLine for a straight linejCurve for a spline curvejCurveNoInflex to avoid inflexion pointsjTension f1 f2 to specify "tension" on the joint; jCurve uses a default tension of 1. Higher tension means less "wild" curvesjControls p1 p2 to explicitely specify control pointsval jLine : jointval jCurve : jointval jCurveNoInflex : jointval jTension : float -> float -> jointIn all the functions below :
Build a knot from a pair of floats
Build a knot from a Num.t pair; the optional arguments are as in knot
Build a path from a list of pairs of floats
Same as path, but uses a Num.t list
Build a path from n points and n-1 joints, with default directions
Build a path from n float_pairs and n-1 joints, with default directions
Close a path using direction dir and style style
point f p returns a certain point on the path p; f is given "in control points": 0. means the first control point, 1. the second and so on; intermediate values are accepted.
direction f p returns the direction of the tangent at point f p.
subpath start end path selects the subpath of path that lies between start and end. start and end are given in control points, as in point.
val transform : Transform.t -> t -> tApply a transformation to a path
cut_after p1 p2 cuts p2 after the intersection with p1. To memorize the order of the arguments, you can read: "cut after p1"
val defaultjoint : jointThe default joint style (JCurve)
val fullcircle : tA full circle of radius 1 and centered on the origin
val halfcircle : tThe upper half of fullcircle
val quartercircle : tThe right half of halfcircle
val unitsquare : tA full square of size 1 and centered on the origin
type metapath = MetaPath.tCompute the control point of the path for a good looking result according to the constraint on the direction, tension, curve
Compute the control point of the path for a good looking result according to the constraint on the direction, tension, curve
Obtain a metapath from a path with exactly the same control point. p = of_metapath (of_path p) is true but not the opposite.
val smart_path : ?style:joint -> orientation list -> Point.t -> Point.t -> tDraw a path