# Relative and global coordinates

**URL:** https://discourse.processing.org/t/relative-and-global-coordinates/46992
**Category:** Coding Questions
**Created:** [August 21, 2025, 1:37am UTC](https://discourse.processing.org/t/relative-and-global-coordinates/46992 "2025-08-21T01:37:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![EricRogerGarcia](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ericrogergarcia/32/21029_2.png) [@EricRogerGarcia](https://discourse.processing.org/u/EricRogerGarcia)
#### Post date: [August 21, 2025, 1:37am UTC](https://discourse.processing.org/t/relative-and-global-coordinates/46992/1 "2025-08-21T01:37:21Z")

</div>

If I draw, for example, a point at a coordinate (0,0) after successively using translate(), scale(); rotate() many times,

Is there a possibility to have the coordinates of the point in the starting reference frame (with the sum of all rotations and scales )?

Another way to ask the same question: how to have the running transformation matrix (not by printing it but by having it in the code)???

N.B. I had found a way to do it that works in Processing (by calculating transformations from near to near) but the same code does not work in P5js (I don’t know why and I have no error in the console!). That’s why I’m looking for another solution to this problem (which would work in Processing AND in P5js).

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [August 21, 2025, 2:10am UTC](https://discourse.processing.org/t/relative-and-global-coordinates/46992/2 "2025-08-21T02:10:02Z")

</div>

Hello @EricRogerGarcia,

Look these up in the references:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/4/9/49cc8103a90d52ec62674f1367cdb0e1e9935244.png)

`:)`

---

<div class="post-metadata">

### Author: ![EricRogerGarcia](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ericrogergarcia/32/21029_2.png) [@EricRogerGarcia](https://discourse.processing.org/u/EricRogerGarcia)
#### Post date: [August 21, 2025, 9:07am UTC](https://discourse.processing.org/t/relative-and-global-coordinates/46992/3 "2025-08-21T09:07:20Z")

</div>

Thank you very much, I had not seen these functions.  
I will look at that…

(I will ask the question again on the P5js category because these functions do not exist in the JS version).

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [August 24, 2025, 3:36pm UTC](https://discourse.processing.org/t/relative-and-global-coordinates/46992/4 "2025-08-24T15:36:58Z")

</div>

Hello @EricRogerGarcia,

See:

> [@Relatives and global positioning](https://discourse.processing.org/t/relatives-and-global-positioning/47006/5):
>
> Hello @EricRogerGarcia, I did some more digging: [Converting webgl 3d coordinates to 2d screen coordinates (p5.js) - Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/17715/converting-webgl-3d-coordinates-to-2d-screen-coordinates-p5-js.html)[Add screenX, screenY and screenZ · Issue #1553 · processing/p5.js · GitHub](https://github.com/processing/p5.js/issues/1553) That is just scratching the surface! There may be something in there that can help with p5.js! slight_smile

`:)`

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [September 8, 2025, 6:45pm UTC](https://discourse.processing.org/t/relative-and-global-coordinates/46992/5 "2025-09-08T18:45:42Z")

</div>

see also [screenX screenY equivalent in p5.js - #5 by bohnacker](https://discourse.processing.org/t/screenx-screeny-equivalent-in-p5-js/10581/5)
