fn comp_append(&mut self, p: Self) {
        let rank = self.rank();
        if rank <= 1 {
            return;
        }

        // The polytopes must have the same ranks.
        assert_eq!(
            rank,
            p.rank(),
            "polytopes in a compound must have the same rank"
        );

        // The element counts of the polytope, except we pretend there's no min
        // or max elements.
        let mut el_counts: Vec<_> = self.el_count_iter().collect();
        el_counts[0] = 0;
        el_counts[rank] = 0;

        for (r, elements) in p.into_iter().enumerate().skip(1).take(rank - 1) {
            for mut el in elements.into_iter() {
                let sub_offset = el_counts[r - 1];
                let sup_offset = el_counts[r + 1];

                for sub in el.subs.iter_mut() {
                    *sub += sub_offset;
                }

                for sup in el.sups.iter_mut() {
                    *sup += sup_offset;
                }

                self[r].push(el);
            }
        }

        // We don't need to do this every single time.
        *self.ranks.min_mut() = Element::min(self.vertex_count());
        *self.ranks.max_mut() = Element::max(self.facet_count());
    }
/// "Appends" a polytope into another, creating a compound polytope.
///
/// # Panics
/// This method will panic if the polytopes have different ranks.
"Appends" a polytope into another, creating a compound polytope.
" Appends " a polytope into another creating a compound polytope .
fn comp_append(&mut self, p: Self) {
        let rank = self.rank();
        if rank <= 1 {
            return;
        }
        // The polytopes must have the same ranks.
        assert_eq!(
            rank,
            p.rank(),
            "polytopes in a compound must have the same rank"
        );
        // The element counts of the polytope, except we pretend there's no min
        // or max elements.
        let mut el_counts: Vec<_> = self.el_count_iter().collect();
        el_counts[0] = 0;
        el_counts[rank] = 0;
        for (r, elements) in p.into_iter().enumerate().skip(1).take(rank - 1) {
            for mut el in elements.into_iter() {
                let sub_offset = el_counts[r - 1];
                let sup_offset = el_counts[r + 1];
                for sub in el.subs.iter_mut() {
                    *sub += sub_offset;
                }
                for sup in el.sups.iter_mut() {
                    *sup += sup_offset;
                }
                self[r].push(el);
            }
        }
        // We don't need to do this every single time.
        *self.ranks.min_mut() = Element::min(self.vertex_count());
        *self.ranks.max_mut() = Element::max(self.facet_count());
    }
fn comp_append ( & mut self , p : Self ) { let rank = self . rank ( ) ; if rank <= 1 { return ; } // The polytopes must have the same ranks. assert_eq ! ( rank p rank ( ) " " ) ; // The element counts of the polytope, except we pretend there's no min // or max elements. let mut el_counts : Vec < _ > = self . el_count_iter ( ) . collect ( ) ; el_counts [ 0 ] = 0 ; el_counts [ rank ] = 0 ; for ( r , elements ) in p . into_iter ( ) . enumerate ( ) . skip ( 1 ) . take ( rank - 1 ) { for mut el in elements . into_iter ( ) { let sub_offset = el_counts [ r - 1 ] ; let sup_offset = el_counts [ r + 1 ] ; for sub in el . subs . iter_mut ( ) { * sub += sub_offset ; } for sup in el . sups . iter_mut ( ) { * sup += sup_offset ; } self [ r ] . push ( el ) ; } } // We don't need to do this every single time. * self . ranks . min_mut ( ) = Element :: min ( self . vertex_count ( ) ) ; * self . ranks . max_mut ( ) = Element :: max ( self . facet_count ( ) ) ; }
"Appends" a polytope into another, creating a compound polytope.
" Appends " a polytope into another creating a compound polytope .
&mut self
p
Self
&mut self
p
Self
panics
This method will panic if the polytopes have different ranks.
This method will panic if the polytopes have different ranks .