Вопрос

У меня есть многоугольники, которые определяют контур округов в Великобритании.Эти формы очень подробны (от 10 к до 20 тыс. Каждая), что делает, таким образом, рендеринг соответствующих вычислений (является точкой x в многоугольниках P?) Довольно вычислительно дорого.

Таким образом, я хотел бы «подвымить» моими полигонами, чтобы получить аналогичную форму, но с меньшими точками.Каковы различные методы для этого?

Trivial можно было бы предпринять один каждый баллов ценных точек GenaCodicetacodcode (тем самым привыкнув коэффициентом генеракодицетагкода), но это чувствует себя слишком «грубой».Я предпочел бы сделать некоторое усреднение очков или что-то вроде этого вкуса.Любой указатель?

Это было полезно?

Решение

Two solutions spring to mind:

1) since the map of the UK is reasonably squarish, you could choose to render a bitmap with the counties. Assign each a specific colour, and then render the borders with a 1 or 2 pixel thick black line. This means you'll only have to perform the expensive interior/exterior calculation if a sample happens to lie on the border. The larger the bitmap, the less often this will happen.

2) simplify the county outlines. You can use a recursive Ramer–Douglas–Peucker algorithm to recursively simplify the boundaries. Just make sure you cache the results. You may also have to solve this not for entire county boundaries but for shared boundaries only, to ensure no gaps. This might be quite tricky.

Другие советы

Here you can find a project dealing exactly with your issues. Although it works primarily with an area "filled" by points, you can set it to work with a "perimeter" type definition as yours.

It uses a k-nearest neighbors approach for calculating the region.

Samples:

enter image description here

Here you can request a copy of the paper.

Seemingly they planned to offer an online service for requesting calculations, but I didn't test it, and probably it isn't running.

HTH!

Polygon triangulation should help here. You'll still have to check many polygons, but these are triangles now, so they are easier to check and you can use some optimizations to determine only a small subset of polygons to check for a given region or point.

As it seems you have all the algorithms you need for polygons, not only for triangles, you can also merge several triangles that are too small after triangulation or if triangle count gets too high.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top