For version 0.7.0.
To top.  Up: ..Shapes..Graphics

arrowheads


Alphabetical index
triangleArrow

Namespace:  ..Shapes..Graphics

Arrowheads can be added when a path is stroked by stroke. While some arrowheads are available in the preamble (ShapesArrow and MetaPostArrow), this extension provides additional ones.
The type of an arrowhead function is either §ArrowHead or §ArrowHead3D, depending on which space the path belongs to. The types are completely analogous, so we will not discuss the 3d case further. As the signature shows, the only argument is a path, and the function shall create the arrowhead at the beginning of the path (stroke will ensure that the path is reversed if it is actually the head which is being created). The arrowhead construction consists of two parts, first the actual drawable object that will be added to the stroke, and then a length telling how much the stroke shall be shortened to avoid obtuse arrowheads. It is not always easy to determine how much the stroke needs to be shortened, but one must give it a try!
The alternative approach, to draw strokes with arrowheads as a single filled region would both be complicated to implement (for the user defining an arrowhead, as well as the part of the job that would then be the responsibility of the kernel), and lead to inefficient use of resources in many common situations where the current solution works fine. Perhaps, this approach can be supported by an extension in the future, using techniques like those here to find the two paths on each side of the original path, and then letting the arrowhead function join the two however it likes.
All the arrowhead functions have more parameters (with default values) than are required by the signature. The natural way to alter these parameters is to use an evaluated cut, like so:
•page << [stroke somePath head:[ShapesArrow rearAngle:180° ...]]
and note that it will often be a good idea to bind the arrowhead to a variable so that it can be used several times:
myHead: [ShapesArrow rearAngle:180° ...]
•page << [stroke somePath1 head:myHead]
•page << [stroke somePath2 head:myHead]
or like this:
headStroke: [stroke head:[ShapesArrow rearAngle:180° ...] ...]
•page << [headStroke somePath1]
•page << [headStroke somePath2]
triangleArrow
p::§Path ahLength:void::§Length ahAngle:30°::§Float fillAsStrokeing:true::§Boolean (> picture::§Drawable cut::§Length <)
Dynamic references:none
The arguments have similar interpretation to their meaning in MetaPostArrow. The difference is that the arrowhead will not bend with the path. (This means that there is never a need to override ahLength.)
Get Shapes at SourceForge.net. Fast, secure and Free Open Source software downloads