mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-22 23:25:51 +00:00
Refactor
This commit is contained in:
parent
6a442037d3
commit
0bbd5ab911
@ -63,14 +63,14 @@ impl Arc {
|
|||||||
let unit_vector_midpoint_to_center =
|
let unit_vector_midpoint_to_center =
|
||||||
Vector::from([-unit_vector_p0_to_p1.v, unit_vector_p0_to_p1.u]);
|
Vector::from([-unit_vector_p0_to_p1.v, unit_vector_p0_to_p1.u]);
|
||||||
// (cx, cy) is the center of the circle
|
// (cx, cy) is the center of the circle
|
||||||
let cx = ((x0 + x1) / 2.)
|
let center = Point {
|
||||||
+ distance_center_to_midpoint * unit_vector_midpoint_to_center.u;
|
coords: (p0.coords + p1.coords) / 2.
|
||||||
let cy = ((y0 + y1) / 2.)
|
+ unit_vector_midpoint_to_center * distance_center_to_midpoint,
|
||||||
+ distance_center_to_midpoint * unit_vector_midpoint_to_center.v;
|
};
|
||||||
let start_angle = (y0 - cy).atan2(x0 - cx);
|
let start_angle = (y0 - center.v).atan2(x0 - center.u);
|
||||||
let end_angle = (y1 - cy).atan2(x1 - cx) + end_angle_offset;
|
let end_angle = (y1 - center.v).atan2(x1 - center.u) + end_angle_offset;
|
||||||
Self {
|
Self {
|
||||||
center: Point::from([cx, cy]),
|
center,
|
||||||
radius,
|
radius,
|
||||||
start_angle,
|
start_angle,
|
||||||
end_angle,
|
end_angle,
|
||||||
|
Loading…
Reference in New Issue
Block a user