# Getting PShape vertex coordinates relative to scene

**URL:** <https://discourse.processing.org/t/getting-pshape-vertex-coordinates-relative-to-scene/31981>\
**Category:** Coding Questions\
**Created:** [August 28, 2021, 6:07am UTC](https://discourse.processing.org/t/getting-pshape-vertex-coordinates-relative-to-scene/31981 "2021-08-28T06:07:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dehyde](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dehyde/32/5153_2.png) [@dehyde](https://discourse.processing.org/u/dehyde)\
**Post date:** [August 28, 2021, 6:07am UTC](https://discourse.processing.org/t/getting-pshape-vertex-coordinates-relative-to-scene/31981/1 "2021-08-28T06:07:59Z")

</div>

Hi all 🙂

**The problem:**  
I’m trying to get set of 3 groups of 3 floats that the relationship between them is a representation of equilateral triangle in a limited space (each number 0.0-\>0.1).  
x1,y1,z1 x2,y2,z2, x3,y3,z3

I want those 3 numbers to be randomly generated within those compounds.  
That means the triangle can be any size or angle within the bounding box, but always equilateral.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/f829bb2d67ee304ae9b624b1893882fc14bd2df8.png)

**Code approach**  
I’m trying to create a PShape in 3d space and rotate it, and then get the new vertex locations. But when I’m using getVertex I keep getting the original vertex locations.

```auto
s = createShape();
  s.beginShape();
  s.rotateX(map(mouseY, 0, width, TWO_PI, 0));

  s.vertex(0, 0, 100);
  s.vertex(100,0, 0);
  s.vertex(0, 100, 0);
  s.endShape(CLOSE);
  
  for (int i = 0; i < s.getVertexCount(); i++) {
    PVector v = s.getVertex(i);
    System.out.println(v.x+" "+v.y);
  }

```

Here v.x and v.y stay the same after rotation, so I assume that getVertex is relative to PShape and not the scene.

Any idea on how I could get the vertex’s coordinates relative to the 3d space/scene?

---

<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:** [August 28, 2021, 12:07pm UTC](https://discourse.processing.org/t/getting-pshape-vertex-coordinates-relative-to-scene/31981/2 "2021-08-28T12:07:02Z")

</div>

> [@dehyde](#):
>
> `rotateX(map(mouseY, 0, width, TWO_PI, 0));`

when you use this without “s.” you can use modelX, modelY, modelZ to get those
