Object Drawer

class discopygal_tools.scene_designer.object_drawer.ObjectDrawer(gui)

Bases: object

A class that handles creation of objects in the scene When an object is finished drawing - then add it to the scene

add_disc_obstacle() None

Add disc obstacle to scene after finished drawing

add_disc_robot() None

Add disc robot to the scene after finished drawing

add_poly_obstacle() None

Add polygonal obstacle to scene after finished drawing

add_poly_robot() None

Add polygonal robot to the scene after finished drawing

add_rod_robot() None

Add rod robot to the scene after finished drawing

clear_drawing() None

Discard any drawings currently made

right_click_handle(x: float, y: float) None

Handle right clicks (when drawing a scene)

set_object_type_drawing(obj_type) None

Set the new object type mode (and the according draw mode) Also discard any previous drawing made by user

discopygal_tools.scene_designer.object_drawer.calculate_polygon_center_of_mass(vertices: list) list

Calculate the center position of a polygon as the mean of its vertices. This ensures the position aligns with how the polygon is visually rendered.

Parameters:

vertices – List of [x, y] coordinates

Returns:

[x_center, y_center]