1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 15:13:12 -04:00

Simplify some bezier math

This commit is contained in:
Emil Ernerfeldt
2025-06-30 10:03:54 +02:00
parent c943720eed
commit 2525546fef

View File

@@ -253,8 +253,8 @@ impl CubicBezierShape {
if p > 0.0 {
return None;
}
let r = (-1.0 * (p / 3.0).powi(3)).sqrt();
let theta = (-1.0 * q / (2.0 * r)).acos() / 3.0;
let r = (-(p / 3.0).powi(3)).sqrt();
let theta = (-q / (2.0 * r)).acos() / 3.0;
let t1 = 2.0 * r.cbrt() * theta.cos() + h;
let t2 = 2.0 * r.cbrt() * (theta + 120.0 * std::f32::consts::PI / 180.0).cos() + h;