Option Explicit
' 3d Voronoi AKA Project Cell
' (c) Gabe Smedresman 2005
' All Rights Reserved.
''' global naming variables
Dim XX: XX = 0
Dim YY: YY = 1
Dim ZZ: ZZ = 2
GenerateVoronoiCells
Sub GenerateVoronoiCells()
Randomize
Dim arrBoundingVolume ' array of polysurfaces indicating bounding volume
Dim arrPoints ' array of string references to voronoi points
Dim i,j
Dim startTime : startTime = Now
' select objects
arrBoundingVolume = Rhino.GetObjects("Select a Bounding Volume",16+8,vbTrue,vbTrue)
If IsNull(arrBoundingVolume) Then Exit Sub
HideObjects arrBoundingVolume
arrPoints = Rhino.GetObjects("Select Cell Points",1,vbFalse,vbFalse)
ShowObjects arrBoundingVolume
If IsNull(arrPoints) Then Exit Sub
' go through each point in the list, and create a cell, name it, color it, And update the progress report.
Dim strCell, strName
Rhino.Print "Beginning cell divisions: " & UBound(arrPoints)+1 & " cells total."
For i = 0 To UBound(arrPoints) ' for each point to make a cell around ' one point at a time
strCell = GenerateCell(arrPoints(i),arrPoints,arrBoundingVolume)
Dim value : value = Int(Rnd()*255)
Rhino.objectColor strCell, RGB(255,255,value)
strName = "Cell #" & i
Rhino.objectname strCell, strName
Dim strTime : strTime = GetTimeDescription(startTime, (i+1) * 1.0 / (UBound(arrPoints)+1) )
Rhino.Print i+1 & " of " & UBound(arrPoints)+1 & " cells ("& Int((i+1) * 100 / (UBound(arrPoints)+1)) & "%) completed. " & strTime
Next 'i
' hide source geometry to reveal the cells
HideObjects arrPoints
HideObjects arrBoundingVolume
End Sub
'麻烦大虾帮忙解释下从Rhino.Print那里给我讲讲每行都是什么意思.比如UBound就是一个VB的方法名?&符号代表什么'
|
|
举报