Толщина круга

This commit is contained in:
2026-02-26 00:32:59 +03:00
parent f8731bde87
commit faf79367f6
2 changed files with 14 additions and 4 deletions

View File

@@ -30,11 +30,11 @@ pub fn drawLine(ctx: *DrawContext, x0: f32, y0: f32, x1: f32, y1: f32, color: Co
drawLineInBuffer(ctx, b0.x, b0.y, b1.x, b1.y, color, thickness_px);
}
/// Точка (px, py) лежит внутри/на круге с центром (cx, cy) и радиусом в квадрате r_sq.
/// Точка (px, py) лежит строго внутри круга с центром (cx, cy) и радиусом в квадрате r_sq (граница не включается).
fn insideCircle(px: i32, py: i32, cx: i32, cy: i32, r_sq: i32) bool {
const dx = px - cx;
const dy = py - cy;
return dx * dx + dy * dy <= r_sq;
return dx * dx + dy * dy < r_sq;
}
/// Заливает круг в буфере (для скруглённых концов отрезка).