# P3D - Sphere translation without deforming?

**URL:** <https://discourse.processing.org/t/p3d-sphere-translation-without-deforming/21349>\
**Category:** Coding Questions\
**Created:** [May 27, 2020, 5:09pm UTC](https://discourse.processing.org/t/p3d-sphere-translation-without-deforming/21349 "2020-05-27T17:09:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkk16](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@rkk16](https://discourse.processing.org/u/rkk16)\
**Post date:** [May 27, 2020, 5:09pm UTC](https://discourse.processing.org/t/p3d-sphere-translation-without-deforming/21349/1 "2020-05-27T17:09:55Z")

</div>

Hi! Thanks for all the help so far, this platform has been extremely supportive. I’m creating a 3D sphere but everytime i translate it, it also seems to rotate/deform, why is this the case? Is there an easy fix or do I need to recalculate the rotation amount every time to bring it back to the original shape when i translate?

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 27, 2020, 5:42pm UTC](https://discourse.processing.org/t/p3d-sphere-translation-without-deforming/21349/2 "2020-05-27T17:42:44Z")

</div>

It seems like perhaps you want an orthographic perspective using `ortho()` rather than the default `perspective()` –

[https://processing.org/reference/ortho\_.html](https://processing.org/reference/ortho_.html)

but it is hard to tell what you mean by “everytime i translate it, it also seems to rotate/deform” without more details and example code.

---

<div class="post-metadata">

**Author:** ![rkk16](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@rkk16](https://discourse.processing.org/u/rkk16)\
**Post date:** [May 27, 2020, 6:05pm UTC](https://discourse.processing.org/t/p3d-sphere-translation-without-deforming/21349/3 "2020-05-27T18:05:08Z")

</div>

Hi jeremy, this is what i mean:

```auto
void draw() {
  background(0);
  pushMatrix();
  translate(width/2, height/2);
  rotateX(0);
  rotateZ(0);

  shape.draw(getGraphics());

  popMatrix();
}

```

If I change the translation:

```auto
  translate(width/2+80, height/2-80);

```

The sphere/ellipse moves but also rotates, I want it to be exactly as it was.  
Original:  
 ![pic0](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/72203e6bf3ccf65223fa8153d4b0098f9b5cee20.png)  
After translation:  
 ![pic1](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/0156f2a6feb71c95730e06c2689da8966376968e.png)

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 27, 2020, 6:07pm UTC](https://discourse.processing.org/t/p3d-sphere-translation-without-deforming/21349/4 "2020-05-27T18:07:00Z")

</div>

> [@rkk16](#):
>
> `shape.draw(getGraphics());`

What are you doing here? Can you provide a working sketch that shows what this is, and why you are doing it? From your title and question text I assumed you were using `sphere()`.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 27, 2020, 6:08pm UTC](https://discourse.processing.org/t/p3d-sphere-translation-without-deforming/21349/5 "2020-05-27T18:08:57Z")

</div>

Try enabling and disabling `ortho()` in this example.

```auto
void setup() {
  size(400, 400, P3D);
  // ortho();
}
void draw() {
  background(0);
  pushMatrix();
  translate(width/2+80, height/2-80);
  rotateX(0);
  rotateZ(0);
  sphere(100);
  popMatrix();
}

```

---

<div class="post-metadata">

**Author:** ![rkk16](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@rkk16](https://discourse.processing.org/u/rkk16)\
**Post date:** [May 27, 2020, 6:54pm UTC](https://discourse.processing.org/t/p3d-sphere-translation-without-deforming/21349/6 "2020-05-27T18:54:56Z")

</div>

Thanks jeremy. Ortho worked like a charm. Appreciate it.
