Struct truck_modeling::geometry::Processor[][src]

pub struct Processor<E, T> { /* fields omitted */ }
Expand description

invertible and transformable geometric element

Examples

Curve processing example

use truck_geometry::*;
let curve: BSplineCurve<Point3> = BSplineCurve::new(
    KnotVec::bezier_knot(2),
    vec![
        Point3::new(0.0, 0.0, 0.0),
        Point3::new(0.0, 0.0, 1.0),
        Point3::new(1.0, 0.0, 0.0),
    ],
);
let mut processed = Processor::<_, Matrix4>::new(curve.clone());

// both curves are the same curve
const N: usize = 100;
for i in 0..=N {
    let t = i as f64 / N as f64;
    assert_eq!(curve.subs(t), processed.subs(t));
}

// Processed curve can inverted!
processed.invert();
for i in 0..=N {
    let t = i as f64 / N as f64;
    assert_eq!(curve.subs(1.0 - t), processed.subs(t));
}

Surface processing example

use truck_geometry::*;
use std::f64::consts::PI;

let sphere = Sphere::new(Point3::new(1.0, 2.0, 3.0), 2.45);
let mut processed = Processor::<_, Matrix4>::new(sphere);

// both surfaces are the same surface
const N: usize = 100;
for i in 0..=N {
    for j in 0..=N {
        let u = PI * i as f64 / N as f64;
        let v = 2.0 * PI * j as f64 / N as f64;
        assert_eq!(sphere.subs(u, v), processed.subs(u, v));
    }
}

// Processed surface can be inverted!
// Here, "invert surface" means swap (u, v)-axes.
processed.invert();
for i in 0..=N {
    for j in 0..=N {
        let u = PI * i as f64 / N as f64;
        let v = 2.0 * PI * j as f64 / N as f64;
        assert_eq!(sphere.subs(u, v), processed.subs(v, u));
    }
}

Implementations

Creates new processor

Returns the reference of entity

Trait Implementations

The range of the parameter of the surface.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Deserialize this value from the given Serde deserializer. Read more

Performs the conversion.

Returns whether the curve curve is included in the surface self.

Inverts self

Returns the inverse.

The curve is in the space of Self::Point.

Creates the curve division (prameters, corresponding points). Read more

The curve is in the space of Self::Point.

Creates the curve division (prameters, corresponding points). Read more

Creates the surface division Read more

Creates the surface division Read more

The curve is in the space of Self::Point.

The derivation vector of the curve.

Substitutes the parameter t.

Returns the derivation.

Returns the 2nd-order derivation.

The range of the parameter of the curve.

The front end point of the curve.

The back end point of the curve.

The surface is in the space of Self::Point.

The derivation vector of the curve.

Substitutes the parameter (u, v).

Returns the derivation by u.

Returns the derivation by v.

Returns the 2nd-order derivation by u.

Returns the 2nd-order derivation by both u and v.

Returns the 2nd-order derivation by v.

Returns the normal vector at (u, v).

point

curve => f64, surface => (f64, f64)

Search parameter t such that self.subs(t) is near point.
Returns None if could not find such parameter. Read more

Serialize this value into the given Serde serializer. Read more

transform by trans.

transformed geometry by trans.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.