electrosim.rendering.primitives#
Functions
|
Draw a blurred radial glow using concentric alpha circles. |
|
Draw a metric grid in meters over the entire world size. |
|
Convert integer screen pixels to world meters as a float array. |
|
Convert world coordinates (m) to integer screen pixels. |
- world_vector_to_screen(pos_meters, pixels_per_meter)[source]#
Convert world coordinates (m) to integer screen pixels.
- Parameters:
pos_meters (numpy.ndarray shape (2,)) – World position in meters.
pixels_per_meter (float) – Pixels per meter scale.
- Returns:
tuple[int, int] – Pixel coordinates.
- Return type:
Tuple[int, int]
- screen_vector_to_world(pos_pixels, pixels_per_meter)[source]#
Convert integer screen pixels to world meters as a float array.
- Parameters:
pos_pixels (tuple[int, int]) – Pixel coordinates.
pixels_per_meter (float) – Pixels per meter scale.
- Returns:
numpy.ndarray shape (2,) – World position in meters.
- Return type:
ndarray
- draw_meter_grid(screen, world_size_m, pixels_per_meter)[source]#
Draw a metric grid in meters over the entire world size.
Major lines and colors are controlled via config constants.
- Parameters:
screen (Surface)
world_size_m (ndarray)
pixels_per_meter (float)
- Return type:
None
- draw_glow_at_screen_pos(screen, center_px, base_radius_px, color_rgb, intensity)[source]#
Draw a blurred radial glow using concentric alpha circles.
- Parameters:
screen (pygame.Surface) – Target surface.
center_px (tuple[int, int]) – Center pixel.
base_radius_px (int) – Base radius for the core circle.
color_rgb (tuple[int,int,int]) – Glow color.
intensity (float) – [0,1] normalized intensity, typically |q|/MAX_CHARGE_C.
- Return type:
None