• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Polygonal Meshes

 
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sometimes the stroke control hint seems to help when precision is important.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic