This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Polygonal Meshes

 
colin shuker
Ranch Hand
Posts: 750
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks for any help.
 
colin shuker
Ranch Hand
Posts: 750
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just did a little test

If I use:


Then the edges of polygons are smooth, but gaps exist.

Whereas:


Then the edges of polygons are jagged, but no gaps.

So far, I can have one but not the other, unless I start fiddling with adding/subracting 1, to bridge the gaps.

Is there anyway to achieve both?

Thanks again for any help.
 
Craig Wood
Ranch Hand
Posts: 1535
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometimes the stroke control hint seems to help when precision is important.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic