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
Trait Implementations
impl<S, T> BoundedSurface for Processor<S, T> where
T: Transform<<S as ParametricSurface>::Point> + SquareMatrix<Scalar = f64> + Clone,
S: BoundedSurface<Point = Point3<f64>, Vector = Vector3<f64>>,
impl<S, T> BoundedSurface for Processor<S, T> where
T: Transform<<S as ParametricSurface>::Point> + SquareMatrix<Scalar = f64> + Clone,
S: BoundedSurface<Point = Point3<f64>, Vector = Vector3<f64>>,
impl<'de, E, T> Deserialize<'de> for Processor<E, T> where
E: Deserialize<'de>,
T: Deserialize<'de>,
impl<'de, E, T> Deserialize<'de> for Processor<E, T> where
E: Deserialize<'de>,
T: Deserialize<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Processor<E, T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Processor<E, T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<E, T, C> IncludeCurve<C> for Processor<E, T> where
C: ParametricCurve + Transformed<T> + Clone,
E: IncludeCurve<C>,
T: Transform<<C as ParametricCurve>::Point>,
<C as ParametricCurve>::Point: EuclideanSpace,
impl<E, T, C> IncludeCurve<C> for Processor<E, T> where
C: ParametricCurve + Transformed<T> + Clone,
E: IncludeCurve<C>,
T: Transform<<C as ParametricCurve>::Point>,
<C as ParametricCurve>::Point: EuclideanSpace,
type Point = <C as ParameterDivision1D>::Point
type Point = <C as ParameterDivision1D>::Point
The curve is in the space of Self::Point
.
type Point = <C as ParameterDivision1D>::Point
type Point = <C as ParameterDivision1D>::Point
The curve is in the space of Self::Point
.
impl<C, T> ParametricCurve for Processor<C, T> where
C: ParametricCurve,
T: Transform<<C as ParametricCurve>::Point> + Clone,
<C as ParametricCurve>::Point: EuclideanSpace,
<C as ParametricCurve>::Vector: VectorSpace,
<<C as ParametricCurve>::Point as EuclideanSpace>::Diff == <C as ParametricCurve>::Vector,
<<C as ParametricCurve>::Vector as VectorSpace>::Scalar == f64,
impl<C, T> ParametricCurve for Processor<C, T> where
C: ParametricCurve,
T: Transform<<C as ParametricCurve>::Point> + Clone,
<C as ParametricCurve>::Point: EuclideanSpace,
<C as ParametricCurve>::Vector: VectorSpace,
<<C as ParametricCurve>::Point as EuclideanSpace>::Diff == <C as ParametricCurve>::Vector,
<<C as ParametricCurve>::Vector as VectorSpace>::Scalar == f64,
type Point = <C as ParametricCurve>::Point
type Point = <C as ParametricCurve>::Point
The curve is in the space of Self::Point
.
type Vector = <C as ParametricCurve>::Vector
type Vector = <C as ParametricCurve>::Vector
The derivation vector of the curve.
Substitutes the parameter t
.
Returns the derivation.
Returns the 2nd-order derivation.
impl<S, T> ParametricSurface for Processor<S, T> where
T: Transform<<S as ParametricSurface>::Point> + SquareMatrix<Scalar = f64> + Clone,
S: ParametricSurface,
<S as ParametricSurface>::Point: EuclideanSpace,
<<S as ParametricSurface>::Point as EuclideanSpace>::Scalar == f64,
<<S as ParametricSurface>::Point as EuclideanSpace>::Diff == <S as ParametricSurface>::Vector,
impl<S, T> ParametricSurface for Processor<S, T> where
T: Transform<<S as ParametricSurface>::Point> + SquareMatrix<Scalar = f64> + Clone,
S: ParametricSurface,
<S as ParametricSurface>::Point: EuclideanSpace,
<<S as ParametricSurface>::Point as EuclideanSpace>::Scalar == f64,
<<S as ParametricSurface>::Point as EuclideanSpace>::Diff == <S as ParametricSurface>::Vector,
type Point = <S as ParametricSurface>::Point
type Point = <S as ParametricSurface>::Point
The surface is in the space of Self::Point
.
type Vector = <S as ParametricSurface>::Vector
type Vector = <S as ParametricSurface>::Vector
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
.
impl<S, T> ParametricSurface3D for Processor<S, T> where
S: ParametricSurface3D,
T: Transform<Point3<f64>> + SquareMatrix<Scalar = f64> + Clone,
impl<S, T> ParametricSurface3D for Processor<S, T> where
S: ParametricSurface3D,
T: Transform<Point3<f64>> + SquareMatrix<Scalar = f64> + Clone,
impl<E, T> SearchParameter for Processor<E, T> where
E: SearchParameter,
T: Transform<<E as SearchParameter>::Point>,
<E as SearchParameter>::Point: EuclideanSpace,
impl<E, T> SearchParameter for Processor<E, T> where
E: SearchParameter,
T: Transform<<E as SearchParameter>::Point>,
<E as SearchParameter>::Point: EuclideanSpace,
type Point = <E as SearchParameter>::Point
type Point = <E as SearchParameter>::Point
point
type Parameter = <E as SearchParameter>::Parameter
type Parameter = <E as SearchParameter>::Parameter
curve => f64
, surface => (f64, f64)
pub fn search_parameter(
&self,
point: <E as SearchParameter>::Point,
hint: Option<<E as SearchParameter>::Parameter>,
trials: usize
) -> Option<<E as SearchParameter>::Parameter>
pub fn search_parameter(
&self,
point: <E as SearchParameter>::Point,
hint: Option<<E as SearchParameter>::Parameter>,
trials: usize
) -> Option<<E as SearchParameter>::Parameter>
Search parameter t
such that self.subs(t)
is near point.
Returns None
if could not find such parameter. Read more
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
transform by trans
.
transformed geometry by trans
.
Auto Trait Implementations
impl<E, T> RefUnwindSafe for Processor<E, T> where
E: RefUnwindSafe,
T: RefUnwindSafe,
impl<E, T> UnwindSafe for Processor<E, T> where
E: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more