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 › I need some help
Page Index Toggle Pages: 1
I need some help (Read 575 times)
I need some help
Mar 14th, 2008, 2:49pm
 
I am a student at Wayne City High School. I am  working on a 4th quarter project and I have hit a snag. I am trying to draw Stewie Griffin from the show Family Guy but I am having a hard time with things if somebody can help please do.
Re: I need some help
Reply #1 - Mar 15th, 2008, 12:06am
 
By "draw" do you mean, generate the image by writing a program to draw all of the lines for you?  Or do you want to create a simple drawing program that lets you draw with the mouse?
Re: I need some help
Reply #2 - Mar 18th, 2008, 2:28pm
 
As in Draw i am trying to come up with a code that when complete and runs perfectly should look like Stewie Griffin
Re: I need some help
Reply #3 - Mar 18th, 2008, 4:02pm
 
First off, you should get yourself an image of Stewie to work from. Most likely you already have one. Break up the drawing into single elements, straight lines and curves. Check out this video for inspiration.

Measure out the coordinates of where the single parts start and end.

From here on beziers and curves are your friend. Learn how to use them well.

In your code, draw the single elements one after another, or where possible as a continuous shape. Check beginshape(),  endShape() and vertexes for more on that.

This is tedious work, but it should be possible. Processing isn't really cut out to draw figures. Fortunately, Stewie is (relatively) simple.

For extra points, you can turn your Stewie creating lines of code into a function, and use relative values instead of absolute ones, so you can draw variably scaled Stewies from the same code.


Re: I need some help
Reply #4 - Mar 25th, 2008, 2:29pm
 
I am a Little new at using processing so i might need a little more help.
Re: I need some help
Reply #5 - Mar 25th, 2008, 2:35pm
 
It would be helpful, if you could describe exactly where you're having problems.

You also can post the code you've been working with. Oftentimes someone will look at it and find the mistake or give you tips for optimizing it.
Re: I need some help
Reply #6 - Mar 25th, 2008, 2:48pm
 
well i was working on the body using beginShape(LINES) and the lines are too high
Re: I need some help
Reply #7 - Mar 31st, 2008, 3:19pm
 
heere is what i have so far

//Stewie Griffin
float ellipse;
float box;
float x,y;

void setup() {
 size(400,400,P3D);
 stroke(255);
}

void draw() {
 background(0, 0, 255);
 beginShape(LINES);
 vertex(80, 175);
 vertex(80, 300);
 vertex(80, 175);
 vertex(80, 300);
 stroke(156, 10, 0);
 endShape();
 beginShape(LINES);
  vertex(81, 175);
 vertex(81, 300);
 vertex(81, 175);
 vertex(81, 300);
 endShape();
 beginShape(LINES);
  vertex(82, 175);
 vertex(82, 300);
 vertex(82, 175);
 vertex(82, 300);
 endShape();
 beginShape(LINES);
 vertex(83, 175);
 vertex(83, 300);
 vertex(83, 175);
 vertex(83, 300);
 endShape();
 beginShape(LINES);
 vertex(84, 175);
 vertex(84, 300);
 vertex(84, 175);
 vertex(84, 300);
 endShape();
 beginShape(LINES);
 vertex(85, 175);
 vertex(85, 300);
 vertex(85, 175);
 vertex(85, 300);
 endShape();
 beginShape(LINES);
 vertex(86, 175);
 vertex(86, 300);
 vertex(86, 175);
 vertex(86, 300);
 endShape();
 beginShape(LINES);
 vertex(87, 175);
 vertex(87, 300);
 vertex(87, 175);
 vertex(87, 300);
 endShape();
 beginShape(LINES);
 vertex(88, 175);
 vertex(88, 300);
 vertex(88, 175);
 vertex(88, 300);
 endShape();  
 beginShape(LINES);
 vertex(89, 260);
 vertex(89, 200);
 vertex(89, 260);
 vertex(89, 200);
 endShape();
 beginShape(LINES);
 vertex(90, 175);
 vertex(90, 300);
 vertex(90, 175);
 vertex(90, 300);
 stroke(200, 156, 0);
 endShape();
 
}
Re: I need some help
Reply #8 - Mar 31st, 2008, 7:30pm
 
I fear you have a misunderstanding on how vertices work. You really should get to know more on how Processing handles the coordinate system. After you're confident with using x- and y-coordinates, you'll be able to tackle shape drawing with lines and curves.
(I'm really sorry if I underrate your knowledge on this).

In your code, you aren't changing the x-coordinate for the different lines, therefore they're all drawn on top of each other. Here's how you would draw a square:

Code:

beginShape();
 vertex(20, 20);  // top left
 vertex(180, 20);  // top right
 vertex(180, 180);  // bottom right
 vertex(20, 180);  // bottom left
 endShape(CLOSE);  // CLOSE draws a closing line between the last and first vertex to complete the shape


There IS another approach to your Stewie-drawing-problem. You can create a vector illustration, save it as a svg-file, and import it to Processing using the Candy-library. You can check out the example sketches which come with Processing for more on that. If you have access to Illustrator or a similar program this is a much more efficient way than trying to do this directly in Processing.

Re: I need some help
Reply #9 - Apr 2nd, 2008, 3:15pm
 
I got the body together i need help with the hands and head of stewie griffin
Page Index Toggle Pages: 1