Skip to main content

ScalePlan

Struct ScalePlan 

Source
#[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

Source

pub fn operation(&self) -> ScaleOperation

Echoed operation and its declared parameters.

Source

pub fn tolerance_policy(&self) -> ScaleTolerancePolicy

The fixed tolerance policy this plan and its proof share.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn ledger(&self) -> ScalePlanLedger<'_>

Inspect the exact read-only topology, field, and obligation ledger.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for ScalePlan

Source§

fn clone(&self) -> ScalePlan

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScalePlan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ScalePlan

Source§

fn eq(&self, other: &ScalePlan) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ScalePlan

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.