fn write_faces(&mut self) -> OffWriteResult<()> {
        let rank = self.rank();
        debug_assert!(rank >= 3);

        // # Faces
        if self.comments() {
            let el_name = if rank > 3 { "Faces" } else { COMPONENTS };
            self.push_str("\n# ");
            self.push_str(el_name);
            self.push('\n');
        }

        // Writes the components in the polygonal case.
        if rank == 3 {
            for component in CycleList::from_edges(self.poly[1].iter().map(|vert| &vert.sups)) {
                self.push_to_str(component.len());
                for edge in component {
                    self.push(' ');
                    self.push_to_str(edge);
                }
                self.push('\n');
            }
        } else {
            for (idx, face) in self.poly[3].iter().enumerate() {
                self.push_to_str(face.subs.len());
                let mut cycles =
                    CycleList::from_edges(face.subs.iter().map(|&i| &self.poly[(2, i)].subs));

                if cycles.len() > 1 {
                    return Err(OffWriteError::CompoundFace { idx });
                }

                for v in cycles.swap_remove(0) {
                    self.push(' ');
                    self.push_to_str(v);
                }
                self.push('\n');
            }
        }

        Ok(())
    }
/// Gets and writes the faces of a polytope into an OFF file.
///
/// This method should only be called when rank >= 3.
Gets and writes the faces of a polytope into an OFF file.
This method should only be called when rank >= 3.
Gets and writes the faces of a polytope into an OFF file . This method should only be called when rank > = 3 .
fn write_faces(&mut self) -> OffWriteResult<()> {
        let rank = self.rank();
        debug_assert!(rank >= 3);
        // # Faces
        if self.comments() {
            let el_name = if rank > 3 { "Faces" } else { COMPONENTS };
            self.push_str("\n# ");
            self.push_str(el_name);
            self.push('\n');
        }
        // Writes the components in the polygonal case.
        if rank == 3 {
            for component in CycleList::from_edges(self.poly[1].iter().map(|vert| &vert.sups)) {
                self.push_to_str(component.len());
                for edge in component {
                    self.push(' ');
                    self.push_to_str(edge);
                }
                self.push('\n');
            }
        } else {
            for (idx, face) in self.poly[3].iter().enumerate() {
                self.push_to_str(face.subs.len());
                let mut cycles =
                    CycleList::from_edges(face.subs.iter().map(|&i| &self.poly[(2, i)].subs));
                if cycles.len() > 1 {
                    return Err(OffWriteError::CompoundFace { idx });
                }
                for v in cycles.swap_remove(0) {
                    self.push(' ');
                    self.push_to_str(v);
                }
                self.push('\n');
            }
        }
        Ok(())
    }
fn write_faces ( & mut self ) -> OffWriteResult < ( ) > { let rank = self . rank ( ) ; debug_assert ! ( rank 3 ) ; // # Faces if self . comments ( ) { let el_name = if rank > 3 { " " } else { COMPONENTS } ; self . push_str ( " \n " ) ; self . push_str ( el_name ) ; self . push ( '\n' ) ; } // Writes the components in the polygonal case. if rank == 3 { for component in CycleList :: from_edges ( self . poly [ 1 ] . iter ( ) . map ( | vert | & vert . sups ) ) { self . push_to_str ( component . len ( ) ) ; for edge in component { self . push ( ' ' ) ; self . push_to_str ( edge ) ; } self . push ( '\n' ) ; } } else { for ( idx , face ) in self . poly [ 3 ] . iter ( ) . enumerate ( ) { self . push_to_str ( face . subs . len ( ) ) ; let mut cycles = CycleList :: from_edges ( face . subs . iter ( ) . map ( | & i | & self . poly [ ( 2 , i ) ] . subs ) ) ; if cycles . len ( ) > 1 { return Err ( OffWriteError :: CompoundFace { idx } ) ; } for v in cycles . swap_remove ( 0 ) { self . push ( ' ' ) ; self . push_to_str ( v ) ; } self . push ( '\n' ) ; } } Ok ( ( ) ) }
Gets and writes the faces of a polytope into an OFF file.
Gets and writes the faces of a polytope into an OFF file .
&mut self
&mut self