saga 发表于 2006-6-15 10:31:00

求判断点是否在多边形内的VBA程序?

<P>求判断点是否在多边形内的VBA程序</P>

peicong 发表于 2006-6-16 20:04:00

我也想知道,要是矩形就好办,多边形是有点麻烦

68651521 发表于 2006-6-17 18:41:00

<P>如果精度要求不高的话</P>
<P>试试在点处画一个半径很小的圆,做成面域求交集</P>

zyhalj 发表于 2006-6-21 21:26:00

<P>Function isClose()&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Dim n As Long<BR>&nbsp;&nbsp;&nbsp; n = ThisDrawing.ModelSpace.Count&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Dim pt As Variant<BR>&nbsp;&nbsp;&nbsp; pt = ThisDrawing.Utility.GetPoint(, "指定内部点: ")<BR>&nbsp;&nbsp;&nbsp; ThisDrawing.SendCommand "-Boundary" &amp; vbCr &amp; pt(0) &amp; "," &amp; pt(1) &amp; vbCr &amp; vbCr&nbsp; <BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; If ThisDrawing.ModelSpace.Count &gt; n Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; isClose = True<BR>&nbsp;&nbsp;&nbsp; Else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; isClose = False<BR>&nbsp;&nbsp;&nbsp; End If<BR>End Sub</P>

xinghesnak 发表于 2006-6-22 11:35:00

4楼的,你的代码不是很准确,假如点不在目标多边形内,而在一个不相干的闭合区域内,那么你的程序检测出来是TRUE,这显然是不对的,我比较同意3楼的办法,但希望能找到更好的办法.......斑竹或者其他高手赐教......
页: [1]
查看完整版本: 求判断点是否在多边形内的VBA程序?