plotters-ternary 0.1.0

Publication-quality ternary diagrams, contours, filled bands, and scalar maps for Plotters
Documentation
# Axis and mesh kernel

Milestone 5 adds publication-oriented, independently configurable semantic axes
without changing ternary composition semantics. `TernaryAxis::{A,B,C}` always
means the A, B, and C component of `(a, b, c)`, regardless of triangle
orientation or `VertexOrder`.

## Opposite-edge convention

Axis A is associated with the B--C edge, axis B with C--A, and axis C with
A--B. Axis names are placed parallel to their associated full triangle edge.
A custom vertex order changes the physical edge, not the semantic association.

Ticks use a stable directed edge parameter: zero is the first component returned
by `Component::others()` and one is the second. In the conventional order this
is B→C for A, A→C for B, and A→B for C. This makes a tick location a well-defined
point on the axis's opposite edge, including under a custom vertex order. Grid
families retain their usual semantic meaning: an A grid segment is generated by
`component_isoline(Component::A, value)`, and similarly for B and C.

## Public configuration

`TernaryMeshConfig::axis(TernaryAxis, |axis| ...)`, plus `axis_a`, `axis_b`,
and `axis_c`, configure a `TernaryAxisConfig`. Each axis independently owns:

- `TickSpec::{Count, Step, Values}` for major and optional minor ticks;
- major/minor grid visibility and `ShapeStyle`;
- physical tick visibility, styles, lengths, and `TickDirection`;
- `TickRangeMode::{FullCompositionRange, VisibleRange}`;
- decimal, percentage, or closure-based Unicode label formatting;
- tick-label style and offset;
- axis name, owned `AxisTextStyle`, offset, and `AxisNamePosition`;
- endpoint policy.

`Count(n)` means *n equal intervals*, producing `n + 1` candidates. `Step`
uses integer-indexed multiples, not an accumulation loop. Explicit values must
be finite and in the unit interval (within geometry tolerance); they are sorted
and tolerance-deduplicated. Minor candidates that coincide with major candidates
are removed.

Existing `configure_mesh().major_step(...)` and name/style shortcuts still work.
To preserve the existing diagram appearance, physical ticks and numeric labels
are opt-in; major grid lines retain their prior default.

## Cropping and visibility

`CroppedAxisPolicy::TriangleEdgesOnly` is the sole automatic policy. The
invisible rectangular `TernaryViewport` is never drawn as a Cartesian frame and
never receives axis ticks. Full-range grid isolines can remain visible in an
interior viewport even if no original edge is visible. In contrast, every
physical tick and numeric label is filtered against its clipped original-edge
parameter fragment. `VisibleRange` resolves values only over that fragment; an
absent edge yields no automatic ticks or labels.

`CornerLabelVisibility::Auto` (the default) only draws a corner label in or on
the viewport. `EndpointLabelPolicy::AutoAvoidDuplicates` suppresses endpoints
owned by a visible named corner and otherwise gives each shared corner to the
lowest semantic axis touching it. This avoids duplicate `0` and corner-overlap
labels deterministically without a general collision solver.

## Geometry and text phases

Mesh draw phases are explicit:

```rust
mesh.draw_geometry_scaled(scale)?; // high-resolution PNG geometry pass
mesh.draw_text()?;                 // final-resolution PNG text pass
```

`draw()` remains the single-pass convenience call. Geometry order is minor grid,
major grid, triangle boundary, minor ticks, major ticks. Text order is tick
labels, axis names, then corner labels. This preserves the bitmap helper's
geometry-only supersampling: no text is rasterised then downsampled. SVG uses the
same logical geometry in its vector geometry group and ordinary native text for
captions, tick labels, and legends.

Tick lengths and stroke widths are final-output pixels and scale only in the
supersampled geometry pass. Logical ternary coordinates and viewport coordinates
never scale.

## Arbitrary-angle axis-name rendering

Plotters natively supports quarter-turn text transforms. Captions, tick labels,
corner labels, legends, and horizontal A-axis names continue to use Plotters'
native `Text` rendering. The B and C names need to remain parallel to sloped
ternary edges, so their completed axis layout is represented by one prepared
command containing the final backend-pixel anchor, offset, angle, text, and
owned `AxisTextStyle`.

For bitmap output, the final-resolution text pass renders that command through
a transparent coverage mask. The font is rasterised at a bounded 4x internal
mask scale, then every destination pixel is inverse-mapped with bilinear
coverage sampling and alpha-composited source-over. This is independent of the
3x geometry supersampling setting: name position, nominal font size, rotation,
and offset do not change with geometry quality. It does not assume a white
background, and no text is emitted in the high-resolution geometry pass.

For the shared SVG output adapter, the same prepared command becomes one native
UTF-8 `<text>` node in `ternary-text`, with `transform="rotate(...)"`, centred
anchors, family, size, style, colour, and opacity preserved. The label remains
searchable and selectable; it is neither an image nor a collection of
one-pixel rectangles. XML text and attribute content are escaped narrowly at
command generation time. General Plotters `DrawingBackend` code still lacks a
portable arbitrary-angle text transform, so callers producing publication SVG
should use the shared `render_svg` adapter until Plotters adds that capability.

## Examples

- `examples/custom_axes.rs` writes `examples/output/png/custom_axes.png` and
  `examples/output/svg/custom_axes.svg`; it demonstrates independent tick specs,
  minor grids, decimal/percentage/custom labels, markers, a line series, and a
  normal Plotters legend.
- `examples/cropped_axes.rs` writes `examples/output/png/cropped_axes.png` and
  `examples/output/svg/cropped_axes.svg`; it demonstrates visible-range ticks,
  an invisible associated edge, and a manual C-axis name without drawing a
  viewport frame.

The next milestone can add advanced cropped-axis relocation and richer
label-placement policies; it should keep this semantic/edge and geometry/text
separation intact.