Function Point2dTo3d(pnts As Variant) As Variant Dim n As Integer Dim dots() As Double n = (UBound(pnts) + 1) / 2 If n > 0 Then ReDim dots(n * 3 - 1) As Double For i = 0 To n - 1 dots(i * 3) = pnts(i * 2) dots(i * 3 + 1) = pnts(i * 2 + 1) dots(i * 3 + 2) = 0 Next i End If Point2dTo3d = dots End Function
Sub tt() Dim pnts(3) As Double For i = 0 To 3 pnts(i) = i Next i
dots = Point2dTo3d(pnts)
For i = 0 To UBound(dots) Debug.Print dots(i) Next i End Sub
|