draw_arc vs draw_circle_arc

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rakkarage

godot draw_arc vs draw_circle_arc

extends Control

func _draw():
	var start = get_viewport_rect().size / 2.0
	var p1 = Vector2(128, 128)
	var p2 = Vector2(256, 256)
	draw_circle_arc(start, start.distance_to(p1), 0, 360, Color.purple)
	draw_arc(start, start.distance_to(p2), 0, 360, 32, Color.purple, 1)

func draw_circle_arc(center, radius, angle_from, angle_to, color):
	var nb_points = 32
	var points_arc = PoolVector2Array()

	for i in range(nb_points + 1):
		var angle_point = deg2rad(angle_from + i * (angle_to-angle_from) / nb_points - 90)
		points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius)

	for index_point in range(nb_points):
		draw_line(points_arc[index_point], points_arc[index_point + 1], color)

is there any way to make draw_arc behave like draw_circle_arc? am i doing something wrong or it supposed to look like that? wtf is it for spirograph?

custom drawing in 2d

:bust_in_silhouette: Reply From: rakkarage

oh sorry one takes radians and one takes angles :slight_smile:
so 0 to 2*PI instead of 0 to 360

EDIT: 2*PI is defined for us as TAU! :slight_smile: