larvaworld.lib.model.modules.rot_surface ======================================== .. py:module:: larvaworld.lib.model.modules.rot_surface Classes ------- .. autoapisummary:: larvaworld.lib.model.modules.rot_surface.RotSurface larvaworld.lib.model.modules.rot_surface.RotTriangle larvaworld.lib.model.modules.rot_surface.LightSource Module Contents --------------- .. py:class:: RotSurface(x: float, y: float, direction: float, surf: Any, **kwargs: Any) Bases: :py:obj:`larvaworld.lib.model.Object` Rotatable surface object for 2D visualization. Base class for drawable objects with position, direction, and pygame surface rendering capabilities. Attributes: x: Object x-coordinate position. y: Object y-coordinate position. direction: Orientation in radians. surf: pygame Surface for rendering. speed: Movement speed (default: 0). Example: >>> rot_obj = RotSurface( ... x=100, y=100, ... direction=0.0, ... surf=my_surface ... ) .. py:attribute:: x .. py:attribute:: y .. py:attribute:: direction .. py:attribute:: surf .. py:attribute:: speed :value: 0 .. py:method:: step() -> None .. py:method:: draw(viewer: Any) -> None .. py:class:: RotTriangle(x: float, y: float, size: int, color_fg: Tuple[int, int, int], color_bg: Tuple[int, int, int], direction: float) Bases: :py:obj:`RotSurface` Rotatable triangle visualization object. Renders a triangle shape with specified size and colors, commonly used for representing robots or agents in simulation. Attributes: size: Triangle size in pixels. color_fg: Foreground RGB color tuple. color_bg: Background RGB color tuple (transparent). Example: >>> triangle = RotTriangle( ... x=50, y=50, size=20, ... color_fg=(255, 0, 0), ... color_bg=(0, 0, 0), ... direction=1.57 ... ) .. py:attribute:: size .. py:attribute:: color_fg .. py:attribute:: color_bg .. py:attribute:: surf .. py:class:: LightSource(x: float, y: float, emitting_power: int, color_fg: Tuple[int, int, int] = util.Color.YELLOW, color_bg: Tuple[int, int, int] = util.Color.BLACK, **kwargs: Any) Bases: :py:obj:`RotSurface` Light source object for sensor detection. Visualizes light sources in simulation environment, detected by LightSensor instances with intensity based on distance. Attributes: emitting_power: Light intensity/size. color_fg: Foreground color (default: YELLOW). color_bg: Background color (default: BLACK). size: Visual size (equals emitting_power). Example: >>> light = LightSource( ... x=200, y=200, ... emitting_power=30, ... color_fg=(255, 255, 0) ... ) .. py:attribute:: emitting_power .. py:attribute:: color_fg .. py:attribute:: color_bg .. py:attribute:: size .. py:attribute:: label :value: None .. py:attribute:: surf .. py:method:: get_saved_scene_repr() -> str