(n)certainties – Die Angewandte – Fall 2008

181008_ CurveLayering_Ao

icon4

 

 

 

 

 

 

 

 

 

 

Option Explicit

Call Main()
Sub Main()

 Dim i, IntUpper : IntUpper = 500     ’numbers of steps
 
 Dim aPtCenter : aptcenter = array(0,0,0)
 Dim dblLength : dblLength = 42
 
 Dim n : n = 0
 Dim aCenterTemp
 Dim sCrv, sCrv2, svCrv, dsvCrv, dsCrv2
 Dim vCrv, dvCrv
 Dim sVec, dsVec
 Dim sVecSc, dsVecSc
 Dim aPtEnd(),daPtEnd
 Dim vPt
 Dim arrPlane
 Dim arrPointa()
 Dim arrCross()
 Dim m
 Dim f:f = 2            ’multi_Factor
 
 ’Rhino.EnableRedraw False
 
 
 
  For i = 0 To IntUpper
  ’*RN(1,1.1)
  ReDim Preserve arrPointa(i)
  
 
  arrPointa(i) = Array(0+5*Sin(i*RN(1,1.1))*f,_
   0+5*cos(i*RN(1,1.1))*f,_
   0+i)
 
  Call rhino.addpoint(arrPointa(i))
  
  aCenterTemp = array(aptcenter(0),aptcenter(1),arrPointa(i)(2))
 
  
  ’blue
  If i > 1 And i Mod 2 = 0 Then
   sCrv = rhino.AddCurve(array(arrPointa(i),aCenterTemp,arrPointa(i-2)))
   Call rhino.ObjectColor(sCrv, vbblue)
   Call Rhino.ExtendCurveLength (sCrv, 1, 0, dblLength/4)
 
  End If
 
  
  
  
  
  ’_________drop arc___________
  
  ’darkred     ___ex-centalazation
  If i Mod 2 = 1 Then
   ’unitize
   dvCrv = Rhino.VectorCreate (arrPointa(i),aCenterTemp)
    
   dsVec = Rhino.VectorUnitize (dvCrv)
   dsVecSc = Rhino.VectorScale (dsVec, RN(1, 2)*10*f)  ‘new lengthe ext _(0.25) 
   ’line
   dsvCrv = rhino.addline(aCenterTemp, dsVecSc)
   Call rhino.ObjectColor(dsvCrv, RGB(191,0,0))
   ReDim Preserve aPtEnd(n)
   aPtEnd(n) = rhino.CurveEndPoint(dsvCrv)
  
      
   ’darkgreen_arc
   If n > 0 Then
    dsCrv2 = rhino.AddInterpCurve(array(aPtEnd(n-1) , arrPointa(i-1),aPtEnd(n)))
    Call rhino.ObjectColor(dsCrv2, RGB(0,127,0))
    ’Call Rhino.ExtendCurveLength (dsCrv2, 2, 0, dblLength/1)
  
   End If
 
  End If
  
  ’_____________
  
   ’red     ___ex-centalazation
   If i Mod 2 = 1 Then
   ’unitize
   vCrv = Rhino.VectorCreate (arrPointa(i),aCenterTemp)
   ’vCrv = Rhino.VectorCreate (aCenterTemp, arrPointa(i))
   
   rhino.Print vCrv(2)
   sVec = Rhino.VectorUnitize (vCrv)
   sVecSc = Rhino.VectorScale (sVec, RN(1, 1.5)*10*f)  ‘new lengthe ext _(0.25)
   vPt = Rhino.VectorAdd (aCenterTemp, sVecSc)
   ’line
   svCrv = rhino.addline(aCenterTemp, vPt)
   Call rhino.ObjectColor(svCrv, vbRed)
   ReDim Preserve aPtEnd(n)
    aPtEnd(n) = rhino.CurveEndPoint(svCrv)  
    
    
   ’green
   If n > 0 Then
    sCrv2 = rhino.AddInterpCurve(array(aPtEnd(n-1) , arrPointa(i-1),aPtEnd(n) ))
    Call rhino.ObjectColor(sCrv2, vbGreen)
    Call Rhino.ExtendCurveLength (sCrv2, RN(1,2), 1, dblLength/2)
  
   End If
  
   n = n + 1
  
   End If
  
 Next
 ’Rhino.AddCurve (arrPointa)
 ’Rhino.AddPolyline (arrPointa)
 
 ’Rhino.EnableRedraw True
 
 
End Sub

 

 
Function RN(nMin, nMax)
 RN = Null
 Randomize
 RN = (nMax – nMin) * Rnd + nMin
End Function

Leave a Comment

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

You must be logged in to post a comment.