fn duopyramid_vertices(
    p: &[Point<f64>],
    q: &[Point<f64>],
    p_pad: &Point<f64>,
    q_pad: &Point<f64>,
    height: f64,
    tegum: bool,
) -> Vec<Point<f64>> {
    // Duotegums with points should just return the original polytopes.
    if tegum {
        if p.get(0).map(|vp| vp.len()) == Some(0) {
            return q.to_owned();
        } else if q.get(0).map(|vq| vq.len()) == Some(0) {
            return p.to_owned();
        }
    }

    let half_height = height / 2.0;

    // To every point in p, we append zeros to the right.
    p.iter()
        .map(|vp| {
            let mut v: Vec<_> = vp.iter().copied().chain(q_pad.iter().copied()).collect();
            if !tegum {
                v.push(half_height);
            }
            v.into()
        })
        // To every point in q, we append zeros to the left.
        .chain(q.iter().map(|vq| {
            let mut v: Vec<_> = p_pad.iter().copied().chain(vq.iter().copied()).collect();
            if !tegum {
                v.push(-half_height);
            }
            v.into()
        }))
        .collect()
}
/// Generates the vertices for either a tegum or a pyramid product with two
/// given vertex sets and a given height.
///
/// The vertices are the padded vertices of `p`, followed by the padded
/// vertices of `q`.
Generates the vertices for either a tegum or a pyramid product with two
given vertex sets and a given height.

The vertices are the padded vertices of `p`, followed by the padded
vertices of `q`.
Generates the vertices for either a tegum or a pyramid product with two given vertex sets and a given height . The vertices are the padded vertices of ` p ` followed by the padded vertices of ` q ` .
fn duopyramid_vertices(
    p: &[Point<f64>],
    q: &[Point<f64>],
    p_pad: &Point<f64>,
    q_pad: &Point<f64>,
    height: f64,
    tegum: bool,
) -> Vec<Point<f64>> {
    // Duotegums with points should just return the original polytopes.
    if tegum {
        if p.get(0).map(|vp| vp.len()) == Some(0) {
            return q.to_owned();
        } else if q.get(0).map(|vq| vq.len()) == Some(0) {
            return p.to_owned();
        }
    }
    let half_height = height / 2.0;
    // To every point in p, we append zeros to the right.
    p.iter()
        .map(|vp| {
            let mut v: Vec<_> = vp.iter().copied().chain(q_pad.iter().copied()).collect();
            if !tegum {
                v.push(half_height);
            }
            v.into()
        })
        // To every point in q, we append zeros to the left.
        .chain(q.iter().map(|vq| {
            let mut v: Vec<_> = p_pad.iter().copied().chain(vq.iter().copied()).collect();
            if !tegum {
                v.push(-half_height);
            }
            v.into()
        }))
        .collect()
}
fn duopyramid_vertices ( p : & [ Point < f64 > ] , q : & [ Point < f64 > ] , p_pad : & Point < f64 > , q_pad : & Point < f64 > , height : f64 , tegum : bool , ) -> Vec < Point < f64 > > { // Duotegums with points should just return the original polytopes. if tegum { if p . get ( 0 ) . map ( | vp | vp . len ( ) ) == Some ( 0 ) { return q . to_owned ( ) ; } else if q . get ( 0 ) . map ( | vq | vq . len ( ) ) == Some ( 0 ) { return p . to_owned ( ) ; } } let half_height = height / 2.0 ; // To every point in p, we append zeros to the right. p . iter ( ) . map ( | vp | { let mut v : Vec < _ > = vp . iter ( ) . copied ( ) . chain ( q_pad . iter ( ) . copied ( ) ) . collect ( ) ; if ! tegum { v . push ( half_height ) ; } v . into ( ) } ) // To every point in q, we append zeros to the left. . chain ( q . iter ( ) . map ( | vq | { let mut v : Vec < _ > = p_pad . iter ( ) . copied ( ) . chain ( vq . iter ( ) . copied ( ) ) . collect ( ) ; if ! tegum { v . push ( - half_height ) ; } v . into ( ) } ) ) . collect ( ) }
Generates the vertices for either a tegum or a pyramid product with two
given vertex sets and a given height.
Generates the vertices for either a tegum or a pyramid product with two given vertex sets and a given height .
p
&[Point<f64>]
q
&[Point<f64>]
p_pad
&Point<f64>
q_pad
&Point<f64>
height
f64
tegum
bool