Skip to content

Commit

Permalink
Update tutorials/2d/custom_drawing_in_2d.rst
Browse files Browse the repository at this point in the history
Co-authored-by: Raul Santos <raulsntos@gmail.com>
  • Loading branch information
jynus and raulsntos authored Dec 20, 2023
1 parent bc231e0 commit d23f64a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tutorials/2d/custom_drawing_in_2d.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1023,14 +1023,14 @@ Calculating this arc will be more complex than in the case of the line:
public override void _Draw()
{
// Calculate the arc parameters.
Vector2 center = new Vector2((point2.X - point1.X) / 2.0f,
(point2.Y - point1.Y) / 2.0f);
float radius = point1.DistanceTo(point2) / 2.0f;
float start_angle = (point2 - point1).Angle();
float end_angle = (point1 - point2).Angle();
if (end_angle < 0.0f) // end_angle is likely negative, normalize it.
Vector2 center = new Vector2((_point2.X - Point1.X) / 2.0f,
(_point2.Y - Point1.Y) / 2.0f);
float radius = Point1.DistanceTo(_point2) / 2.0f;
float startAngle = (_point2 - Point1).Angle();
float endAngle = (Point1 - _point2).Angle();
if (endAngle < 0.0f) // endAngle is likely negative, normalize it.
{
end_angle += (float)Math.Tau;
endAngle += Mathf.Tau;
}

// Finally, draw the arc.
Expand Down

0 comments on commit d23f64a

Please sign in to comment.