Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
bstown2
bstown2's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Rotation on vertex
[1 Reply]
23-Sep-2010 12:59 PM
Forum:
Programming Questions
So I'm trying to rotate each of the individual squares on its upper left corer, but when I implement the rotate the command it just rotates the entire row. Can anybody tell help? My professor and I were stumped.
Thanks
B.S.T.
void setup()
{
size (1000,600);
int X;
int Y;
int X_c,Y_c;
for(Y=0;Y<30;Y++)
{
for(X=0;X<30;X++)
{
X_c=X*100;
Y_c=Y*90;
if(Y%2==0)
{
if(X%2==1)
{
pushMatrix();
translate(X_c,Y_c);
rotate(radians(45));
stroke(0,0,255);
strokeWeight(2);
rect(X_c,Y_c,100,90);
rotate(radians(0));
popMatrix();
}
else
{
pushMatrix();
translate(X_c,Y_c);
rotate(radians(45));
stroke(255,0,0);
strokeWeight(2);
rect(X_c,Y_c,100,90);
rotate(radians(0));
popMatrix();
}
}
else
{
if(X%2==1)
{
pushMatrix();
translate(X_c,Y_c);
rotate(radians(45));
stroke(255,0,0);
strokeWeight(2);
rect(X_c,Y_c,100,90);
rotate(radians(0));
popMatrix();
}
else
{
pushMatrix();
translate(X_c,Y_c);
rotate(radians(45));
stroke(0,0,255);
strokeWeight(2);
rect(X_c,Y_c,100,90);
rotate(radians(0));
popMatrix();
}
}
}
}
}
«Prev
Next »
Moderate user : bstown2
Forum