/// 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 = T::PI * T::usize(d) / T::usize(n);
            let cos = angle.fcos();
            let height = ((cos - (T::TWO * angle).fcos()) * T::TWO).fsqrt();
            polygon.antiprism_with(
                &Hypersphere::with_squared_radius(Point::zeros(2), cos),
                height,
            )
        }
        // Digon compounds are a special case.
        else {
            let half_height = T::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());
            polygon.antiprism_with_vertices(vertices, dual_vertices)
        }
    }
fn uniform_antiprism ( n : usize , d : usize ) -> Self { let polygon = Self :: star_polygon ( n , d ) ; // Appropriately scaled antiprism. if n != 2 * d { let angle = T :: PI * T :: usize ( d ) / T :: usize ( n ) ; let cos = angle . fcos ( ) ; let height = ( ( cos - ( T :: TWO * angle ) . fcos ( ) ) * T :: TWO ) . fsqrt ( ) ; polygon . antiprism_with ( & Hypersphere :: with_squared_radius ( Point :: zeros ( 2 ) , cos ) , height , ) } // Digon compounds are a special case. else { let half_height = T :: 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 ( ) ) ; polygon . antiprism_with_vertices ( vertices , dual_vertices ) } }
Builds a uniform antiprism of unit edge length.
Builds a uniform antiprism of unit edge length .
n
usize
d
usize