Solved

Polypolygon limitation

Posted on 1998-06-15
5
306 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
Comment Utility
Edited text of question
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now