fn uniform_antiprism(n: usize, d: usize) -> Self {
        let polygon = Self::star_polygon(n, d);

        // Appropriately scaled antiprism.
        if n != 2 * d {
            let angle = f64::PI * f64::usize(d) / f64::usize(n);
            let cos = angle.fcos();
            let height = ((cos - (2.0 * angle).fcos()) * 2.0).fsqrt();

            let mut antiprism = polygon.antiprism_with(
                &Hypersphere::with_squared_radius(Point::zeros(2), cos),
                height,
            );
            antiprism.scale(0.5 / (f64::PI * d as f64 / n as f64).fsin());

            antiprism
        }
        // Digon compounds are a special case.
        else {
            let half_height = f64::HALF_SQRT_2;
            let vertices = polygon.vertices().iter().map(|v| v.push(-half_height));
            let dual_vertices = polygon
                .vertices()
                .iter()
                .map(|v| vec![v[1], -v[0], half_height].into());

            let mut antiprism = polygon.antiprism_with_vertices(vertices, dual_vertices);
            antiprism.scale(0.5);

            antiprism
        }
    }
/// Builds a uniform antiprism of unit edge length.
Builds a uniform antiprism of unit edge length.
Builds a uniform antiprism of unit edge length .
fn uniform_antiprism(n: usize, d: usize) -> Self {
        let polygon = Self::star_polygon(n, d);
        // Appropriately scaled antiprism.
        if n != 2 * d {
            let angle = f64::PI * f64::usize(d) / f64::usize(n);
            let cos = angle.fcos();
            let height = ((cos - (2.0 * angle).fcos()) * 2.0).fsqrt();
            let mut antiprism = polygon.antiprism_with(
                &Hypersphere::with_squared_radius(Point::zeros(2), cos),
                height,
            );
            antiprism.scale(0.5 / (f64::PI * d as f64 / n as f64).fsin());
            antiprism
        }
        // Digon compounds are a special case.
        else {
            let half_height = f64::HALF_SQRT_2;
            let vertices = polygon.vertices().iter().map(|v| v.push(-half_height));
            let dual_vertices = polygon
                .vertices()
                .iter()
                .map(|v| vec![v[1], -v[0], half_height].into());
            let mut antiprism = polygon.antiprism_with_vertices(vertices, dual_vertices);
            antiprism.scale(0.5);
            antiprism
        }
    }
fn uniform_antiprism ( n : usize , d : usize ) -> Self { let polygon = Self :: star_polygon ( n , d ) ; // Appropriately scaled antiprism. if n != 2 * d { let angle = f64 :: PI * f64 :: usize ( d ) / f64 :: usize ( n ) ; let cos = angle . fcos ( ) ; let height = ( ( cos - ( 2.0 * angle ) . fcos ( ) ) * 2.0 ) . fsqrt ( ) ; let mut antiprism = polygon . antiprism_with ( & Hypersphere :: with_squared_radius ( Point :: zeros ( 2 ) , cos ) , height , ) ; antiprism . scale ( 0.5 / ( f64 :: PI * d as f64 / n as f64 ) . fsin ( ) ) ; antiprism } // Digon compounds are a special case. else { let half_height = f64 :: HALF_SQRT_2 ; let vertices = polygon . vertices ( ) . iter ( ) . map ( | v | v . push ( - half_height ) ) ; let dual_vertices = polygon . vertices ( ) . iter ( ) . map ( | v | vec ! [ v [ 1 ] v [ 0 ] half_height ] . into ( ) ) ; let mut antiprism = polygon . antiprism_with_vertices ( vertices , dual_vertices ) ; antiprism . scale ( 0.5 ) ; antiprism } }
Builds a uniform antiprism of unit edge length.
Builds a uniform antiprism of unit edge length .
n
usize
d
usize