Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Polypolygon limitation

Posted on 1998-06-15
5
Medium Priority
?
349 Views
Last Modified: 2010-04-10
My application frequently encounters very large and complex polygons with thousands of numparts and points that polypolygon can't handle.  Is there another (easy-I hope) way of filling very complex polygons with the same functionality as polypolygon?
0
Comment
Question by:ferdz
  • 3
  • 2
5 Comments
 

Author Comment

by:ferdz
ID: 1165925
Edited text of question
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165926
Can you simplify the polygon?  Thousands of points is going to be very taxing on the system.  No matter whethor you do it yourself or manage to get windows to do it for you.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165927
No response?  well one simplification algorithm is to goo through the list of points and try to remove points that don't significantly affect the shape of the polygon.  What you can do is take 3 sequential points.  Calculate the distance between the middle point and the line that connects the 2 outter points.  If the ratio between this distance and the length of the line between the two points is bellow a certain value (you decide what), you can delete the middle point.  Repeat this process for all the remaing points.
0
 

Author Comment

by:ferdz
ID: 1165928
Thanks!  What I did is quite simpler.  I just calculated the screen distance between points and if these poins lie on same pixel, I remove it from the list of points.  There is still one problem - If I zoom in, close enough, no points are eliminated, so polypolygon wont work again. The next thing to do now is to clip the polygons with the view window.  Do you know of a quick way to do that?
0
 
LVL 22

Accepted Solution

by:
nietod earned 200 total points
ID: 1165929
that's much simpler!.  And if it gets enought points, then its much superior.

If you mean clip it graphically, so it isn't draw outside of a rectangle, you can set a clipping region using SelectClipRgn() and it will draw only in the clipping region.  However, If you have too many points that doesn't help at all.  But you can take the same sort of approach to eliminating points.  go through the points and look for ones that are outside of the view rectangle.  You can eliminate points that are outside of the view rectangle if the two points around them are also outside of the view rectangle.  Does that help?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question