mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 20:29:03 +00:00
Small C# fix in the "Arc polygon function" section (#6729)
This commit is contained in:
@@ -336,7 +336,7 @@ the same as before, except that we draw a polygon instead of lines:
|
||||
var colors = PackedColorArray([color])
|
||||
|
||||
for i in range(nb_points + 1):
|
||||
var angle_point = deg2rad(angle_from + i * (angle_to - angle_from) / nb_points - 90)
|
||||
var angle_point = deg_to_rad(angle_from + i * (angle_to - angle_from) / nb_points - 90)
|
||||
points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius)
|
||||
draw_polygon(points_arc, colors)
|
||||
|
||||
@@ -345,14 +345,14 @@ the same as before, except that we draw a polygon instead of lines:
|
||||
public void DrawCircleArcPoly(Vector2 center, float radius, float angleFrom, float angleTo, Color color)
|
||||
{
|
||||
int nbPoints = 32;
|
||||
var pointsArc = new Vector2[nbPoints + 1];
|
||||
var pointsArc = new Vector2[nbPoints + 2];
|
||||
pointsArc[0] = center;
|
||||
var colors = new Color[] { color };
|
||||
|
||||
for (int i = 0; i <= nbPoints; i++)
|
||||
{
|
||||
float anglePoint = Mathf.Deg2Rad(angleFrom + i * (angleTo - angleFrom) / nbPoints - 90);
|
||||
pointsArc[i] = center + new Vector2(Mathf.Cos(anglePoint), Mathf.Sin(anglePoint)) * radius;
|
||||
float anglePoint = Mathf.DegToRad(angleFrom + i * (angleTo - angleFrom) / nbPoints - 90);
|
||||
pointsArc[i + 1] = center + new Vector2(Mathf.Cos(anglePoint), Mathf.Sin(anglePoint)) * radius;
|
||||
}
|
||||
|
||||
DrawPolygon(pointsArc, colors);
|
||||
|
||||
Reference in New Issue
Block a user