# Why PushMatrix and PopMatrix is not implemented?

**URL:** <https://openrndr.discourse.group/t/why-pushmatrix-and-popmatrix-is-not-implemented/655>\
**Category:** OPENRNDR\
**Created:** [May 11, 2024, 8:51pm UTC](https://openrndr.discourse.group/t/why-pushmatrix-and-popmatrix-is-not-implemented/655 "2024-05-11T20:51:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![art-coder](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/art-coder/32/701_2.png) [@art-coder](https://openrndr.discourse.group/u/art-coder)\
**Post date:** [May 11, 2024, 8:51pm UTC](https://openrndr.discourse.group/t/why-pushmatrix-and-popmatrix-is-not-implemented/655/1 "2024-05-11T20:51:56Z")

</div>

I want to translate code from Processing to OPENRNDR but pushMatrix and popMatrix code block is how can I translate OPENNRDR. You did a great job to write code kotlin so anything other approach you to find and not implemented, I assumed.

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [May 11, 2024, 11:09pm UTC](https://openrndr.discourse.group/t/why-pushmatrix-and-popmatrix-is-not-implemented/655/2 "2024-05-11T23:09:35Z")

</div>

Hello @art-coder ! Welcome to the forum 🙂

`pushMatrix` and `popMatrix` always need to be used in pairs and it’s easy to accidentally call one more times than the other. OPENRNDR provides a different approach which makes it impossible to make that mistake:

```kotlin
drawer.isolated {
  drawer.rotate(...)
  drawer.translate(...)
  drawer.rectangle(...)
}

```

Basically, you can replace a push/pop matrix pair by `drawer.isolated { ... }`, and it behaves like [push and pop in p5js](https://p5js.org/reference/#/p5/push).

If you prefer to use the same approach like in Processing you can call `pushTransforms()` and `popTransforms()`. Or for more fine-grained methods, see `pushStyle()`, `popStyle()`, `pushModel()`, `popModel()`, `pushView()`, `popView()`, `pushProjection()`, `popProjection()`. The source code for these methods is found in [Drawer.kt](https://github.com/openrndr/openrndr/blob/master/openrndr-draw/src/commonMain/kotlin/org/openrndr/draw/Drawer.kt).

---

<div class="post-metadata">

**Author:** ![art-coder](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/art-coder/32/701_2.png) [@art-coder](https://openrndr.discourse.group/u/art-coder)\
**Post date:** [May 13, 2024, 8:06pm UTC](https://openrndr.discourse.group/t/why-pushmatrix-and-popmatrix-is-not-implemented/655/3 "2024-05-13T20:06:25Z")

</div>

Thank you for your guide. I also have question about processing’s arc function I find in document to write about make arc through logical operation but it is always do write circle and logical operation? I can find arcTo oh, i forgot exact name of this method, but how to use them is not wrote in documentation. Most easy approach I can write processing’s arc method like draw is. I would like to know.

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [May 14, 2024, 10:00pm UTC](https://openrndr.discourse.group/t/why-pushmatrix-and-popmatrix-is-not-implemented/655/4 "2024-05-14T22:00:12Z")

</div>

I’m afraid I don’t fully understand your question.

Does this example help you?

> <https://github.com/openrndr/orx/blob/master/orx-shapes/src/jvmDemo/kotlin/primitives/DemoArc01.kt>

PS. Maybe [www.deepl.com](http://www.deepl.com) can help translating to and from English 🙂
