Transforms in generativepy
Martin McBride, 2022-01-08
Tags generativepy tutorial user space device space
Categories generativepy generativepy tutorial

Whenever you draw a Shape in generativepy, its size an position are specified in user space.
By default, user space maps directly onto device space, where one unit corresponds to 1 pixel in the generated image. However, we can change that mapping by applying scaling, rotation and other transformations. This means that an object specifies in user space will appear transformed in the final image. That avoids the need to perform any calculations in your drawing code.
This section covers:
- User space and device space.
- The Transform class.
- Clipping.
If you found this article useful, you might be interested in the book Computer Graphics in Python or other books by the same author.
Prev