fn mesh(&self, projection_type: ProjectionType) -> Mesh {
        // If there's no vertices, returns an empty mesh.
        if self.vertex_count() == 0 {
            return empty_mesh();
        }

        // Triangulates the polytope's faces, projects the vertices of both the
        // polytope and the triangulation.
        let triangulation = Triangulation::new(self.con());
        let vertices = vertex_coords(
            self.con(),
            self.vertices()
                .iter()
                .chain(triangulation.extra_vertices.iter()),
            projection_type,
        );

        // Builds the actual mesh.
        let mut mesh = Mesh::new(PrimitiveTopology::TriangleList);
        mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, vec![[0.0, 1.0]; vertices.len()]);
        mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals(&vertices));
        mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, vertices);
        mesh.set_indices(Some(Indices::U16(triangulation.triangles)));

        mesh
    }
/// Builds the mesh of a polytope.
Builds the mesh of a polytope.
Builds the mesh of a polytope .
fn mesh(&self, projection_type: ProjectionType) -> Mesh {
        // If there's no vertices, returns an empty mesh.
        if self.vertex_count() == 0 {
            return empty_mesh();
        }
        // Triangulates the polytope's faces, projects the vertices of both the
        // polytope and the triangulation.
        let triangulation = Triangulation::new(self.con());
        let vertices = vertex_coords(
            self.con(),
            self.vertices()
                .iter()
                .chain(triangulation.extra_vertices.iter()),
            projection_type,
        );
        // Builds the actual mesh.
        let mut mesh = Mesh::new(PrimitiveTopology::TriangleList);
        mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, vec![[0.0, 1.0]; vertices.len()]);
        mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals(&vertices));
        mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, vertices);
        mesh.set_indices(Some(Indices::U16(triangulation.triangles)));
        mesh
    }
fn mesh ( & self , projection_type : ProjectionType ) -> Mesh { // If there's no vertices, returns an empty mesh. if self . vertex_count ( ) == 0 { return empty_mesh ( ) ; } // Triangulates the polytope's faces, projects the vertices of both the // polytope and the triangulation. let triangulation = Triangulation :: new ( self . con ( ) ) ; let vertices = vertex_coords ( self . con ( ) , self . vertices ( ) . iter ( ) . chain ( triangulation . extra_vertices . iter ( ) ) , projection_type , ) ; // Builds the actual mesh. let mut mesh = Mesh :: new ( PrimitiveTopology :: TriangleList ) ; mesh . set_attribute ( Mesh :: ATTRIBUTE_UV_0 , vec ! [ [ 0.0 1.0 ] vertices len ( ) ] ) ; mesh . set_attribute ( Mesh :: ATTRIBUTE_NORMAL , normals ( & vertices ) ) ; mesh . set_attribute ( Mesh :: ATTRIBUTE_POSITION , vertices ) ; mesh . set_indices ( Some ( Indices :: U16 ( triangulation . triangles ) ) ) ; mesh }
Builds the mesh of a polytope.
Builds the mesh of a polytope .
&self
projection_type
ProjectionType
&self
projection_type
ProjectionType