FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 1178 : PShape rotate() function in CENTER mode acting weird...
Last modified: 2009-02-24 17:16
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
RESOLVED
Resolution:
INVALID -
Pr
i
ority:
P2
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
sonomute
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2009-02-24 17:11
I'm on OS X, only couple of days in Processing, but checked it carefully...
These two functions, rotate(), and (CENTER) supposed to work same way for rectangle and
PShape for example, right? Well, in basic transformation examples there is one rotating
rectangle around it's center(spinning). If i'm trying to do the same thing same way with svg
shape, changing mode to center changing it only for drawing, but when i'm trying to rotate it,
it still rotating it around left top point.
This is simple code:
PShape bot;
void setup()
{
size(500,500);
smooth();
frameRate(30);
bot = loadShape("pum.svg");
}
void draw()
{
background(200);
shape(bot, width/2, height/2);
bot.rotate(radians(1));
shapeMode(CENTER);
}
Thank you.
Additional Comment
#1 From fry 2009-02-24 17:16
no, your code is incorrect. bot.rotate() will affect the rotation matrix of
the shape itself, while shapeMode() is acting on the graphics context (not
the shape). your code should be:
float r;
void draw() {
background(200);
shapeMode(CENTER);
rotate(r);
shape(bot, width/2, height/2);
r += radians(1);
}