Trait truck_rendimpl::modeling::topo_traits::Mapped [−][src]
Mapping, duplicates and moves a topological element.
Required methods
pub fn mapped<FP, FC, FS>(
&self,
point_mapping: &FP,
curve_mapping: &FC,
surface_mapping: &FS
) -> Self where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
[src]
&self,
point_mapping: &FP,
curve_mapping: &FC,
surface_mapping: &FS
) -> Self where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
Returns a new topology whose points are mapped by point_closure
,
curves are mapped by curve_closure
,
and surfaces are mapped by surface_closure
.
Provided methods
pub fn topological_clone(&self) -> Self where
C: Clone,
S: Clone,
P: Clone,
[src]
C: Clone,
S: Clone,
P: Clone,
Returns another topology whose points, curves, and surfaces are cloned.
Implementations on Foreign Types
impl<P, C, S> Mapped<P, C, S> for Edge<P, C>
[src]
pub fn mapped<FP, FC, FS>(
&self,
point_mapping: &FP,
curve_mapping: &FC,
surface_mapping: &FS
) -> Edge<P, C> where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
[src]
&self,
point_mapping: &FP,
curve_mapping: &FC,
surface_mapping: &FS
) -> Edge<P, C> where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
Returns a new edge whose curve is mapped by curve_mapping
and
whose end points are mapped by point_mapping
.
Examples
use truck_topology::*; use truck_modeling::topo_traits::Mapped; let v0 = Vertex::new(0); let v1 = Vertex::new(1); let edge0 = Edge::new(&v0, &v1, 2); let edge1 = edge0.mapped( &move |i: &usize| *i + 10, &move |j: &usize| *j + 20, &<()>::clone, ); assert_eq!(*edge1.front().lock_point().unwrap(), 10); assert_eq!(*edge1.back().lock_point().unwrap(), 11); assert_eq!(*edge1.lock_curve().unwrap(), 22);
impl<P, C, S> Mapped<P, C, S> for Face<P, C, S>
[src]
pub fn mapped<FP, FC, FS>(
&self,
point_mapping: &FP,
curve_mapping: &FC,
surface_mapping: &FS
) -> Face<P, C, S> where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
[src]
&self,
point_mapping: &FP,
curve_mapping: &FC,
surface_mapping: &FS
) -> Face<P, C, S> where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
Returns a new face whose surface is mapped by surface_mapping
,
curves are mapped by curve_mapping
and points are mapped by point_mapping
.
Examples
use truck_topology::*; use truck_modeling::topo_traits::Mapped; let v = Vertex::news(&[0, 1, 2, 3, 4, 5, 6]); let wire0 = Wire::from(vec![ Edge::new(&v[0], &v[1], 100), Edge::new(&v[1], &v[2], 200), Edge::new(&v[2], &v[3], 300), Edge::new(&v[3], &v[0], 400), ]); let wire1 = Wire::from(vec![ Edge::new(&v[4], &v[5], 500), Edge::new(&v[6], &v[5], 600).inverse(), Edge::new(&v[6], &v[4], 700), ]); let face0 = Face::new(vec![wire0, wire1], 10000); let face1 = face0.mapped( &move |i: &usize| *i + 10, &move |j: &usize| *j + 1000, &move |k: &usize| *k + 100000, ); assert_eq!( *face0.lock_surface().unwrap() + 100000, *face1.lock_surface().unwrap(), ); let biters0 = face0.boundary_iters(); let biters1 = face1.boundary_iters(); for (biter0, biter1) in biters0.into_iter().zip(biters1) { for (edge0, edge1) in biter0.zip(biter1) { assert_eq!( *edge0.front().lock_point().unwrap() + 10, *edge1.front().lock_point().unwrap(), ); assert_eq!( *edge0.back().lock_point().unwrap() + 10, *edge1.back().lock_point().unwrap(), ); assert_eq!(edge0.orientation(), edge1.orientation()); assert_eq!( *edge0.lock_curve().unwrap() + 1000, *edge1.lock_curve().unwrap(), ); } }
impl<P, C, S> Mapped<P, C, S> for Vertex<P>
[src]
A trait for a unified definition of the function mapped
.
pub fn mapped<FP, FC, FS>(&self, point_mapping: &FP, &FC, &FS) -> Vertex<P> where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
[src]
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
Returns a new vertex whose point is mapped by point_mapping
.
Examples
use truck_topology::*; use truck_modeling::topo_traits::Mapped; let v0 = Vertex::new(1); let v1 = v0.mapped( &move |i: &usize| *i + 1, &<()>::clone, &<()>::clone, ); assert_eq!(*v1.lock_point().unwrap(), 2);
impl<P, C, S> Mapped<P, C, S> for Wire<P, C>
[src]
pub fn mapped<FP, FC, FS>(
&self,
point_mapping: &FP,
curve_mapping: &FC,
surface_mapping: &FS
) -> Wire<P, C> where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
[src]
&self,
point_mapping: &FP,
curve_mapping: &FC,
surface_mapping: &FS
) -> Wire<P, C> where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
Returns a new wire whose curves are mapped by curve_mapping
and
whose points are mapped by point_mapping
.
Examples
use truck_topology::*; use truck_modeling::topo_traits::Mapped; let v = Vertex::news(&[0, 1, 2, 3, 4]); let wire0: Wire<usize, usize> = vec![ Edge::new(&v[0], &v[1], 100), Edge::new(&v[2], &v[1], 110).inverse(), Edge::new(&v[3], &v[4], 120), Edge::new(&v[4], &v[0], 130), ].into(); let wire1 = wire0.mapped( &move |i: &usize| *i + 10, &move |j: &usize| *j + 1000, &<()>::clone, ); // Check the points for (v0, v1) in wire0.vertex_iter().zip(wire1.vertex_iter()) { let i = *v0.lock_point().unwrap(); let j = *v1.lock_point().unwrap(); assert_eq!(i + 10, j); } // Check the curves and orientation for (edge0, edge1) in wire0.edge_iter().zip(wire1.edge_iter()) { let i = *edge0.lock_curve().unwrap(); let j = *edge1.lock_curve().unwrap(); assert_eq!(i + 1000, j); assert_eq!(edge0.orientation(), edge1.orientation()); } // Check the connection assert_eq!(wire1[0].back(), wire1[1].front()); assert_ne!(wire1[1].back(), wire1[2].front()); assert_eq!(wire1[2].back(), wire1[3].front()); assert_eq!(wire1[3].back(), wire1[0].front());
impl<P, C, S> Mapped<P, C, S> for Solid<P, C, S>
[src]
pub fn mapped<FP, FC, FS>(
&self,
point_mapping: &FP,
curve_mapping: &FC,
surface_mapping: &FS
) -> Solid<P, C, S> where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
[src]
&self,
point_mapping: &FP,
curve_mapping: &FC,
surface_mapping: &FS
) -> Solid<P, C, S> where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
Returns a new solid whose surfaces are mapped by surface_mapping
,
curves are mapped by curve_mapping
and points are mapped by point_mapping
.
impl<P, C, S> Mapped<P, C, S> for Shell<P, C, S>
[src]
pub fn mapped<FP, FC, FS>(
&self,
point_mapping: &FP,
curve_mapping: &FC,
surface_mapping: &FS
) -> Shell<P, C, S> where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
[src]
&self,
point_mapping: &FP,
curve_mapping: &FC,
surface_mapping: &FS
) -> Shell<P, C, S> where
FS: Fn(&S) -> S,
FP: Fn(&P) -> P,
FC: Fn(&C) -> C,
Returns a new shell whose surfaces are mapped by surface_mapping
,
curves are mapped by curve_mapping
and points are mapped by point_mapping
.
Examples
use truck_topology::*; use truck_modeling::topo_traits::Mapped; let v = Vertex::news(&[0, 1, 2, 3, 4, 5, 6]); let wire0 = Wire::from(vec![ Edge::new(&v[0], &v[1], 100), Edge::new(&v[1], &v[2], 200), Edge::new(&v[2], &v[3], 300), Edge::new(&v[3], &v[0], 400), ]); let wire1 = Wire::from(vec![ Edge::new(&v[4], &v[5], 500), Edge::new(&v[6], &v[5], 600).inverse(), Edge::new(&v[6], &v[4], 700), ]); let face0 = Face::new(vec![wire0, wire1], 10000); let face1 = face0.mapped( &move |i: &usize| *i + 7, &move |j: &usize| *j + 700, &move |k: &usize| *k + 10000, ); let shell0 = Shell::from(vec![face0, face1.inverse()]); let shell1 = shell0.mapped( &move |i: &usize| *i + 50, &move |j: &usize| *j + 5000, &move |k: &usize| *k + 500000, ); for (face0, face1) in shell0.face_iter().zip(shell1.face_iter()) { assert_eq!( *face0.lock_surface().unwrap() + 500000, *face1.lock_surface().unwrap(), ); assert_eq!(face0.orientation(), face1.orientation()); let biters0 = face0.boundary_iters(); let biters1 = face1.boundary_iters(); for (biter0, biter1) in biters0.into_iter().zip(biters1) { for (edge0, edge1) in biter0.zip(biter1) { assert_eq!( *edge0.front().lock_point().unwrap() + 50, *edge1.front().lock_point().unwrap(), ); assert_eq!( *edge0.back().lock_point().unwrap() + 50, *edge1.back().lock_point().unwrap(), ); assert_eq!( *edge0.lock_curve().unwrap() + 5000, *edge1.lock_curve().unwrap(), ); } } }