Hi
I'm trying to rotate an image about its centre point.
~I have a physical marker and it is tracked with a webcam everytime my marker updates and rotates
My marker's angle is rotated everytime I physically rotate it.
However the images which are loaded are displayed in a circle around the marker but as the marker turns they do not rotate around their centre point
I only have them circling around the marker
Any ideas?
thanks
Code: void draw() {
stroke(0);
fill(0);
pushMatrix();
translate(xpos,ypos);
rotate(angle);
//rect(0,0,50,50);
PImage vinyl = loadImage("record.png");
image(vinyl, 0,0);
popMatrix();
fill(0);
frameRate(30);
PImage a,b,c,d,e,f; // Declare variable "a" of type PImage
int no;
//pushMatrix();
float anglealbums = radians(60);
radius = 150;
if (fiducial_id == 12)
{
xpos2 = xpos;
ypos2 = ypos;
//translate(xpos2,ypos2);
// rotate(anglealbums);
a = loadImage("beck.jpg"); // Load the images into the program
b = loadImage("toots.jpg");
c = loadImage("mouseonmars.jpg");
d = loadImage("bjork.jpg");
e = loadImage("ninasimone.jpg");
f = loadImage("tomvek.jpg");
image(a, (xpos+sin((anglealbums)+angle)*radius),ypos+cos((anglealbums)+angle)*radius);
albums[0].setPosition(int(xpos+sin(anglealbums+angle)*radius),int(ypos+cos(anglealbums+angle)*radius));
image(b, (xpos+sin((2*anglealbums)+angle)*radius), ypos+cos((2*anglealbums)+angle)*radius);
albums[1].setPosition(int(xpos+sin(2*anglealbums+angle)*radius),int(ypos+cos(2*anglealbums+angle)*radius));
image(c, (xpos+sin((3*anglealbums)+angle)*radius), ypos+cos((3*anglealbums)+angle)*radius);
albums[2].setPosition(int(xpos+sin(3*anglealbums+angle)*radius),int(ypos+cos(3*anglealbums+angle)*radius));
image(d, (xpos+sin((4*anglealbums)+angle)*radius), ypos+cos((4*anglealbums)+angle)*radius);
albums[3].setPosition(int(xpos+sin(4*anglealbums+angle)*radius),int(ypos+cos(4*anglealbums+angle)*radius));
image(e, (xpos+sin((5*anglealbums)+angle)*radius), ypos+cos((5*anglealbums)+angle)*radius);
albums[4].setPosition(int(xpos+sin(5*anglealbums+angle)*radius),int(ypos+cos(5*anglealbums+angle)*radius));
image(f, (xpos+sin((6*anglealbums)+angle)*radius), ypos+cos((6*anglealbums)+angle)*radius);
albums[5].setPosition(int(xpos+sin(6*anglealbums+angle)*radius),int(ypos+cos(6*anglealbums+angle)*radius));
}
else if (fiducial_id == 5)
{
xpos5 = xpos;
ypos5 = ypos;
a = loadImage("graham.jpg"); // Load the images into the program
b = loadImage("thebreeders.jpg");
c = loadImage("bobmarley.jpg");
d = loadImage("amontobin.jpg");
e = loadImage("mrscruff.jpg");
f = loadImage("djshadow.jpg");
image(a, xpos+sin(anglealbums+angle)*radius, ypos+cos(anglealbums+angle)*radius);
albums[6].setPosition(int(xpos+sin(anglealbums+angle)*radius),int(ypos+cos(anglealbums+angle)*radius));
image(b, xpos+sin((2*anglealbums)+angle)*radius, ypos+cos((2*anglealbums)+angle)*radius);
albums[7].setPosition(int(xpos+sin(2*anglealbums+angle)*radius),int(ypos+cos(2*anglealbums+angle)*radius));
image(c, xpos+sin((3*anglealbums)+angle)*radius, ypos+cos((3*anglealbums)+angle)*radius);
albums[8].setPosition(int(xpos+sin(3*anglealbums+angle)*radius),int(ypos+cos(3*anglealbums+angle)*radius));
image(d, xpos+sin((4*anglealbums)+angle)*radius, ypos+cos((4*anglealbums)+angle)*radius);
albums[9].setPosition(int(xpos+sin(4*anglealbums+angle)*radius),int(ypos+cos(4*anglealbums+angle)*radius));
image(e, xpos+sin((5*anglealbums)+angle)*radius, ypos+cos((5*anglealbums)+angle)*radius);
albums[10].setPosition(int(xpos+sin(5*anglealbums+angle)*radius),int(ypos+cos(5*anglealbums+angle)*radius));
image(f, xpos+sin((6*anglealbums)+angle)*radius, ypos+cos((6*anglealbums)+angle)*radius);
albums[11].setPosition(int(xpos+sin(6*anglealbums+angle)*radius),int(ypos+cos(6*anglealbums+angle)*radius));
}