Javascript:获取多边形轮廓/删除内部线条

时间:2017-06-14 09:27:50

标签: javascript math border polygon contour

我有一个多边形,我想得到它的轮廓,它看起来像这样:

<polygon fill="transparent" points=" -60.48565220947266,46.13742103271485, 56.557547790527344,46.13742103271485, 56.557547790527344,-5.06897780456543, -60.48565220947266,-5.06897780456543, 37.050350115966786,-9.94577780456543, -85.80719033203123,-9.94577780456543, -85.80719033203123,46.13742103271485, 56.34799779052733,46.13742103271485, 56.34799779052733,19.315022195434572, 37.050350115966786,19.315022195434572, -74.9509506591797,-5.06897780456543, -74.9509506591797,46.13742103271485, 56.347997790527344,46.13742103271485, 56.347997790527344,19.315022195434572, 37.0503501159668,19.315022195434572, 37.0503501159668,-9.94577780456543, -30.333590332031253,-9.94577780456543, -30.333590332031253,-5.06897780456543, 37.0503501159668,-5.06897780456543" style="stroke: black; stroke-width: 1px;" stroke-dasharray="5, 5" id="#contour"></polygon>

<svg>
<g transform="translate(100,100)">
<polygon fill="transparent" points=" -60.48565220947266,46.13742103271485, 56.557547790527344,46.13742103271485, 56.557547790527344,-5.06897780456543, -60.48565220947266,-5.06897780456543, 37.050350115966786,-9.94577780456543, -85.80719033203123,-9.94577780456543, -85.80719033203123,46.13742103271485, 56.34799779052733,46.13742103271485, 56.34799779052733,19.315022195434572, 37.050350115966786,19.315022195434572, -74.9509506591797,-5.06897780456543, -74.9509506591797,46.13742103271485, 56.347997790527344,46.13742103271485, 56.347997790527344,19.315022195434572, 37.0503501159668,19.315022195434572, 37.0503501159668,-9.94577780456543, -30.333590332031253,-9.94577780456543, -30.333590332031253,-5.06897780456543, 37.0503501159668,-5.06897780456543" style="stroke: black; stroke-width: 1px;" stroke-dasharray="5, 5" id="#contour"></polygon>
</g>
</svg>

enter image description here

我想删除多边形内部的所有内容,只保留边框,我的数学技能很低,而且我无法使其工作。 我怎么能做到这一点?

0 个答案:

没有答案