# `Visualize.Shape.Arc`
[🔗](https://github.com/dcoai/Visualize/blob/v0.8.3/lib/visualize/shape/arc.ex#L1)

Arc generator for creating circular or annular sectors.

Used for pie charts, donut charts, and radial visualizations. The geometry is d3-shape's
`arc`: `pad_angle` narrows the sector at `pad_radius`, and `corner_radius` rounds its four
corners with tangent arcs.

## Examples

    arc = Visualize.Shape.Arc.new()
      |> Visualize.Shape.Arc.inner_radius(50)
      |> Visualize.Shape.Arc.outer_radius(100)
      |> Visualize.Shape.Arc.corner_radius(8)

    # Generate from angles
    path_data = Visualize.Shape.Arc.generate(arc, %{
      start_angle: 0,
      end_angle: :math.pi() / 2
    })

# `accessor`

```elixir
@type accessor() :: (any() -&gt; number()) | number()
```

# `t`

```elixir
@type t() :: %Visualize.Shape.Arc{
  corner_radius: accessor(),
  end_angle: accessor() | nil,
  inner_radius: accessor(),
  outer_radius: accessor() | nil,
  pad_angle: accessor(),
  pad_radius: accessor() | nil,
  start_angle: accessor() | nil
}
```

# `angles`

```elixir
@spec angles(t(), map() | any()) :: {number(), number()}
```

The `{start, end}` angles the arc's accessors give for a datum, for a label fitted to its sector (spec/14 §5.5, #138).

# `centroid`

```elixir
@spec centroid(t(), map() | any()) :: {number(), number()}
```

Generates a centroid point for the arc

# `corner_radius`

```elixir
@spec corner_radius(t(), accessor()) :: t()
```

Sets the corner radius; applied up to half the ring thickness

# `end_angle`

```elixir
@spec end_angle(t(), accessor()) :: t()
```

Sets the end angle accessor

# `generate`

```elixir
@spec generate(t(), map() | any()) :: String.t()
```

Generates the SVG path data string.

Note: For backend-agnostic usage, prefer `generate_path/2`
and render with your chosen backend.

# `generate_path`

```elixir
@spec generate_path(t(), map() | any()) :: Visualize.IR.Path.t()
```

Generates a Path struct

# `inner_radius`

```elixir
@spec inner_radius(t(), accessor()) :: t()
```

Sets the inner radius

# `new`

```elixir
@spec new() :: t()
```

Creates a new arc generator

# `outer_radius`

```elixir
@spec outer_radius(t(), accessor()) :: t()
```

Sets the outer radius

# `pad_angle`

```elixir
@spec pad_angle(t(), accessor()) :: t()
```

Sets the pad angle: the sector is narrowed by half of it on each side

# `pad_radius`

```elixir
@spec pad_radius(t(), accessor() | nil) :: t()
```

Sets the radius at which the pad angle is measured.

The linear gap the padding opens is `pad_radius · pad_angle`, kept constant across the
ring, so the angular shift is larger on the inner edge than on the outer. `nil` (the
default) uses `√(r0² + r1²)`, as d3 does.

# `radii`

```elixir
@spec radii(t(), map() | any()) :: {number(), number()}
```

The inner and outer radius of the arc for `data`, `{r0, r1}` (spec/14 §5.5).

# `start_angle`

```elixir
@spec start_angle(t(), accessor()) :: t()
```

Sets the start angle accessor

---

*Consult [api-reference.md](api-reference.md) for complete listing*
