The arc2
function draws an arc segment of a circle within the Sdf2d
drawing context. It defines a portion of a circle centered at (x, y)
with radius r
, starting from angle s
and ending at angle e
. The arc is shaped based on the current position within the drawing context.
Sdf2d
instance. The function modifies the internal state of self
to represent the arc shape.float
): The x-coordinate of the circle's center.float
): The y-coordinate of the circle's center.float
): The radius of the circle.float
): The start angle of the arc in radians. Angles are measured from the positive x-axis.float
): The end angle of the arc in radians.Sdf2d
context to include the arc.In this example:
Sdf2d
context using the current position (self.pos
) and size (self.rect_size
) of the viewport.arc2
to draw a semicircular arc centered at (50.0, 50.0)
with a radius of 40.0
. The arc starts from 0.0
radians (corresponding to the positive x-axis) and ends at PI
radians (180 degrees), forming the upper half of a circle.fill
with the color #f00
(solid red) to fill the arc shape.sdf.result
, which contains the final rendered color.s
and e
are measured in radians. A full circle is 2 * PI
radians. Use PI / 2
for 90 degrees, PI
for 180 degrees, etc.arc2
function modifies the shape used by the fill functions. Ensure you call fill
, fill_keep
, or another drawing function after defining the arc to render it.translate
, rotate
, or scale
before drawing the arc to position and orient it as needed.