This week's book giveaway is in the Servlets forum. We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line! See this thread for details.

Hi, I'm experimenting with polygonal meshes to make 3D objects.

I can draw two polygons (connected by an edge), each calling:

But there seems to be a slight gap between them, when the edge is not parallel/perpendidular to edge of screen, allowing the background to faintly show through.

So the endpoints of this line eg (20,20) and (50,70) will occur in both polygons.

I can partially fix this by adding 1 to the x-coordinate of the all the points on the right side of each polygon, to extend the polygon on the right side, to seal up the gap. This backfires once you rotate the polygons so that the right edge becomes the left edge, since here you would have to subtract 1, to fill the gap by extending the new left side intsead.

Is there any simpler way, like setting some property on the Graphics2D object, or something like that?