diff --git a/src/entities/arc.rs b/src/entities/arc.rs index 96b6c9e6b..44f9f73cb 100644 --- a/src/entities/arc.rs +++ b/src/entities/arc.rs @@ -152,24 +152,24 @@ fn properties(arc: &Arc) -> Vec { vec![PropSection { title: "Geometry".into(), props: vec![ + ro("Start X", "start_x", format!("{sx:.4}")), + ro("Start Y", "start_y", format!("{sy:.4}")), + ro("Start Z", "start_z", format!("{sz:.4}")), edit("Center X", "center_x", arc.center.x), edit("Center Y", "center_y", arc.center.y), edit("Center Z", "center_z", arc.center.z), + ro("End X", "end_x", format!("{ex:.4}")), + ro("End Y", "end_y", format!("{ey:.4}")), + ro("End Z", "end_z", format!("{ez:.4}")), edit("Radius", "radius", arc.radius), edit("Start angle", "start_angle", sa.to_degrees()), edit("End angle", "end_angle", ea.to_degrees()), ro("Total angle", "total_angle", format!("{total_angle:.2}")), ro("Arc length", "arc_length", format!("{arc_length:.4}")), ro("Area", "area", format!("{area:.4}")), - ro("Start X", "start_x", format!("{sx:.4}")), - ro("Start Y", "start_y", format!("{sy:.4}")), - ro("Start Z", "start_z", format!("{sz:.4}")), - ro("End X", "end_x", format!("{ex:.4}")), - ro("End Y", "end_y", format!("{ey:.4}")), - ro("End Z", "end_z", format!("{ez:.4}")), - edit("Normal X", "normal_x", arc.normal.x), - edit("Normal Y", "normal_y", arc.normal.y), - edit("Normal Z", "normal_z", arc.normal.z), + ro("Normal X", "normal_x", format!("{:.4}", arc.normal.x)), + ro("Normal Y", "normal_y", format!("{:.4}", arc.normal.y)), + ro("Normal Z", "normal_z", format!("{:.4}", arc.normal.z)), ], }] } @@ -185,9 +185,6 @@ fn apply_geom_prop(arc: &mut Arc, field: &str, value: &str) { "radius" if v > 0.0 => arc.radius = v, "start_angle" => arc.start_angle = v.to_radians(), "end_angle" => arc.end_angle = v.to_radians(), - "normal_x" => arc.normal.x = v, - "normal_y" => arc.normal.y = v, - "normal_z" => arc.normal.z = v, _ => {} } } diff --git a/src/entities/circle.rs b/src/entities/circle.rs index 4f04c041e..766e0dfcf 100644 --- a/src/entities/circle.rs +++ b/src/entities/circle.rs @@ -128,21 +128,18 @@ fn properties(circle: &Circle) -> Vec { edit("Center Y", "center_y", circle.center.y), edit("Center Z", "center_z", circle.center.z), edit("Radius", "radius", r), - ro("Diameter", "diameter", format!("{:.4}", r * 2.0)), - ro( - "Circumference", - "circumference", - format!("{:.4}", 2.0 * PI * r), - ), - ro("Area", "area", format!("{:.4}", PI * r * r)), - edit("Normal X", "normal_x", circle.normal.x), - edit("Normal Y", "normal_y", circle.normal.y), - edit("Normal Z", "normal_z", circle.normal.z), + edit("Diameter", "diameter", r * 2.0), + edit("Circumference", "circumference", 2.0 * PI * r), + edit("Area", "area", PI * r * r), + ro("Normal X", "normal_x", format!("{:.4}", circle.normal.x)), + ro("Normal Y", "normal_y", format!("{:.4}", circle.normal.y)), + ro("Normal Z", "normal_z", format!("{:.4}", circle.normal.z)), ], }] } fn apply_geom_prop(circle: &mut Circle, field: &str, value: &str) { + use std::f64::consts::PI; let Some(v) = parse_f64(value) else { return; }; @@ -151,9 +148,9 @@ fn apply_geom_prop(circle: &mut Circle, field: &str, value: &str) { "center_y" => circle.center.y = v, "center_z" => circle.center.z = v, "radius" if v > 0.0 => circle.radius = v, - "normal_x" => circle.normal.x = v, - "normal_y" => circle.normal.y = v, - "normal_z" => circle.normal.z = v, + "diameter" if v > 0.0 => circle.radius = v / 2.0, + "circumference" if v > 0.0 => circle.radius = v / (2.0 * PI), + "area" if v > 0.0 => circle.radius = (v / PI).sqrt(), _ => {} } }