Topological structs: vertex, edge, wire, face, shell, and solid
The following sample code is a description of a topological tetrahedron as a solid model by this package.
use truck_topology::*; use std::iter::FromIterator; // Create vertices. A tetrahedron has four vertices. let v = Vertex::news(&[(), (), (), ()]); // Create edges. Vertex is implemented the Copy trait. let edge = [ Edge::new(&v, &v, ()), Edge::new(&v, &v, ()), Edge::new(&v, &v, ()), Edge::new(&v, &v, ()), Edge::new(&v, &v, ()), Edge::new(&v, &v, ()), ]; // Create boundaries of faces as the wire. // Edge is implemented the Copy trait. let wire = vec![ Wire::from_iter(vec![&edge, &edge, &edge.inverse()]), Wire::from_iter(vec![&edge, &edge, &edge.inverse()]), Wire::from_iter(vec![&edge, &edge.inverse(), &edge.inverse()]), Wire::from_iter(vec![&edge, &edge, &edge.inverse()]), ]; // Create faces by the boundary wires. // The boundary of face must be simple and closed. let mut face: Vec<Face<_, _, _>> = wire.into_iter().map(|wire| Face::new(vec![wire], ())).collect(); face.invert(); // Create shell of faces. Shell can be created by the Vec<Face>. let shell: Shell<_, _, _> = face.into(); // Create a tetrahedron solid by the boundary shell. // The boundaries of a solid must be closed and oriented. let solid = Solid::new(vec![shell]);
Main structures in
truck_topology consist 4 topological elements and 2 topological containers.
The following structures are topological elements.
Solid, each topological element has a unique
id for each instance.
In higher-level packages, by mapping this
id to geometric information, you can draw a solid shape.
The following structures are topological container.
The entities of
respectively, and many methods inherited by
These containers are used for creating higher-dimentional topological elements and checked the
regularity (e.g. connectivity, closedness, and so on) before creating these elements.
classifies the errors that can occur in this crate.
Defines the boundary iterator.
classifies shell conditions and defines the face iterators.
define the edge iterators and the vertex iterator.
Serialized compressed shell
Serialized compressed solid
Edge, which consists two vertices.
Face, attatched to a simple and closed wire.
Shell, a connected compounded faces.
Solid, attached to a closed shells.
Vertex, the minimum topological unit.
Wire, a path or cycle which consists some edges.
The id that does not depend on the direction of the edge.
The id that does not depend on the direction of the face.
The id of vertex.