pub fn show(&mut self, ui: &mut Ui) -> ShowResult {
        let text = self.label();

        match self {
            // An {n / d} regular polygon or uniform polygonal prism.
            Self::Polygon(n, d) | Self::Prism(n, d) => {
                let mut clicked = false;

                ui.horizontal(|ui| {
                    clicked = ui.button(text).clicked();

                    // Number of sides.
                    ui.label("n:");
                    ui.add(
                        egui::DragValue::new(n)
                            .speed(0.03)
                            .clamp_range(2..=usize::MAX),
                    );

                    // Turning number.
                    let max_n = *n / 2;
                    ui.label("d:");
                    ui.add(egui::DragValue::new(d).speed(0.03).clamp_range(1..=max_n));
                });

                if clicked {
                    ShowResult::Special(*self)
                } else {
                    ShowResult::None
                }
            }

            // An {n / d} uniform antiprism.
            Self::Antiprism(n, d) | Self::AntiprismPrism(n, d) => {
                let clicked = ui.horizontal(|ui| {
                    let clicked = ui.button(text).clicked();

                    // Number of sides.
                    ui.label("n:");
                    ui.add(
                        egui::DragValue::new(n)
                            .speed(0.03)
                            .clamp_range(2..=usize::MAX),
                    );

                    // Turning number.
                    let max_n = *n * 2 / 3;
                    ui.label("d:");
                    ui.add(egui::DragValue::new(d).speed(0.03).clamp_range(1..=max_n));

                    clicked
                });

                if clicked.inner {
                    ShowResult::Special(*self)
                } else {
                    ShowResult::None
                }
            }

            // An step prism based on two uniform polygons..
            Self::Duoprism(n1, d1, n2, d2) => {
                let clicked = ui.horizontal_wrapped(|ui| {
                    let clicked = ui.button(text).clicked();

                    // Number of sides.
                    ui.label("n₁:");
                    ui.add(
                        egui::DragValue::new(n1)
                            .speed(0.03)
                            .clamp_range(2..=usize::MAX),
                    );

                    // Turning number.
                    let max_n1 = *n1 / 2;
                    ui.label("d₁:");
                    ui.add(egui::DragValue::new(d1).speed(0.03).clamp_range(1..=max_n1));

                    // Number of sides.
                    ui.label("n₂:");
                    ui.add(
                        egui::DragValue::new(n2)
                            .speed(0.03)
                            .clamp_range(2..=usize::MAX),
                    );

                    // Turning number.
                    let max_n2 = *n2 / 2;
                    ui.label("d₂:");
                    ui.add(egui::DragValue::new(d2).speed(0.03).clamp_range(1..=max_n2));

                    clicked
                });

                if clicked.inner {
                    ShowResult::Special(*self)
                } else {
                    ShowResult::None
                }
            }

            // A simplex, hypercube, or orthoplex of a given rank.
            Self::Simplex(rank) | Self::Hypercube(rank) | Self::Orthoplex(rank) => {
                let clicked = ui.horizontal(|ui| {
                    let clicked = ui.button(text).clicked();

                    ui.label("Rank:");
                    ui.add(egui::DragValue::new(rank).speed(0.03).clamp_range(-1..=20));

                    clicked
                });

                if clicked.inner {
                    ShowResult::Special(*self)
                } else {
                    ShowResult::None
                }
            }
        }
    }
/// Shows the special component of the library. Returns the action selected
/// by the user, if any.
Shows the special component of the library. Returns the action selected
by the user, if any.
Shows the special component of the library . Returns the action selected by the user if any .
pub fn show(&mut self, ui: &mut Ui) -> ShowResult {
        let text = self.label();
        match self {
            // An {n / d} regular polygon or uniform polygonal prism.
            Self::Polygon(n, d) | Self::Prism(n, d) => {
                let mut clicked = false;
                ui.horizontal(|ui| {
                    clicked = ui.button(text).clicked();
                    // Number of sides.
                    ui.label("n:");
                    ui.add(
                        egui::DragValue::new(n)
                            .speed(0.03)
                            .clamp_range(2..=usize::MAX),
                    );
                    // Turning number.
                    let max_n = *n / 2;
                    ui.label("d:");
                    ui.add(egui::DragValue::new(d).speed(0.03).clamp_range(1..=max_n));
                });
                if clicked {
                    ShowResult::Special(*self)
                } else {
                    ShowResult::None
                }
            }
            // An {n / d} uniform antiprism.
            Self::Antiprism(n, d) | Self::AntiprismPrism(n, d) => {
                let clicked = ui.horizontal(|ui| {
                    let clicked = ui.button(text).clicked();
                    // Number of sides.
                    ui.label("n:");
                    ui.add(
                        egui::DragValue::new(n)
                            .speed(0.03)
                            .clamp_range(2..=usize::MAX),
                    );
                    // Turning number.
                    let max_n = *n * 2 / 3;
                    ui.label("d:");
                    ui.add(egui::DragValue::new(d).speed(0.03).clamp_range(1..=max_n));
                    clicked
                });
                if clicked.inner {
                    ShowResult::Special(*self)
                } else {
                    ShowResult::None
                }
            }
            // An step prism based on two uniform polygons..
            Self::Duoprism(n1, d1, n2, d2) => {
                let clicked = ui.horizontal_wrapped(|ui| {
                    let clicked = ui.button(text).clicked();
                    // Number of sides.
                    ui.label("n₁:");
                    ui.add(
                        egui::DragValue::new(n1)
                            .speed(0.03)
                            .clamp_range(2..=usize::MAX),
                    );
                    // Turning number.
                    let max_n1 = *n1 / 2;
                    ui.label("d₁:");
                    ui.add(egui::DragValue::new(d1).speed(0.03).clamp_range(1..=max_n1));
                    // Number of sides.
                    ui.label("n₂:");
                    ui.add(
                        egui::DragValue::new(n2)
                            .speed(0.03)
                            .clamp_range(2..=usize::MAX),
                    );
                    // Turning number.
                    let max_n2 = *n2 / 2;
                    ui.label("d₂:");
                    ui.add(egui::DragValue::new(d2).speed(0.03).clamp_range(1..=max_n2));
                    clicked
                });
                if clicked.inner {
                    ShowResult::Special(*self)
                } else {
                    ShowResult::None
                }
            }
            // A simplex, hypercube, or orthoplex of a given rank.
            Self::Simplex(rank) | Self::Hypercube(rank) | Self::Orthoplex(rank) => {
                let clicked = ui.horizontal(|ui| {
                    let clicked = ui.button(text).clicked();
                    ui.label("Rank:");
                    ui.add(egui::DragValue::new(rank).speed(0.03).clamp_range(-1..=20));
                    clicked
                });
                if clicked.inner {
                    ShowResult::Special(*self)
                } else {
                    ShowResult::None
                }
            }
        }
    }
pub fn show ( & mut self , ui : & mut Ui ) -> ShowResult { let text = self . label ( ) ; match self { // An {n / d} regular polygon or uniform polygonal prism. Self :: Polygon ( n , d ) | Self :: Prism ( n , d ) => { let mut clicked = false ; ui . horizontal ( | ui | { clicked = ui . button ( text ) . clicked ( ) ; // Number of sides. ui . label ( " " ) ; ui . add ( egui :: DragValue :: new ( n ) . speed ( 0.03 ) . clamp_range ( 2 ..= usize :: MAX ) , ) ; // Turning number. let max_n = * n / 2 ; ui . label ( " " ) ; ui . add ( egui :: DragValue :: new ( d ) . speed ( 0.03 ) . clamp_range ( 1 ..= max_n ) ) ; } ) ; if clicked { ShowResult :: Special ( * self ) } else { ShowResult :: None } } // An {n / d} uniform antiprism. Self :: Antiprism ( n , d ) | Self :: AntiprismPrism ( n , d ) => { let clicked = ui . horizontal ( | ui | { let clicked = ui . button ( text ) . clicked ( ) ; // Number of sides. ui . label ( " " ) ; ui . add ( egui :: DragValue :: new ( n ) . speed ( 0.03 ) . clamp_range ( 2 ..= usize :: MAX ) , ) ; // Turning number. let max_n = * n * 2 / 3 ; ui . label ( " " ) ; ui . add ( egui :: DragValue :: new ( d ) . speed ( 0.03 ) . clamp_range ( 1 ..= max_n ) ) ; clicked } ) ; if clicked . inner { ShowResult :: Special ( * self ) } else { ShowResult :: None } } // An step prism based on two uniform polygons.. Self :: Duoprism ( n1 , d1 , n2 , d2 ) => { let clicked = ui . horizontal_wrapped ( | ui | { let clicked = ui . button ( text ) . clicked ( ) ; // Number of sides. ui . label ( " ; ui . add ( egui :: DragValue :: new ( n1 ) . speed ( 0.03 ) . clamp_range ( 2 ..= usize :: MAX ) , ) ; // Turning number. let max_n1 = * n1 / 2 ; ui . label ( " ; ui . add ( egui :: DragValue :: new ( d1 ) . speed ( 0.03 ) . clamp_range ( 1 ..= max_n1 ) ) ; // Number of sides. ui . label ( " ; ui . add ( egui :: DragValue :: new ( n2 ) . speed ( 0.03 ) . clamp_range ( 2 ..= usize :: MAX ) , ) ; // Turning number. let max_n2 = * n2 / 2 ; ui . label ( " ; ui . add ( egui :: DragValue :: new ( d2 ) . speed ( 0.03 ) . clamp_range ( 1 ..= max_n2 ) ) ; clicked } ) ; if clicked . inner { ShowResult :: Special ( * self ) } else { ShowResult :: None } } // A simplex, hypercube, or orthoplex of a given rank. Self :: Simplex ( rank ) | Self :: Hypercube ( rank ) | Self :: Orthoplex ( rank ) => { let clicked = ui . horizontal ( | ui | { let clicked = ui . button ( text ) . clicked ( ) ; ui . label ( " " ) ; ui . add ( egui :: DragValue :: new ( rank ) . speed ( 0.03 ) . clamp_range ( - 1 ..= 20 ) ) ; clicked } ) ; if clicked . inner { ShowResult :: Special ( * self ) } else { ShowResult :: None } } } }
Shows the special component of the library.
Shows the special component of the library .
&mut self
ui
&mut Ui
&mut self
ui
&mut Ui