#[non_exhaustive]pub struct ScalePlan { /* private fields */ }Expand description
Pure, typed plan returned by plan_scale.
Planning never mutates its input document; it only inspects it. Reference candidate construction from an accepted plan is a distinct, separately fallible fixture step.
Every field is private: a ScalePlan can only be produced by
plan_scale, so an external caller cannot hand-construct or mutate one
into a state whose affected_nodes disagree with operation’s
selectors. Read plan contents through the accessor methods.
Implementations§
Source§impl ScalePlan
impl ScalePlan
Sourcepub fn operation(&self) -> ScaleOperation
pub fn operation(&self) -> ScaleOperation
Echoed operation and its declared parameters.
Sourcepub fn tolerance_policy(&self) -> ScaleTolerancePolicy
pub fn tolerance_policy(&self) -> ScaleTolerancePolicy
The fixed tolerance policy this plan and its proof share.
Sourcepub fn affected_nodes(&self) -> &[BoneId] ⓘ
pub fn affected_nodes(&self) -> &[BoneId] ⓘ
Affected normalized-node closure, in ascending bone-id order.
For ScaleOperation::WholeDocumentLinearUnits this is every node
in the document. For ScaleOperation::RestBindUniformScale this is
the closed connected hierarchy of DESIGN.md Appendix D §D.2: the
scaled ancestor, every selected skin joint and the normalized paths
between them, and every descendant transform-only attachment. Raw
source-only connector rows on those paths are not normalized nodes
and therefore do not appear in this list.
Sourcepub fn transform_only_attachments(&self) -> &[BoneId] ⓘ
pub fn transform_only_attachments(&self) -> &[BoneId] ⓘ
Descendant nodes in Self::affected_nodes that carry no skin —
the “transform-only child” case of DESIGN.md Appendix D §D.2/§D.3.
Always empty for ScaleOperation::WholeDocumentLinearUnits.
Sourcepub fn common_factor(&self) -> f64
pub fn common_factor(&self) -> f64
The one common factor s (or q for whole-document conversion)
applied across Self::affected_nodes.
This is always the factor the caller declared, never the one
measured from the source: reference construction applies exactly this
value, and prove_scale states every analytic expectation in terms
of it. Self::observed_factor reports the measured
counterpart, and the two are separate numbers on purpose — DESIGN.md
Appendix D §D.6 requires producer evidence to record both.
Sourcepub fn observed_factor(&self) -> f64
pub fn observed_factor(&self) -> f64
The factor this plan observed in the source, as distinct from the
caller-declared Self::common_factor the build applies.
For ScaleOperation::RestBindUniformScale this is the rest-world
uniform factor measured at the scaled root of DESIGN.md Appendix D
§D.2 — the average of its rest-world linear part’s three column
lengths, the same quantity the domain classification returns. It is
within ScaleTolerancePolicy::common_factor of
Self::common_factor (planning rejects it otherwise with
ScaleError::FactorMismatch) but is generally not equal to it: a
source authored at 0.010_000_02 is accepted against a declared
0.01, and both numbers belong in evidence.
For ScaleOperation::WholeDocumentLinearUnits this equals
Self::common_factor exactly, because there is nothing to measure.
That operation’s factor is declared, not observed: §D.1 states that
a whole-document conversion “changes physical size”, is “appropriate
only when the source was authored in a different linear unit”, and
that neither operation “may infer its factor or applicability from
mesh bounds, character height, joint lengths, inverse-bind magnitude,
filename, or an asset category”. A source authored in centimetres and
one authored in metres are numerically identical documents, so no
measurement of either could distinguish them; the declared factor is
the only fact there is, and reporting it here keeps the evidence
contract uniform across the two operations rather than leaving a hole
a consumer would have to special-case.
Sourcepub fn validate_document_inventory(
&self,
document: &Document,
) -> Result<(), ScaleError>
pub fn validate_document_inventory( &self, document: &Document, ) -> Result<(), ScaleError>
Validate this plan’s complete structural inventory against document.
This re-derives and exactly compares the affected domain, canonical source topology, transform-only attachments, payload shapes, field dispositions, and proof obligations. Numeric source values are not compared, so a document with the same structural ledger remains a valid replay source, but the replay document must still satisfy the finite-value and nonnegative-weight scale-input requirements.
§Errors
Returns ScaleError::PlanDocumentMismatch when the re-derived
inventory differs, or the corresponding planning/input error when
document cannot produce a valid inventory for this operation.
Sourcepub fn ledger(&self) -> ScalePlanLedger<'_>
pub fn ledger(&self) -> ScalePlanLedger<'_>
Inspect the exact read-only topology, field, and obligation ledger.
Sourcepub fn animation_value_factor(
&self,
document: &Document,
clip_index: usize,
track_index: usize,
) -> Result<f64, ScaleError>
pub fn animation_value_factor( &self, document: &Document, clip_index: usize, track_index: usize, ) -> Result<f64, ScaleError>
Resolve the effective multiplier for one animation track’s stored values from this compiled plan.
This is the assembly compatibility boundary from Appendix D §D.5: a producer can fingerprint the exact target-basis factor without reproducing rest/bind arithmetic outside the shared plan. Values and CUBICSPLINE tangents use the same multiplier because both occupy the track’s one typed field row.
§Errors
Returns ScaleError::PlanDocumentMismatch when the document or
requested track no longer matches the compiled ledger.
Sourcepub fn animation_target_factor(
&self,
document: &Document,
bone: BoneId,
property: Property,
) -> Result<f64, ScaleError>
pub fn animation_target_factor( &self, document: &Document, bone: BoneId, property: Property, ) -> Result<f64, ScaleError>
Resolve the effective multiplier for an animation target basis.
Unlike Self::animation_value_factor, this accepts a semantic target
rather than an existing track row. Character assembly uses it to
compare a base skeleton with independently supplied clip files before
any channel is copied or remapped. All factor arithmetic remains owned
by the compiled plan.
§Errors
Returns ScaleError::PlanDocumentMismatch when document no longer
matches the plan or the target is outside its skeleton.