An annular sector, d3-shape's arc (spec/07 §6), copied from visualize's
Visualize.Shape.Arc.
Every parameter is an accessor evaluated against one datum (§1.1). Radii are user units;
angles are radians clockwise from 12 o'clock. The path is about the origin; callers
translate it. pad_angle narrows the sector at pad_radius (√(r0² + r1²) when
nil), and corner_radius rounds its four corners with tangent arcs.
iex> alias Macaw.Draw.Shape.Arc
iex> Arc.new() |> Arc.inner_radius(50) |> Arc.generate(%{start_angle: 0, end_angle: :math.pi() / 2})
"M0,-100A100,100,0,0,1,100,0L50,0A50,50,0,0,0,0,-50Z"new/0 reads the datum's :start_angle (0 when absent) and :end_angle (2π when
absent), so a Macaw.Draw.Shape.Pie arc datum is consumed directly. A zero outer radius
or extent, and a radius or angle that is not a number, is the empty path: nothing to
draw.
Summary
Functions
The {start, end} angles the accessors give for a datum; nil where one is no number.
{x, y} at mid-radius and mid-angle; padding and corners do not move it. nil when a
radius or angle is no number.
Sets the corner_radius accessor: a function, a field, or a number.
Sets the end_angle accessor: a function, a field, or a number.
The SVG path data of a datum's arc.
The Macaw.Draw.IR.Path of a datum's arc (§6.2).
Sets the inner_radius accessor: a function, a field, or a number.
An arc of outer radius 100, its angles read from the datum.
Sets the outer_radius accessor: a function, a field, or a number.
Sets the pad_angle accessor: a function, a field, or a number.
Sets the radius at which the pad angle is measured: the linear gap is
pad_radius · pad_angle on both rings. nil restores √(r0² + r1²).
The {inner, outer} radii the accessors give for a datum; nil where one is no number.
Sets the start_angle accessor: a function, a field, or a number.
Types
@type error() :: {:error, [Macaw.Base.Fault.t()]}
A refusal: faults with their paths.
@type t() :: %Macaw.Draw.Shape.Arc{ corner_radius: (term() -> term()) | number(), end_angle: (term() -> term()) | nil, inner_radius: (term() -> term()) | number(), outer_radius: (term() -> term()) | nil, pad_angle: (term() -> term()) | number(), pad_radius: (term() -> term()) | nil, start_angle: (term() -> term()) | nil }
Functions
The {start, end} angles the accessors give for a datum; nil where one is no number.
{x, y} at mid-radius and mid-angle; padding and corners do not move it. nil when a
radius or angle is no number.
Sets the corner_radius accessor: a function, a field, or a number.
Sets the end_angle accessor: a function, a field, or a number.
The SVG path data of a datum's arc.
@spec generate_path(t(), term()) :: Macaw.Draw.IR.Path.t() | error()
The Macaw.Draw.IR.Path of a datum's arc (§6.2).
Sets the inner_radius accessor: a function, a field, or a number.
@spec new() :: t()
An arc of outer radius 100, its angles read from the datum.
Sets the outer_radius accessor: a function, a field, or a number.
Sets the pad_angle accessor: a function, a field, or a number.
Sets the radius at which the pad angle is measured: the linear gap is
pad_radius · pad_angle on both rings. nil restores √(r0² + r1²).
The {inner, outer} radii the accessors give for a datum; nil where one is no number.
Sets the start_angle accessor: a function, a field, or a number.