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.
IndexProgramming Questions & HelpSyntax Questions › draw objects within shapes
Page Index Toggle Pages: 1
draw objects within shapes (Read 232 times)
draw objects within shapes
Feb 15th, 2009, 9:47pm
 
Hello all

If you have been reading my latest posts you know I am taking RSS feeds and using them in a visualization.

I am trying to draw objects in a particular shape/area.  Normally I could find a way by using the coordinates of a particular area but this time I am using a pretty complex shape.  I want to draw the objects on the land of a world map outline.  I can begin to think of ways to get processing to interpret a world map image and draw the objects based on that interpretation (for instance having a silhouette of the map and having it only draw on the black pixels).  But I dont know if there is an easier way or even how to do that exactly because I am a newbie.  Also eventually I would like to seperate where I want to draw the objects to different continents (which would be a flaw in my pixel plan).

Thanks for listening and helping.
Re: draw objects within shapes
Reply #1 - Feb 15th, 2009, 11:30pm
 
maybe you should check this out...
Could help you:

http://www.ricardmarxer.com/geomerative/
http://www.caligraft.com/

text on curves
http://www.processing.org/hacks/hacks:textoncurves
Re: draw objects within shapes
Reply #2 - Feb 16th, 2009, 3:27am
 
downloaded the library and its real cool stuff glad I have it.

I still cant find out how to draw within the shapes however.

Code:

grp.draw();
RPoint p = new RPoint(mouseX-width/2, mouseY-height/2);
for(int i=0;i<grp.countChildren();i++){
if(grp.children[i].contains(p)){
RG.ignoreStyles(true);
fill(0,100,255,250);
noStroke();
// what i want is --ellipse(random(area of shape),
// random(area of shape), 20,20)--
grp.children[i].draw();
RG.ignoreStyles(ignoringStyles);
}


i want to draw inside of each child, grp.children[i].draw, but I dont know how to get the sum of that area and draw an ellipse but i do not know how to get the area of shape
Re: draw objects within shapes
Reply #3 - Feb 16th, 2009, 6:12am
 
Im sorry, actually i never worked with this library. Maybe somebody who knows better will answer here or you can ask in the librarie section again
Page Index Toggle Pages: 1