如何将多边形延伸到一定距离? [英] How to extend the polygon to a certain distance?

查看:118
本文介绍了如何将多边形延伸到一定距离?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将多边形延伸到一定距离? 我围绕多点创建一个凸包.但是我需要将范围扩大到几公里.至少在理论上.

How to extend the polygon to a certain distance? I create a convex hull around the multipoint. But I need to extend the range to several kilometers. At least in theory.

http://img.radiokot.ru/files/21274/1oykzc5pez.png

推荐答案

在每个顶点中构建外部平分向量(作为两个相邻边的归一化法线nanb的总和)并将其归一化

Build outer bisector vector in every vertex (as sum of normalized normals na and nb of two neighbor edges) and normalize it

bis = na + nb
bis = bis / Length(bis)

设置等分线的长度以提供所需的距离

Make length of bisector to provide needed distance as

 l = d / Cos(fi/2)

其中d是偏移量,fi是向量nanb之间的角度.

where d is offset, and fi is angle between vectors na and nb.

 fi = atan2(crossproduct(na,nb), dotproduct(na,nb))

或没有三角函数:

l = d / Sqrt(1 + dotproduct(na,nb))

并找到偏移多边形的顶点:

And find offset polygon vertex:

 P' = P + l * bis

这篇关于如何将多边形延伸到一定距离?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆