'====================================================== ''simple 3d fractal '====================================================== function snowflake(pt1, pt2) ''base case '' if the distance is 1 unit long, then draw the line if(Rhino.Distance(pt1, pt2) <= 3)then call Rhino.addLine(pt1, pt2) else dim oneThird dim twoThird dim c ''find the one third point oneThird = Array(pt1(0)+(pt2(0)-pt1(0))/3, pt1(1)+(pt2(1)-pt1(1))/3, pt1(2)+(pt2(2)-pt1(2))/3) ''find the two thirds point twoThird = Array(pt1(0)+2*(pt2(0)-pt1(0))/3, pt1(1)+2*(pt2(1)-pt1(1))/3, pt1(2)+2*(pt2(2)-pt1(2))/3) ''find the c point ''make a temporary line on the middle third dim tempLine tempLine = Rhino.addLine(oneThird, twoThird) ''rotate the line 60 degrees ''the axis of rotation is parallel to the current x,y plane ''the axis is arbitrary; it can be changed call Rhino.RotateObject(tempLine, oneThird, 60.0, Array(oneThird, Array(oneThird(0)+1, oneThird(1), oneThird(2))),false) ''if you use the rhino4 beta you need to comment out the previous line and '' uncomment the following line: ''call Rhino.RotateObject(tempLine, oneThird, 60.0, Rhino.VectorCreate(oneThird, Array(oneThird(0)+1, oneThird(1), oneThird(2))),false) 'the endpoint of the rotated curve is the point we want to save c = Rhino.CurveEndPoint(tempLine) 'the line no longer needed so delete it call Rhino.deleteObject(tempLine) 'recursively call snowflake on each of the 4 sections call snowflake(pt1,oneThird) call snowflake(oneThird,c) call snowflake(c,twoThird) call snowflake(twoThird, pt2) end if end function ''call our function with two test values call snowflake(Array(0,0,0), Array(15,30,20))