You Are Here:

Community: Developer Discussion Boards

#1 Old implementation of trifiller method - 2004-01-27, 11:07

Join Date: Oct 2003
Posts: 15
Location: Switzerland
ysuter
Offline
Nowadays Interactive
has anyone already implemented a trifiller on the j2me platform? which algorithm would you sugest to use? scanline filling? recursive is not possible, as you might geht a stack overflow..
Reply With Quote

#2 Old 2004-01-29, 11:02

Join Date: Mar 2003
Posts: 118
Location: Rotterdam, Holland
remonvv
Offline
Regular Contributor
I dont see how you would use recursion for a trifiller anyway. I have java code that scans triangles. It' pretty straightforward, especially if you limit it to just triangles :

1) Sort vertices by y coord.
2) determine long edge (over y axis)
3) Use modified bresenham line algorithm to scan top short edge against long edge
4) Use modified bresenham line algorithm to scan bottom short edge against long edge
5) Store coords in array
6) Draw horizontal spans

Easy..
Reply With Quote

#3 Old 2004-01-29, 16:05

Join Date: Oct 2003
Posts: 15
Location: Switzerland
ysuter
Offline
Nowadays Interactive
yeah sure.. well, if you want to implement a substitute function for polyfill (not just a triangle) when you might think about recursive filling. =) But you're right that for simple triangles there is no need of resursion.
Reply With Quote

#4 Old 2004-01-29, 19:33

Join Date: Mar 2003
Posts: 118
Location: Rotterdam, Holland
remonvv
Offline
Regular Contributor
no you dont, recursion is not a viable approach for any graphical primitive. It's not a "flood fill" kinda thing. With more edges the only thing that gets more complicated is the edge sorting, if you want to support complex polies (self intersecting etc.) the span algorithm wil also complicate somewhat. However, you never use recursion for something such as this, for the simple reason that you'll get stack overflows or out of memory exceptions whenever you render a complicated scene, not to mention that it's horribly slow.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ