We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
rotated mask (Read 546 times)
rotated mask
Dec 19th, 2005, 8:39pm
 
Hi guys, which method do you suggest me to apply to a PImage as mask a rotated PImage? If it's not clear, you can check this picture: http://nuthinking.com/p5/rotated_mask.gif
where 2 could be eventually be the 1 rotated and 3 is the result when one is applied to the other after being rotated.

Do you suggest to use PGraphic? also because I don't see any other way.

Thanks a lot, chr
Re: rotated mask
Reply #1 - Dec 20th, 2005, 8:46am
 
If you want to do this kind of things you might try out my library:

http://www.tecn.upf.es/master/mad04/~rmarxer/processing/geomerative/documentation/index.htm

Quite ALPHA yet, but it helps to have people's feedback.

So the way to do it with my library would be:

Code:

import geomerative.*;

RPolygon p, protated, pintersection;
RMatrix m;

int SMALLRAD = 10;
int LARGERAD = 100;

void setup(){
size(300,300);
background(0);
framerate(24);

p = new RPolygon();

p.addPoint(-SMALLRAD,-LARGERAD);
p.addPoint(SMALLRAD,-LARGERAD);
p.addPoint(SMALLRAD,-SMALLRAD);
p.addPoint(LARGERAD,-SMALLRAD);
p.addPoint(LARGERAD,SMALLRAD);
p.addPoint(SMALLRAD,SMALLRAD);
p.addPoint(SMALLRAD,LARGERAD);
p.addPoint(-SMALLRAD,LARGERAD);
p.addPoint(-SMALLRAD,SMALLRAD);
p.addPoint(-LARGERAD,SMALLRAD);
p.addPoint(-LARGERAD,-SMALLRAD);
p.addPoint(-SMALLRAD,-SMALLRAD);

protated = new RPolygon(p);

m = new RMatrix();
m.rotate(PI/120);
}

void draw(){
background(0);
translate(width/2,height/2);
stroke(255);
fill(255);

protated.transform(m);
pintersection = p.intersection(protated);
pintersection.draw(g);
}


Hope it helps!
For any questions or suggestions on the library just contact me.
Re: rotated mask
Reply #2 - Dec 20th, 2005, 9:40am
 
Thanks Richard, but how could I do it using bitmaps?

cheers, chr
Re: rotated mask
Reply #3 - Dec 20th, 2005, 4:06pm
 
Toxi today helped me realizing it using PGraphic3. Here is the result:

http://nuthinking.com/p5/masked_flake/

Now I've to test its performances with many instances but it seems a good starting point Smiley

Thanks to everyone, chr
Re: rotated mask
Reply #4 - Dec 20th, 2005, 5:17pm
 
Very nice!!

Sorry I couldn't help.  I didn't understand you were trying to use bitmaps as masks.

The results are quite impressive, thinking on how simple the concept is.
Page Index Toggle Pages: 1