# Rotating using math constants

**URL:** https://discourse.processing.org/t/rotating-using-math-constants/4367
**Category:** Coding Questions
**Created:** [October 11, 2018, 3:54pm UTC](https://discourse.processing.org/t/rotating-using-math-constants/4367 "2018-10-11T15:54:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![monnone](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@monnone](https://discourse.processing.org/u/monnone)
#### Post date: [October 11, 2018, 3:54pm UTC](https://discourse.processing.org/t/rotating-using-math-constants/4367/1 "2018-10-11T15:54:54Z")

</div>

So I’m trying to use the inbuilt constants QUARTER\_PI, HALF\_PI, and PI to make a single, non-animated rotation to render three separate boxes, but for whatever reason only QUARTER\_PI works; using any other constant results in the box not being rendered.

```auto
  push()

    box(boxSize);
 
  pop()

  push() 
    rotateX(QUARTER_PI);
    rotateZ(QUARTER_PI);
    box(boxSize);
  pop()

  push()
    rotateX(HALF_PI);
    rotateZ(HALF_PI);
    box(boxSize)
  pop()

```

In running this, the first two push/pop segments will render their boxes, but the third won’t. Is there a specific reason why QUARTER\_PI is acceptable but not HALF\_PI(or PI/TWO\_PI, which I also tried)? I’d rather avoid having to using their corresponding degree values because the rotation appeared to be way less “precise”, for lack of a better word.

EDIT: Nevermind, just realized that HALF\_PI is valid, but won’t result in visible change since I’m working with boxes.

---

<div class="post-metadata">

### Author: ![julian2](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/julian2/32/1551_2.png) [@julian2](https://discourse.processing.org/u/julian2)
#### Post date: [October 12, 2018, 9:29pm UTC](https://discourse.processing.org/t/rotating-using-math-constants/4367/2 "2018-10-12T21:29:17Z")

</div>

[https://editor.p5js.org/julian2/sketches/rJ4wZqRcQ](https://editor.p5js.org/julian2/sketches/rJ4wZqRcQ)

Hi!, so I think what the problem you see here is that you’re hitting one of the ‘rotational symmetries’ of the cube / box. a `HALF_PI` turn (a quarter rotation) would put the box in the same ‘apparent state’ as no rotation!

to try and demonstrate this, I’ve separated the three boxes with different offsets (from top to bottom), and I’ve tried to show a 1 second animation followed by a 2 second freeze (after the rotation has completed)
