请教一个算法?求点坐标的
<P></P><P>已知一个图形,如上,在其内部有一个点,知道点的坐标,有没有什么办法,可以知道那个图形的五个定点的坐标,这个图形在AUTOCAD中是二维的。大家有没有什么好的算法或办法或源代码?谢谢了</P> <P><BR>Private Type MyType<BR> X As Double<BR> Y As Double<BR> Z As Double<BR>End Type</P>
<P>Sub main()<BR>Dim SelP(2) As Double '相当于内部的点<BR>Dim GetP() As MyType '返回的边界定点数组<BR>ReDim GetP(0)</P>
<P>SelP(0) = 250: SelP(1) = 150: SelP(2) = 0<BR>ThisDrawing.SendCommand "-boundary" & vbCr & SelP(0) & "," & SelP(1) & vbCr & vbCr<BR>Dim Obj As Object<BR>Set Obj = ThisDrawing.ModelSpace.Item(ThisDrawing.ModelSpace.Count - 1)</P>
<P>Dim i As Integer<BR>Dim Data As Variant<BR>Data = Obj.Coordinates<BR>For i = 0 To (UBound(Data) + 1) / 2 - 1<BR> If i <> 0 Then ReDim Preserve GetP(UBound(GetP) + 1)<BR> GetP(UBound(GetP)).X = Data(2 * i)<BR> GetP(UBound(GetP)).Y = Data(2 * i + 1)<BR> GetP(UBound(GetP)).Z = 0<BR>Next<BR>End Sub</P>
<P> </P>
页:
[1]