@@ -1005,9 +1005,10 @@ Calculating this arc will be more complex than in the case of the line:
10051005 .. code-tab :: gdscript GDScript
10061006
10071007 func _draw():
1008- # Calculate the arc parameters.
1009- var center : Vector2 = Vector2((_point2.x - point1.x) / 2,
1010- (_point2.y - point1.y) / 2)
1008+ # Average points to get center.
1009+ var center : Vector2 = Vector2((_point2.x + point1.x) / 2,
1010+ (_point2.y + point1.y) / 2)
1011+ # Calculate the rest of the arc parameters.
10111012 var radius : float = point1.distance_to(_point2) / 2
10121013 var start_angle : float = (_point2 - point1).angle()
10131014 var end_angle : float = (point1 - _point2).angle()
@@ -1022,9 +1023,10 @@ Calculating this arc will be more complex than in the case of the line:
10221023
10231024 public override void _Draw()
10241025 {
1025- // Calculate the arc parameters.
1026- Vector2 center = new Vector2((_point2.X - Point1.X) / 2.0f,
1027- (_point2.Y - Point1.Y) / 2.0f);
1026+ // Average points to get center.
1027+ Vector2 center = new Vector2((_point2.X + Point1.X) / 2.0f,
1028+ (_point2.Y + Point1.Y) / 2.0f);
1029+ // Calculate the rest of the arc parameters.
10281030 float radius = Point1.DistanceTo(_point2) / 2.0f;
10291031 float startAngle = (_point2 - Point1).Angle();
10301032 float endAngle = (Point1 - _point2).Angle();
0 commit comments