Filled arrows#
Purpose and concepts#
Filled arrows are single closed silhouettes. Construct a material and place it with add. arrow() is straight; independent constructors such as arrow.arc() share paints, borders and effects.
Minimal complete example#
Run this file directly with laymesh validate or laymesh render; it contains its own canvas and required definitions.
page=canvas(size=(85mm,70mm),background="#ffffff")a=page.add(arrow(length=50mm,shaft_width=(2mm,5mm),fill="#087f8c"),offset=(10mm,10mm))page.add(ellipse(size=(1mm,1mm),fill="#ee784b"),anchor=center,target=a.centerline.end)centerline_length = a.centerline.lengthPreview
Dependencies
examples/manual/arrow.lay
Composition#
Arc and custom-path arrows append centered triangular heads along shaft endpoint tangents. Custom paths retain the complete curve; arcs reserve head angles within the total sweep. Connect final tips or unheaded ends using start/end in add; shaft_width interpolates along shaft arclength.
page=canvas(size=(240mm,160mm),background="#f4f7fc")style { text { font-family:"DejaVu Sans"; font-size:10pt; color:#24324b; } arrow { fill:#087f8c; border-color:#ffffff; border-width:0.45mm; } arrow.orange { fill:#ee784b; }}page.add(text("Filled arrows",font_size=23pt,font_weight=700),offset=(10,8))page.add(text("One silhouette. Reusable materials. Independent shaft and heads.",font_size=10pt),offset=(10,20))for x in [8,86,164] { for y in [30,88] { page.add(rect(size=(68,52),fill="#ffffff",border_radius=3mm),offset=(x,y))}}page.add(text("arrow()",font_weight=700),offset=(12,34))page.add(arrow(length=55,shaft_width=5,head_size=(11,13)),offset=(14,45))page.add(arrow(length=55,shaft_width=3,heads=both,head_size=(9,9),class="orange"),offset=(14,65))page.add(text("arrow.arc()",font_weight=700),offset=(90,34))page.add(arrow.arc(radius=15,start_angle=160deg,sweep_angle=250deg,shaft_width=4,head_size=(8,10)),offset=(100,44))page.add(text("arrow.bent()",font_weight=700),offset=(168,34))page.add(arrow.bent(span=(43,24),corner_radius=8,shaft_width=4,head_size=(9,11),class="orange"),offset=(176,45))page.add(text("arrow.uturn()",font_weight=700),offset=(12,92))page.add(arrow.uturn(span=(39,25),corner_radius=9,shaft_width=4,heads=both,head_size=(8,10)),offset=(22,103))page.add(text("arrow.chevron()",font_weight=700),offset=(90,92))page.add(arrow.chevron(length=54,shaft_width=(5,8),head_size=(14,17),notch_depth=5,class="orange"),offset=(93,110))page.add(text("arrow.path()",font_weight=700),offset=(168,92))curve=path(commands=[move_to(0,20),cubic_to(18,20,10,0,28,0),cubic_to(44,0,36,20,54,20)])page.add(arrow.path(path=curve,shaft_width=[(0,2mm),(0.5,6mm),(1,3mm)],head_size=(8,10)),offset=(168,105))page.add(text("All arrows use fill, border_* and effects. Shape paths and centerlines remain separate."),offset=(10,149))Preview
Dependencies
examples/gallery/shapes/arrows.lay
Common errors and limits#
Radius, total sweep, head dimensions and endpoint distance must agree. Missing positive shaft solutions, coincident endpoints, full-circle sweeps, invalid widths and self-intersections error. centerline includes head axes; path is the closed outline.
Individual functions#
arrow#
Create a reusable filled straight arrow. Connect anchors using start/end in add, and style with fill, border_* and effects.
Returns: Reusable filled arrow material.
Minimal complete source · Composition source · All parameters
arrow-arc#
Append straight triangular heads along an arc shaft’s endpoint tangents. The total sweep includes heads; connections solve for the complete endpoints.
Returns: Reusable filled arrow material.
Minimal complete source · Composition source · All parameters
arrow-bent#
Create an L-shaped arrow with centerline span and corner radius, optionally connected between anchors.
Returns: Reusable filled arrow material.
Minimal complete source · Composition source · All parameters
arrow-uturn#
Create a U-turn arrow. Endpoint connections transform its centerline while retaining physical shaft and head dimensions.
Returns: Reusable filled arrow material.
Minimal complete source · Composition source · All parameters
arrow-chevron#
Create a single-headed notched arrow whose tail and shaft share one continuous closed silhouette.
Returns: Reusable filled arrow material.
Minimal complete source · Composition source · All parameters
arrow-path#
Preserve a complete custom open path as the shaft and append straight triangular heads along its outward endpoint tangents; supports variable width and independent head sizes.
Returns: Reusable filled arrow material.
Required inputs: path.
Minimal complete source · Composition source · All parameters
Detailed behavior and further examples#
Geometry and placement#
arrow() creates straight arrows. Use arrow.arc(), arrow.bent(), arrow.uturn(), arrow.chevron() and arrow.path() for other templates. Every constructor returns a reusable closed shape styled with fill, border_* and effects. Line endpoint heads continue to use line(..., end_head=head(...)).
page=canvas(size=(160mm,110mm))a=page.add(rect(size=(20mm,14mm),fill="#dde5f2"),offset=(10mm,60mm))b=page.add(rect(size=(20mm,14mm),fill="#dde5f2"),offset=(120mm,60mm))page.add(arrow(shaft_width=(2mm,5mm),fill="#087f8c"),start=a.middle_right,end=b.middle_left)page.add(arrow.arc(sweep_angle=90deg,fill="#ee784b"),start=a.top_center,end=b.top_center)page.add(arrow.arc(radius=-80mm,fill="#5273c5"),start=a.bottom_center,end=b.bottom_center)Local arcs require a positive radius, start_angle (default 0°) and a signed sweep_angle. The radius belongs to the arc shaft centerline; start_angle is the polar angle of the final logical start around the circle center. sweep_angle is the total polar sweep including both heads. Page angles point right at 0° and down at 90°; positive sweeps are clockwise, and absolute sweeps above 180° and below 360° create major arcs.
Straight triangular heads extend outward along the shaft endpoint tangents, with each base centered on its neck. A head of length L on a shaft of radius R occupies atan(L/R) of polar angle. Subtract both head angles from the total sweep to obtain the arc shaft sweep, which must remain positive. An unheaded end uses L=0.
Endpoint connections accept a sweep alone to solve the radius and center, or a signed radius alone: positive selects a clockwise minor arc, negative a counterclockwise minor arc. The solver uses the complete endpoints including heads. Their distances from the circle center are sqrt(R²+L_start²) and sqrt(R²+L_end²); the minor-arc semicircle limit is their sum, replacing the bare-arc half-chord constraint. When both radius and sweep are specified, the radius must be positive and the complete endpoint distance must match. Constraints are never silently changed. If a sweep produces multiple radii with positive shaft sweeps, choose the larger radius before checking the silhouette. Connections determine starting orientation without mutating the reusable material.
A bent centerline passes through (0,h), (0,0), (w,0); a U-turn continues to (w,h). span=(w,h) defaults to (30mm,20mm) and corner_radius to one quarter of the smaller span; zero makes sharp corners. Chevron notch_depth defaults to the tail shaft width. Custom paths accept one open line/arc/path/polyline material; paint and endpoint styles on that source are ignored. The complete source curve becomes the shaft. Its endpoints are necks: append the end head along the final tangent and the start head against the initial tangent. Heads do not shorten the source curve, so leave layout space for their additional length.
Straight connections recompute length and direction; arcs solve the constraints above. Other templates and custom paths translate, rotate and uniformly scale their shaft centerline, keeping physical shaft and head dimensions. Custom-path connections include the appended head lengths in the endpoint equation; choose the larger positive scale when multiple solutions exist. start/end refer to the final tips or unheaded ends. Ordinary add(size=...) scales the entire shape using existing placement rules. Straight, bent, U-turn and chevron dimensions retain their previous meanings.
Connections retain start_offset/end_offset, per-end *_offset_space, and overall offset. They are mutually exclusive with explicit anchor/target/rotation/size. Endpoints must belong to the same container and group replay rebinds their references. See anchors and placement.
Variable widths and heads#
shaft_width=3mm is constant; (2mm,5mm) tapers linearly; [(0,2mm),(0.5,6mm),(1,3mm)] supplies width stops. Positions measure normalized shaft arclength after excluding heads, must increase strictly from 0 to 1, and interpolate linearly between stops.
heads accepts end (default), start or both; chevrons require one head. head_size=(longitudinal length,transverse width) sets a shared size; start_head_size/end_head_size override it individually. Both dimensions default to twice the corresponding neck width. Head width cannot be less than neck width. Tips stay on logical endpoints and follow endpoint tangents; heads and shaft form one closed silhouette. Arc and custom-path head bases are centered on the neck and perpendicular to the shaft endpoint tangent, with symmetric shoulders; the curved shaft is not clipped against an off-center head base.
Short paths, undefined cusp directions, invalid widths and self-intersecting silhouettes produce diagnostics. The engine does not shrink heads or change specified widths to conceal invalid geometry.
centerline#
Instance .start/.end are logical endpoints. .centerline retains the open generating path and supports existing path queries such as .at(fraction=0.5), .segments, .length and tangents. For arcs and custom paths, centerline includes the shaft and appended straight head axes. Its length includes the head lengths, and its endpoint tangents agree with the final tips. Custom-path source curves are preserved; a start head shifts their segment indices by one, and an end head adds the last segment. Source segments do not become render samples. .path is the closed shape outline, .ink its painted region, and .bounds its layout frame.
The anchor example positions its sweep label at the centerline midpoint.
LCSS arrow styles#
All templates share the arrow type selector. arrow.demo selects arrows with class demo; it does not name a constructor. Styles include shaft-width, heads, head-size, start-head-size, end-head-size, and existing paints, borders and effects. Size pairs can use 8mm 10mm; width stops use the list syntax.
page=canvas(size=(100mm,65mm),background="#eef3f9")style { arrow.demo { fill:#087f8c; border-color:#ffffff; border-width:0.5mm; shaft-width:[(0,2mm),(0.5,5mm),(1,3mm)]; heads:both; head-size:8mm 9mm; start-head-size:7mm 8mm; end-head-size:9mm 10mm; effects:[shadow(blur=1mm,offset=(1mm,1mm))]; }}page.add(arrow(length=75mm,class="demo"),offset=(10mm,25mm))Preview
Dependencies
examples/manual/arrow-style.lay
Export and compatibility#
Arrow subjects stay vector in SVG/PDF; blur and glow use existing effect handling. Plain PPTX arrows remain editable custom vector geometry. Special effects may invoke local raster fallback with W_PPTX_RASTER; PowerPoint preset adjustment handles are not provided.
arrow() now means a filled shape. Legacy calls containing line_*, line caps or start_head/end_head are identifiable as line arrows; a safe migration fix is offered only when every parameter applies to line. Geometry-only old calls using length/angle or dx/dy cannot be distinguished automatically and now use filled-shape semantics. Migration never rewrites new namespaced constructors or user-defined names.


