Solved

Polypolygon limitation

Posted on 1998-06-15
5
340 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 100 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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Unable to start eclipse ? 17 163
c++, dynamic object by json 1 60
Finding Divisors 5 40
keep track of class structure 1 21
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

726 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