MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / world_to_pixel

Method world_to_pixel

PythonAPI/examples/no_rendering_mode.py:860–864  ·  view source on GitHub ↗

Converts the world coordinates to pixel coordinates

(self, location, offset=(0, 0))

Source from the content-addressed store, hash-verified

858 draw_traffic_signs(map_surface, yield_font_surface, ts_yield, trigger_color=COLOR_ORANGE_1)
859
860 def world_to_pixel(self, location, offset=(0, 0)):
861 """Converts the world coordinates to pixel coordinates"""
862 x = self.scale * self._pixels_per_meter * (location.x - self._world_offset[0])
863 y = self.scale * self._pixels_per_meter * (location.y - self._world_offset[1])
864 return [int(x - offset[0]), int(y - offset[1])]
865
866 def world_to_pixel_width(self, width):
867 """Converts the world units to pixel units"""

Callers 1

renderMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected