pub struct DrawExtent {
pub total_len: f32,
pub in_frame_len: f32,
}Expand description
How much of the drawn segment length landed inside the render target, summed
over one LineRenderer::draw
call (Plan 0069, ADR-0083).
Pixel coverage cannot see an over-scaled figure: a comb roots every bar on a shared baseline and a corona roots every spoke at a centre, so clipping the tips costs a rounding error of lit pixels and the statistic goes the wrong way. Length does see it — a bar that overshoots loses in-frame length in exact proportion to the overshoot.
Length, not area. The stroke’s width and the ADR-0041 join extensions are not counted, so a thick stroke leaving the frame is under-counted. That is the right measure for overshoot and a poor one for anything else.
Arcs count too (Plan 0087 Phase 2). An
ArcInstance contributes its
own arc length, |sweep| * radius, to both sums. This is a correctness
obligation of the arc primitive rather than a feature: an arc contributing
nothing would shrink the denominator, and every arc-drawing preset would
read better-framed than it is — the more so as the primitive replaces whole
motifs, where the missing length is most of the figure.
Fields§
§total_len: f32World-space length of every segment actually drawn (post view transform).
in_frame_len: f32The share of that length lying inside [-aspect, aspect] x [-1, 1].
Implementations§
Source§impl DrawExtent
impl DrawExtent
Sourcepub fn fraction(self) -> Option<f32>
pub fn fraction(self) -> Option<f32>
The in-frame fraction — exactly 1.0 when nothing was clipped, exactly
0.0 when the whole figure is outside.
None when nothing was drawn at all: that is a 0/0, and inventing a
number for it is what made Plan 0058’s table print inf. “Nothing drawn”
is the total case and core/tests/sanity.rs is its instrument, not this
one.
Trait Implementations§
Source§impl Clone for DrawExtent
impl Clone for DrawExtent
Source§fn clone(&self) -> DrawExtent
fn clone(&self) -> DrawExtent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DrawExtent
impl Debug for DrawExtent
Source§impl Default for DrawExtent
impl Default for DrawExtent
Source§fn default() -> DrawExtent
fn default() -> DrawExtent
Source§impl PartialEq for DrawExtent
impl PartialEq for DrawExtent
Source§fn eq(&self, other: &DrawExtent) -> bool
fn eq(&self, other: &DrawExtent) -> bool
self and other values to be equal, and is used by ==.