# Why do radian degrees look different for arcs versus rotations?

Hello Forum,

I have math confusion. Radian degrees seem to work differently for rotate() versus arc(). Below, I use the first image as a guide for rotating a rect() and the second image as guide for controlling the opening and closing part of the arc. Why aren’t they the same - what don’t I get in my code?

Radian degrees diagram for rotate:

Radian degrees diagram for arc:

``````void setup (){
size (400,400);
}

void draw() {
background (255);

//Rect
pushMatrix ();
translate (100,100);
fill (0);
rect (0,0,25,150);
popMatrix();

//ARC
} //close draw
``````
1 Like

Hello,

You can always plot the first graph to have the zero reference anywhere you want; its just a label.

Does this help?

``````void setup ()
{
size (200, 200);
}

void draw()
{
background (255);

//line before rotate
pushMatrix ();
translate (width/3, height/2);
line (0, 0, 50, 0);
popMatrix();

//line after rotate
pushMatrix ();
translate (width/3, height/2);
line (0, 0, 50, 0);
popMatrix();

//Arc
arc(2*width/3, height/2, 100, 100, radians(0), radians(90), PIE);
}
``````

Hello glv,

So, you are saying that the reason I am getting confused is because a rectangle behaves differently?

Hello,

A line is easier to visualize and you know exactly where the x and y are.

I always have to fiddle with width and height with a rectangle to get it right.

Same thing with rectangle:

``````void setup ()
{
size (200, 200);
}

void draw()
{
background (255);
strokeWeight(3);

//line before rotate
pushMatrix ();
translate (width/3, height/2);
rect(0, 0, 50, 5);
//line (0, 0, 50, 0);
popMatrix();

//line after rotate
pushMatrix ();
translate (width/3, height/2);
rect(0, 0, 50, 5);
//line (0, 0, 5, 50);
popMatrix();

//Arc
arc(2*width/3, height/2, 100, 100, radians(0), radians(90), PIE);
}
``````

`:)`

1 Like

Yes definitely makes things clearer to visualize. Thank you! I wish I could break the curse of my visual confusion with the rectangle

``````void setup (){
size (400,400);
}

void draw() {

background (255);

//Rect
pushMatrix ();
translate (100,100);
fill (0);
rect (0,0,25,150);
popMatrix();

//Rect
pushMatrix ();
translate (100,100);
fill (0);
rect (0,0,25,150);
popMatrix();

//ARC

} //close draw
``````

It took me a couple of edits… I may be cursed as well.

`:)`

I see now, horizontally longer for a rect fits nice and tidy with radian degrees in second guide!

2 Likes

The problem is in the very first diagram. It shows 0° being NORTH which is fine when doing geometry in mathematics but on computers 0° it is EAST so it should look like

Think 0° == EAST == poisitve X direction and you can’t go far wrong

4 Likes

Hello,

There is further discussion here for visitors to this topic:
https://processing.org/tutorials/transform2d/
https://processing.org/tutorials/trig/

From above:

`:) `

3 Likes

This sketch helped me untangle the troubles I was having with seeing the rectangle radian degrees:

``````void setup (){
size (400,400);
}

void draw() {

background (255);
//black
stroke(0);
fill (0);
rect (50,50,25,150);
line (100,50,300,50);
float a = mouseX;

//Red
pushMatrix ();
translate (100,100);