Skip to main content

Precision

Struct Precision 

Source
pub struct Precision {
    pub default_tolerance: f64,
    pub min_tolerance: f64,
    pub max_tolerance: f64,
    pub angular_tolerance: f64,
    pub parametric_tolerance: f64,
    pub check_samples: usize,
}
Expand description

The tolerance configuration of one model, set when the model is created (docs/DATA-MODEL.md §Tolerances).

Arris carries no unit; Precision is what makes a model’s numbers meaningful. Every tolerance an algorithm uses is an entity’s own or a field of this struct — never a literal. The defaults are for a model whose features are of order 1–1000 units; a consumer in metres sets default_tolerance at the micrometre scale.

The fields are public: a Precision is plain configuration data, and the checker’s V1/F2 rows (docs/DATA-MODEL.md §Invariants) hold every entity to the bounds it states.

use arris_math::Precision;

let p = Precision { default_tolerance: 1e-6, ..Precision::DEFAULT };
assert!(p.min_tolerance <= p.default_tolerance);
assert!(p.default_tolerance <= p.max_tolerance);

Fields§

§default_tolerance: f64

The tolerance a primitive’s entities are created with. Two points closer than this are the same point.

§min_tolerance: f64

The floor: no entity carries a tolerance below it. It bounds how far an operation may tighten a tolerance and is the smallest distance the model distinguishes.

§max_tolerance: f64

The ceiling: an operation whose result would need an entity tolerance above it returns an error instead of a sloppy body.

§angular_tolerance: f64

Angle in radians below which two directions are parallel and two surfaces are tangent.

§parametric_tolerance: f64

How far a pcurve may deviate in (u, v), at unit parametric speed — on a surface where one unit of parameter is one unit of length. The checker scales it by the surface’s parametric derivative, so on a cylinder of radius r the bound in u is this divided by r.

§check_samples: usize

How many parameters the checker samples along an edge when it compares a pcurve’s image against the 3D curve (invariant E4), both ends included.

Implementations§

Source§

impl Precision

Source

pub const DEFAULT: Precision

The defaults, as a constant so they can be spread into a struct literal. Values: default_tolerance 1e-7 (Open CASCADE’s Precision::Confusion, so the oracle and Arris merge the same points), min_tolerance 1e-12, max_tolerance 1e-2, angular_tolerance 1e-12 (Open CASCADE’s Precision::Angular), parametric_tolerance 1e-7, check_samples 23 (the sample count of Open CASCADE’s edge check, so an edge the oracle accepts is sampled at least as finely here).

Source

pub fn is_consistent(&self) -> bool

true when the fields are finite, positive and ordered (min_tolerance ≤ default_tolerance ≤ max_tolerance) and there is at least one sample; a Precision that fails this is rejected when a model is created.

Source§

impl Precision

Source

pub const fn tolerance(&self) -> Tolerance

The tolerance an algorithm without an entity of its own uses: default_tolerance for lengths, angular_tolerance for angles.

Trait Implementations§

Source§

impl Clone for Precision

Source§

fn clone(&self) -> Self

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 Copy for Precision

Source§

impl Debug for Precision

Source§

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

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

impl Default for Precision

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Precision

Source§

fn eq(&self, other: &Self) -> 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 Precision

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> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.