CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Apr 2014
    Posts
    1

    Quadrangulation of orthogonal polygons

    Hello there! I am new to this forum, but I hope to receive some basic idea for my problem:

    I'm right at the start of a new project, so this question is quite conceptional, but will be realized in C#. Basically, I have a two-dimensional array of boolean values representing an area of cells:
    Name:  ex01.PNG
Views: 1330
Size:  1.8 KB
    The green ones (=true) represent my "polygons". My aim is to find an algorithm, which finds the minimum amount of rectangles within the green areas and their coordinates.

    My thought was to find the center of the whole area or the nearest point to it which is "free" (=green/true), cycle around that spot to find the nearest border and expand from there to the other borders:
    Name:  cycle.PNG
Views: 1225
Size:  8.2 KB The blue spot marks my center and he yellow one is the nearest border. From there I expand in the second step to have my rectangle in the last step.

    The problem is, this algorithm isn't very clever. In more complex situations than this simple example it often produces a huge amount of unnecessary rectangles.
    So, I was thinking of a whole new algorithm, but any idea failed at some point when going through more complex shapes and I don't want to apply complex triangulation solutions to my quite simple case.

    Does anyone of you have a basic idea to start with? Again, this is just conceptional at the moment, so, I don't have any code yet. Neither do I expect a perfect solution to my problem. I just want to get some inspiration and hear your ideas to the problem.
    Thanks in advance!
    Attached Images Attached Images  

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured