Results 1 to 4 of 4
  1. #1
    theraccoon is offline Member
    Join Date
    May 2011
    Posts
    2
    Rep Power
    0

    Default Algorithm for filling random polygons

    Hello, I would like an algorithm that fills random polygons, I searched over the internet, but I couldn't find one. :( Could anyone please help me? I have more to do next. Thank you in advance.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    6

    Default

    What have you tried? Just because you can't find one doesn't mean you can't write one...break the problem down, give it a try, and if you have problems post the code with full error messages or description(s) of what it does and what you want it to do. Lastly, if you haven't yet, see
    Trail: 2D Graphics (The Java™ Tutorials)

  3. #3
    theraccoon is offline Member
    Join Date
    May 2011
    Posts
    2
    Rep Power
    0

    Default

    Hi, I have read this trail a little bit, but it's very difficult and non-analytical. It could not help me at all. So, I am not able to write down a code myself, because I am a newbie in java graphics and I know java only a little as far as I can remember from my latest exams.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,589
    Rep Power
    23

    Default

    One brute force way would be to put a rectangle around the polygon, then starting at the left end of the top row of pixels If the point is in the polygon. move by one pixel to the right. Continue to the end of the row and then go to the next row. Continue until all the rows have been looked at.

Similar Threads

  1. Random Number Algorithm
    By javauserjava in forum New To Java
    Replies: 5
    Last Post: 04-06-2011, 12:32 AM
  2. Create an array of polygons
    By jtech55 in forum Java 2D
    Replies: 0
    Last Post: 03-18-2011, 07:49 PM
  3. Polygons... returning and passing objects?
    By asherwolf in forum New To Java
    Replies: 3
    Last Post: 07-09-2010, 04:41 PM
  4. Replies: 0
    Last Post: 07-02-2008, 07:50 PM
  5. Demonstration of drawing polygons
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 06-28-2008, 09:24 PM

Posting Permissions

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