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.
IndexSuggestions & BugsSoftware Bugs › Java exceptions in text area with 2D drawin
Page Index Toggle Pages: 1
Java exceptions in text area with 2D drawin (Read 3330 times)
Java exceptions in text area with 2D drawin
Jan 16th, 2008, 10:01pm
 
When executing the following code:

//
// Drawing a conic section using the polar equation
//
void setup()
{
 size(1200, 800);
 background(255);  
 noLoop();
}

void draw()
{
 line(width / 2, 0, width / 2, height);
 line(0, height / 2, width, height / 2);
 translate(width / 2, height / 2);
 
 float p = 150;
 float e = 1.0;
 
 for (int i = 0; i < 10; i++)
 {
   conicSection(p, e, 5000);
   //directrix(p, e);
   e = e - 0.1;
 }
}
 
void conicSection(float p, float e, int numberOfPoints)
{
 float theta = 0;
 stroke(100);
 smooth();
 line(-width / 2, p, width / 2, p);
 line(-width / 2, -p, width / 2, -p);

 stroke(0);

 strokeWeight(2);
 for (int i = 0; i < numberOfPoints; i++)
 {    
   float r = p / (1 - e * cos(theta));
   float x = r * cos(theta);
   float y = r * sin(theta);
   point(x, y);
   theta = theta + TWO_PI / numberOfPoints;
 } // end for
} // end conicSection

void directrix(float p, float e)
{
 line(-p / e, -height / 2, -p / e, width / 2);
}

I get the following stack trace in the text area:

sun.dc.pr.PRException: endPath: bad path


at sun.dc.pr.Rasterizer.endPath(Unknown Source)


at sun.java2d.pipe.DuctusRenderer.createShapeRasterizer(Unknown Source)


at sun.java2d.pipe.DuctusShapeRenderer.renderPath(Unknown Source)


at sun.java2d.pipe.DuctusShapeRenderer.draw(Unknown Source)


at sun.java2d.SunGraphics2D.draw(Unknown Source)


at processing.core.PGraphicsJava2D.stroke_shape(PGraphicsJava2D.java:484)


at processing.core.PGraphicsJava2D.line(PGraphicsJava2D.java:518)


at processing.core.PGraphicsJava2D.point(PGraphicsJava2D.java:510)


at processing.core.PApplet.point(PApplet.java:7404)


at Temporary_6791_8151.conicSection(Temporary_6791_8151.java:44)


at Temporary_6791_8151.draw(Temporary_6791_8151.java:22)


at processing.core.PApplet.handleDisplay(PApplet.java:1465)


at processing.core.PGraphics.requestDisplay(PGraphics.java:690)


at processing.core.PApplet.run(PApplet.java:1562)


at java.lang.Thread.run(Unknown Source)
Re: Java exceptions in text area with 2D drawin
Reply #1 - May 6th, 2008, 2:38pm
 
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1113990788
http://dev.processing.org/bugs/show_bug.cgi?id=104
Page Index Toggle Pages: 1