Solved

Polypolygon limitation

Posted on 1998-06-15
5
344 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

624 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