fn try_dual_mut_with(&mut self, sphere: &Hypersphere<f64>) -> Result<(), Self::DualError> {
        // If we're dealing with a nullitope, the dual is itself.
        let rank = self.rank();
        if rank == 0 {
            return Ok(());
        }

        // We project the sphere's center onto the polytope's hyperplane to
        // avoid skew weirdness.
        let h = Subspace::from_points(self.vertices.iter());
        let o = h.project(&sphere.center);

        let mut projections;

        // We project our inversion center onto each of the facets.
        if rank >= 2 {
            let facet_count = self.facet_count();
            projections = Vec::with_capacity(facet_count);

            (0..facet_count)
                .into_par_iter()
                .map(|idx| {
                    Subspace::from_points(
                        self.element_vertices_ref(rank - 1, idx)
                            .unwrap()
                            .into_iter(),
                    )
                    .project(&o)
                })
                .collect_into_vec(&mut projections);
        } else {
            projections = self.vertices.clone();
        }

        // Reciprocates the projected points.
        for (idx, v) in projections.iter_mut().enumerate() {
            if !sphere.reciprocate_mut(v) && rank != 1 {
                return Err(DualError(idx));
            }
        }

        self.vertices = projections;
        self.abs.dual_mut();
        Ok(())
    }
/// Builds the dual of a polytope with a given reciprocation sphere in
/// place, or does nothing in case any facets go through the reciprocation
/// center. In case of failure, returns the index of the facet through the
/// projection center.
///
/// # Panics
/// This method shouldn't panic. If it does, please file a bug.
Builds the dual of a polytope with a given reciprocation sphere in
place, or does nothing in case any facets go through the reciprocation
center. In case of failure, returns the index of the facet through the
projection center.
Builds the dual of a polytope with a given reciprocation sphere in place or does nothing in case any facets go through the reciprocation center . In case of failure returns the index of the facet through the projection center .
fn try_dual_mut_with(&mut self, sphere: &Hypersphere<f64>) -> Result<(), Self::DualError> {
        // If we're dealing with a nullitope, the dual is itself.
        let rank = self.rank();
        if rank == 0 {
            return Ok(());
        }
        // We project the sphere's center onto the polytope's hyperplane to
        // avoid skew weirdness.
        let h = Subspace::from_points(self.vertices.iter());
        let o = h.project(&sphere.center);
        let mut projections;
        // We project our inversion center onto each of the facets.
        if rank >= 2 {
            let facet_count = self.facet_count();
            projections = Vec::with_capacity(facet_count);
            (0..facet_count)
                .into_par_iter()
                .map(|idx| {
                    Subspace::from_points(
                        self.element_vertices_ref(rank - 1, idx)
                            .unwrap()
                            .into_iter(),
                    )
                    .project(&o)
                })
                .collect_into_vec(&mut projections);
        } else {
            projections = self.vertices.clone();
        }
        // Reciprocates the projected points.
        for (idx, v) in projections.iter_mut().enumerate() {
            if !sphere.reciprocate_mut(v) && rank != 1 {
                return Err(DualError(idx));
            }
        }
        self.vertices = projections;
        self.abs.dual_mut();
        Ok(())
    }
fn try_dual_mut_with ( & mut self , sphere : & Hypersphere < f64 > ) -> Result < ( ) , Self :: DualError > { // If we're dealing with a nullitope, the dual is itself. let rank = self . rank ( ) ; if rank == 0 { return Ok ( ( ) ) ; } // We project the sphere's center onto the polytope's hyperplane to // avoid skew weirdness. let h = Subspace :: from_points ( self . vertices . iter ( ) ) ; let o = h . project ( & sphere . center ) ; let mut projections ; // We project our inversion center onto each of the facets. if rank >= 2 { let facet_count = self . facet_count ( ) ; projections = Vec :: with_capacity ( facet_count ) ; ( 0 .. facet_count ) . into_par_iter ( ) . map ( | idx | { Subspace :: from_points ( self . element_vertices_ref ( rank - 1 , idx ) . unwrap ( ) . into_iter ( ) , ) . project ( & o ) } ) . collect_into_vec ( & mut projections ) ; } else { projections = self . vertices . clone ( ) ; } // Reciprocates the projected points. for ( idx , v ) in projections . iter_mut ( ) . enumerate ( ) { if ! sphere . reciprocate_mut ( v ) && rank != 1 { return Err ( DualError ( idx ) ) ; } } self . vertices = projections ; self . abs . dual_mut ( ) ; Ok ( ( ) ) }
Builds the dual of a polytope with a given reciprocation sphere in
place, or does nothing in case any facets go through the reciprocation
center.
Builds the dual of a polytope with a given reciprocation sphere in place or does nothing in case any facets go through the reciprocation center .
&mut self
sphere
&Hypersphere<f64>
panics
This method shouldn't panic. If it does, please file a bug.
This method shouldn ' t panic . If it does please file a bug .