Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Convex Polygon Drawing / EOR Filling
2010-10-23 14:28
munkey
Account closed

Registered: Aug 2009
Posts: 12
Convex Polygon Drawing / EOR Filling

Hey everybody. Just a heads up this is my first post on this forum so hopefully I haven't tripped over any "etiquette" faux-pas.

I'm madly trying to get a demo finished in the next few weeks for Syntax 2010. I've written a reasonable EOR filler, but just nutting out the line-drawing side. I don't have an issue with line-drawing per-se, however I'm having trouble drawing convex polygons in such a way so as to allow the EOR filler to correctly fill them.

Initially, I've been treating each edge in isolation and EOR-drawing it to the bitplane. This doesn't seem to work (filler-wise) for all polygon cases so I've had to rethink my approach.

I've been doing lots of web-searches on the topic but haven't come across anything concrete. I'm guessing I need to treat all convex polygons in isolation when drawing them.

My current implementation "theory" involves 3-vertex polygons, wherein if a vertex does not share a y-coordinate with any other vertex in the polyon, then that vertex must not be drawn (obviously the edge connecting it to other vertices will require drawing). The reasoning behind this is that if a single pixel sits atop a triangle, it will cause the filler to draw a line past it.

I'll try to draw an ASCII diagram and hope to hell the formatting isn't screwed up ;)


V0
|\
|.\
|..\
|../V1
|./
|/
V3

So if verticies V0 and V3 are drawn to the bitmap, the EOR filler will proceed to draw a horizontal line starting at (V0x,V0y) and ending at (screen_width-1, V0y) -- and respectively for V3.

In my postulated implementation:

1. EOR-draw all lines/edges in clockwise order (being sure not to draw the last point of each edge)
2. sort triangle verticies in y
3. if top-most vertex does not share its y position with another vertex then EOR that point (erase it from bitmap)
4. if bottom-most vertex does not share its y position with another vertext then EOR that point (erase it from bitmap)

I haven't tested this out yet so not sure if it will completely work (all triangle cases). I don't like it very much because it's quite messy.

Am I even on the right track with this? Any assistance would be appreciated.
 
... 10 posts hidden. Click here to view all posts....
 
2010-10-24 10:08
munkey
Account closed

Registered: Aug 2009
Posts: 12
Quoting Oswald
it doesnt matter in what order you draw the edges, and yes it would help if you could tell what exactly is the problem.


There is no problem now that I properly understand the implementation that you suggested eariler :)

The problem was that of semantics in terms of the plotting order of verticies, and the fact that I was working with a left-right filler.
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Grue/Extend
Da Snake
BYB/Hokuto Force
Rick/F4CG
Paul Bearer
rexbeng
WVL/Xenon
psych
Peacemaker/CENSOR/Hi..
Guests online: 125
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Logo Graphicians
1 t0m3000  (10)
2 Sander  (9.8)
3 Mermaid  (9.5)
4 Facet  (9.4)
5 Shine  (9.4)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.036 sec.