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 & HelpPrograms › vertex Shape Generator
Page Index Toggle Pages: 1
vertex Shape Generator? (Read 2313 times)
vertex Shape Generator?
Jun 25th, 2008, 4:43pm
 
I was asking myself if there is a programm or anything like that to create the coordinates for a shape the way processing needs them. im thinking about a canvas where i can click together a shape and it outputs me something like this :

beginShape();
vertex(20, 20);
vertex(60, 60);
vertex(20, 60);
endShape(CLOSE);

or how do you create your shapes which are a bit more complex? I used to go to illustrator creat a small new file and look at the coordinates but as it gets more complex its a bit complicated
Re: vertex Shape Generator?
Reply #1 - Jun 25th, 2008, 5:39pm
 
It sounds as if you are looking for a pre-existing tool, but it struck me that you could also build what you're looking for using Processing.  I thought I had seen an example sketch that could capture clicks and draw shapes, but I must have been imagining it.  The closest I found is the example for MousePress, which would be a good place to start if you wanted to go that route.

You would want to use an array to capture the coordinates of each click so they could be written back out when the shape is complete.  Of course, the next thing you would probably want is a way to edit the vertices so they could be moved around to "tidy up" your initial clicks.  The Mouse Functions example could be reworked to allow you to move vertices around like the square.

Sounds like a fun project... maybe someone else here has already done it.
Re: vertex Shape Generator?
Reply #2 - Jun 25th, 2008, 6:02pm
 
Maybe that is what you were looking for :

http://transmote.com/lab/simplePoly/

i thought about doing it myself but like you said maybe somebody did it before...
Re: vertex Shape Generator?
Reply #3 - Jun 25th, 2008, 7:29pm
 
Great!  That's not the example I was thinking about (I might have just imagined it), but it looks even better for your purposes.  Perhaps it wouldn't be too hard to make it so you can move the points around and delete them if you want.
Re: vertex Shape Generator?
Reply #4 - Jun 26th, 2008, 8:57pm
 
Note that you can use Illustrator for this... Make a SVG file with your drawing, and use Candy to import it in Processing (something I haven't tried yet).
Re: vertex Shape Generator?
Reply #5 - Jun 27th, 2008, 4:11pm
 
But then you probably don't have the actual coordinates (or vectors) to use for e.g. collision detection and other stuff, right?
Re: vertex Shape Generator?
Reply #6 - Jun 28th, 2008, 2:30am
 
and some other cases where i would prefere a Shape cause i could transform it by moving different points and so on.
Re: vertex Shape Generator?
Reply #7 - Jun 28th, 2008, 11:18am
 
Well, the information, the coordinates of the path elements, are in clear in the SVG file... if you know enough SVG to interpret it. Not very hard, but tedious. I suppose one could write a parser to transform such path to vertices. Actually, it should be already right in the Candy source code! Wink
Re: vertex Shape Generator?
Reply #8 - Jul 29th, 2008, 9:09pm
 
this might not be exactly what you're looking for but, i've made a little tool for myself using scriptographer that will spit out shape coordinates in the scriptgrapher-console window.

you can download it here
http://www.thebarricades.de/kenfrederick/transfer/getPointsForProcessing_0_2.js

select the shape you want coordinates for and run the script "getPointsForProcessing 0.2"

it's buggy. and i'm sure it could be improved but it works well enough. the only problem seems to be that illustrator and processing render bezier curves differntly (ie. what looks nice and smooth in illustrator looks awkward in processing)

Ken
Page Index Toggle Pages: 1