U toku ove nedalje studenti rade na Listu br. 3. Zadatak je da se na poslednjem projektu iz Elemenata projektovanja identifikuje povrs (pod, zid, plafon, pregrada i sl.) i obradi parametarski...
3D VIZ
List br. 3 - Povrs
u tekstu se nalazi pravilo po kojem se rotiraju delovi.
Option Explicit
'Script written by Dimitrie Stefanescu
'Script version 11 August 2008 16:47:28
Call Main()
Sub Main()
Randomize
Dim surf : surf = Rhino.GetObject (" Sel plane")
Dim detL : detL = Rhino.GetReal ("Detail level", 50)
'Dim attPt : attPt = Rhino.GetPoint ("Get att point")
Call Rhino.EnableRedraw (False)
Dim uDom , vDom , uStep , vStep
uDom = Rhino.SurfaceDomain (surf,0)
uStep = ( uDom (1)- uDom (0)) / detL
vDom = Rhino.SurfaceDomain (surf,1)
vStep = ( vDom (1)- vDom (0)) / detL
Dim i , j, pt
Dim arrPnts : arrPnts = Array()
Dim k,m : k = -1 : m = -1
Dim ptN , arrCrv : arrCrv = Array()
Dim range, distance
For i = uDom (0) To uDom (1) + uStep Step uStep
m = m + 1
ReDim Preserve arrCrv (m)
For j = vDom (0) To vDom (1) - vStep Step vStep
' Rhino.Print (j)
k = k + 1
pt = Rhino.EvaluateSurface ( surf,Array ( i,j ))
'distance = Rhino.distance (pt, attPt )
'range = distance * distance / ( distance /3)
range = 0.0001 + j
ptN = Array(pt(0) + RandomNumber (-range, range), pt(1) + RandomNumber (-range, range), pt(2) + RandomNumber (-range, range))
ReDim Preserve arrPnts (k)
arrPnts (k) = ptN
Next
k = -1
arrCrv (m) = Rhino.AddInterpCurve ( arrPnts )
Next
Call Rhino.AddLoftSrf ( arrCrv )
Call Rhino.EnableRedraw (True)
End Sub
Function RandomNumber ( nMin , nMax )
RandomNumber = Null
If Not IsNumeric ( nMin ) Then Exit Function
If Not IsNumeric ( nMax ) Then Exit Function
If nMin >= nMax Then Exit Function
Randomize
RandomNumber = (( nMax - nMin + 1) * Rnd + nMin ) / 50
End Function