Transform
lerax.render.Transform
Bases:
Affine mapping from world coords to screen pixels.
Has a constant scale for all axis to avoid distortion.
Attributes:
| Name | Type | Description |
|---|---|---|
|
|
Width of the screen in pixels. |
|
|
Height of the screen in pixels. |
|
|
Scale factor from world units to pixels. |
|
|
Offset to add after scaling. |
|
|
If True, the y-axis points up in world space. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
|
Width of the screen in pixels. |
required |
height
|
|
Height of the screen in pixels. |
required |
scale
|
|
Scale factor from world units to pixels. |
required |
offset
|
|
Offset to add after scaling. |
required |
y_up
|
|
If True, the y-axis points up in world space. |
True
|
__init__
__init__(
width: Int[ArrayLike, ""],
height: Int[ArrayLike, ""],
scale: Float[ArrayLike, ""],
offset: Float[ArrayLike, 2],
y_up: bool = True,
)
world_to_px
Return pixel coordinates corresponding to a point in world space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
|
A point in world space. |
required |
Returns:
| Type | Description |
|---|---|
|
The corresponding pixel coordinates. |
scale_length
Scale a length in world space to pixel space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
length
|
|
A length in world space. |
required |
Returns:
| Type | Description |
|---|---|
|
The corresponding length in pixel space. |