Can anyone know the formula for building a ring with an outer radius, with an inner radius, and the number of segments based on batch_for_shader(shader, ‘TRIS’, {“pos”: vertices_outer}, indices=trisIndices)
I found a way to build a circle using the function
def draw_circle_2d_filled(shader, position, radius, color):
mx = position[0]
my = position[1]
prefs = bpy.context.preferences.system
radius = radius * (prefs.dpi * prefs.pixel_size / 72)
sides = 60
vertices = [(radius * cos(i * 2 * pi / sides) + mx,
radius * sin(i * 2 * pi / sides) + my)
for i in range(sides + 1)]
batch = batch_for_shader(shader, 'TRI_FAN', {"pos": vertices})
shader.bind()
shader.uniform_float("color", color)
batch.draw(shader)
I need to build a ring for the UI, so I need vertex positions in the 2D vector.
I plan to make a widget of the zbrush type