fn wireframe(&self, projection_type: ProjectionType) -> Mesh {
        let vertex_count = self.vertex_count();

        // If there's no vertices, returns an empty mesh.
        if vertex_count == 0 {
            return empty_mesh();
        }

        let edge_count = self.edge_count();

        // We add a single vertex so that Miratope doesn't crash.
        let vertices = vertex_coords(self.con(), self.vertices().iter(), projection_type);
        let mut indices = Vec::with_capacity(edge_count * 2);

        // Adds the edges to the wireframe.
        if let Some(edges) = self.get_element_list(2) {
            for edge in edges {
                debug_assert_eq!(
                    edge.subs.len(),
                    2,
                    "Edge must have exactly 2 elements, found {}.",
                    edge.subs.len()
                );

                indices.push(edge.subs[0] as u16);
                indices.push(edge.subs[1] as u16);
            }
        }

        // Sets the mesh attributes.
        let mut mesh = Mesh::new(PrimitiveTopology::LineList);
        mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals(&vertices));
        mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, vertices);
        mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, vec![[0.0; 2]; vertex_count]);
        mesh.set_indices(Some(Indices::U16(indices)));

        mesh
    }
/// Builds the wireframe of a polytope.
Builds the wireframe of a polytope.
Builds the wireframe of a polytope .
fn wireframe(&self, projection_type: ProjectionType) -> Mesh {
        let vertex_count = self.vertex_count();
        // If there's no vertices, returns an empty mesh.
        if vertex_count == 0 {
            return empty_mesh();
        }
        let edge_count = self.edge_count();
        // We add a single vertex so that Miratope doesn't crash.
        let vertices = vertex_coords(self.con(), self.vertices().iter(), projection_type);
        let mut indices = Vec::with_capacity(edge_count * 2);
        // Adds the edges to the wireframe.
        if let Some(edges) = self.get_element_list(2) {
            for edge in edges {
                debug_assert_eq!(
                    edge.subs.len(),
                    2,
                    "Edge must have exactly 2 elements, found {}.",
                    edge.subs.len()
                );
                indices.push(edge.subs[0] as u16);
                indices.push(edge.subs[1] as u16);
            }
        }
        // Sets the mesh attributes.
        let mut mesh = Mesh::new(PrimitiveTopology::LineList);
        mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals(&vertices));
        mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, vertices);
        mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, vec![[0.0; 2]; vertex_count]);
        mesh.set_indices(Some(Indices::U16(indices)));
        mesh
    }
fn wireframe ( & self , projection_type : ProjectionType ) -> Mesh { let vertex_count = self . vertex_count ( ) ; // If there's no vertices, returns an empty mesh. if vertex_count == 0 { return empty_mesh ( ) ; } let edge_count = self . edge_count ( ) ; // We add a single vertex so that Miratope doesn't crash. let vertices = vertex_coords ( self . con ( ) , self . vertices ( ) . iter ( ) , projection_type ) ; let mut indices = Vec :: with_capacity ( edge_count * 2 ) ; // Adds the edges to the wireframe. if let Some ( edges ) = self . get_element_list ( 2 ) { for edge in edges { debug_assert_eq ! ( edge subs len ( ) 2 " " edge subs len ( ) ) ; indices . push ( edge . subs [ 0 ] as u16 ) ; indices . push ( edge . subs [ 1 ] as u16 ) ; } } // Sets the mesh attributes. let mut mesh = Mesh :: new ( PrimitiveTopology :: LineList ) ; mesh . set_attribute ( Mesh :: ATTRIBUTE_NORMAL , normals ( & vertices ) ) ; mesh . set_attribute ( Mesh :: ATTRIBUTE_POSITION , vertices ) ; mesh . set_attribute ( Mesh :: ATTRIBUTE_UV_0 , vec ! [ [ 0.0 2 ] vertex_count ] ) ; mesh . set_indices ( Some ( Indices :: U16 ( indices ) ) ) ; mesh }
Builds the wireframe of a polytope.
Builds the wireframe of a polytope .
&self
projection_type
ProjectionType
&self
projection_type
ProjectionType