Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Polypolygon limitation

Posted on 1998-06-15
5
Medium Priority
?
346 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 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

730 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