# Map one region to another

**URL:** <https://discourse.processing.org/t/map-one-region-to-another/36720>\
**Category:** Coding Questions\
**Created:** [May 4, 2022, 8:25pm UTC](https://discourse.processing.org/t/map-one-region-to-another/36720 "2022-05-04T20:25:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![guille](https://avatars.discourse-cdn.com/v4/letter/g/aeb1de/32.png) [@guille](https://discourse.processing.org/u/guille)\
**Post date:** [May 4, 2022, 8:25pm UTC](https://discourse.processing.org/t/map-one-region-to-another/36720/1 "2022-05-04T20:25:58Z")

</div>

I am working on a sketch to get Pythagorean dissections from Pythagorean tilings ([here](https://editor.p5js.org/guillevg/sketches/tRDKtY_o9)). I am having a hard time trying to rotate the region in the black square so that it appears with vertical/horizontal sides (some of that code is commented). I am trying to copy the region in a buffer, rotate, and copy back, but I can’t make it work. It feels like there should be some way to map one quad region to another, kind of like the way texture() works. Is it possible? How should I do this? Thanks!!

---

<div class="post-metadata">

**Author:** ![scudly](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/scudly/32/5597_2.png) [@scudly](https://discourse.processing.org/u/scudly)\
**Post date:** [May 5, 2022, 10:37pm UTC](https://discourse.processing.org/t/map-one-region-to-another/36720/2 "2022-05-05T22:37:26Z")

</div>

Instead of copying the pixels, you could create a PGraphics of the sample size, rotate and scale your geometry to fit a single tiling and draw into it. Then you can paste it as an image.
