The Hive WIP #1




Vuzzle Chair, 2010
1000mm x 1000mm x 800mm, 59 cells. (46 cells for seating)
Vuzzle Chair consists of 59 cushions dividing the complete cube into voronoi cells. Each cushion has neodymium magnet underneath its surface to secure its cohesive status with adjacent cushions. Polysurface-shaped cushions with magent in each surface will provide enough bonding constraint to perform as chair with flexibility, yet removing individual cushions from the whole can be done with small force.
By removing 13 cushions, the cube turns into chair shape. Separated cushions can be used as individual cushion or stool or footrest for the chair.
Vuzzle Milk and Vuzzle Bloody Mary are relatively easier to reassemble from the scratch compared to Vuzzle neat


Rhino.LineLineIntersection and Rhino.IsVectorParallelTo methods are problematic..
I spent quite an amount of time trying to find out where my offset script fails,
and then I realized Rhino.LineLineIntersection is not working as expected in many cases.
for example, it doesn’t make intersection where there is obviously one. or
it determines two lines are parallel with very big tolerence. (I think 1 degree)
Then I tried to write my own method returning intersection point of
two lines myself.. but then I found that Rhino.IsVectorParallelTo is also not working
as expected for similar reason : no control of tolerence in determining if lines are parallel or not.
So I wrote that too, with Rhino.Angle2 . I guess these methods will be updated in next SR.
'-------------------------------------------------------------- ' returns true if Parallel '-------------------------------------------------------------- Function IsLineParallelTo(arrLine1, arrLine2, dblTolerence) Dim angle : angle = Rhino.Angle2 (arrLine1, arrLine2)(0) If angle < dblTolerence Then IsLineParallelTo = vbTrue Else IsLineParallelTo = vbFalse End If End Function
also, my own get2DLineLineInt method is written as following :
'-------------------------------------------------------------- ' returns arrPoint at intersection ' arrLine1 = Array((x1,y1),(x2,y2)) ' arrLine2 = Array((x3,y3),(x4,y4)) '-------------------------------------------------------------- Function get2DLineLineInt(arrLine1,arrLine2) Dim x1,y1,x2,y2 Dim x3,y3,x4,y4 Dim X,Y x1 = arrLine1(0)(0) y1 = arrLine1(0)(1) x2 = arrLine1(1)(0) y2 = arrLine1(1)(1) x3 = arrLine2(0)(0) y3 = arrLine2(0)(1) x4 = arrLine2(1)(0) y4 = arrLine2(1)(1) X = ((x1*y2-y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4))/((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4)) Y = ((x1*y2-y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4))/((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4)) get2DLineLineInt = Array(X,Y) End Function
now my script runs smooth without Rhino.LineLineIntersection !!
Dim arrLineA, arrLineB, arrPoint arrLineA = Array(Array(0,0,0), Array(3,0,0)) arrLineB = Array(Array(0,1,0), Array(3,0.99,0)) arrPoint = Rhino.LineLineIntersection(arrLineA, arrLineB) If IsArray(arrPoint) Then Rhino.AddPoint arrPoint Else Rhino.Print "no intersection" End If
‘this should add point at (300,0,0), but arrPoint is NULL (no intersection)
sometimes my script doesn’t work with certain input, then I try to debug my script
looking for anything I missed..
it takes longer too, as the script gets longer.
This time, it turned out ‘LineLineIntersection’ method was not working properly.
Option Explicit
Dim arrTestPt
Dim strPolyline
arrTestPt = Rhino.GetPoint ("pick a point")
strPolyline = Rhino.GetObject ("pick a closed polyline", 4)
If Rhino.IsCurveClosed (strPolyline) Then
If Rhino.IsPointOnCurve (strPolyline, arrTestPt) Then
Rhino.Print "the point you just picked lies on the polyline"
Else
arrPolylineVertices = Rhino.PolylineVertices (strPolyline)
If (IsPointInPolyLine(arrTestPt, arrPolylineVertices) = 1) Then
Rhino.Print "the point you just picked lies inside the polyline"
Else
Rhino.Print "the point you just picked lies outside the polyline"
End If
End If
End If
'-----------------------------------------------------------------------------------------
' polyX = array of X coordinates of polylinevertices
' polyY = array of Y coordinates of polylinevertices
' arrPt = Test Point
'-----------------------------------------------------------------------------------------
Function pnpoly(polyX,polyY,arrPt)
Dim npol :npol = UBound(polyX)
Dim i : i =0
Dim j : j = npol-1
Dim c : c = -1
Dim x : x = arrPt(0)
Dim y : y = arrPt(1)
Do While (i < npol)
If ((polyY(i)=y) OR (polyY(j)=y)) Then
If ((polyX(i)+(y-polyY(i))/(polyY(j)-polyY(i))*(polyX(j)-polyX(i)))
References
http://local.wasp.uwa.edu.au/~pbourke/geometry/insidepoly/
http://alienryderflex.com/polygon/

'--------------------------------------------------------------- 'take closed polyline and returns polyline of each offset step '--------------------------------------------------------------- Function OffsetCurveStructure(strCurve) Dim arrPolylineVertices arrPolylineVertices = Rhino.PolylineVertices(strCurve) Dim ActualVertNum ActualVertNum = UBound(arrPolylineVertices) Dim arrCenterPt 'set of offset polylines at each step Dim arrOffsetStepPolylines Redim arrOffsetStepPolylines(UBound(arrPolylineVertices)-3) 'distance between offset steps Dim arrOffsetStepDistance Redim arrOffsetStepDistance(UBound(arrPolylineVertices)-4) Dim arrCurrentPolylineVertices Redim arrCurrentPolylineVertices(UBound(arrPolylineVertices)) Dim arrCurrentLine1 Dim arrCurrentLine2 Dim currentVectorSet Redim currentVectorSet(UBound(arrPolylineVertices)-1) Dim arrFirstIntersectionIndex 'Check if strCurve is closed If NOT Rhino.IsCurveClosed(strCurve) Then OffsetCurveStructure = vbNull End If 'Check if strCurve is planar If NOT Rhino.IsCurvePlanar(strCurve) Then OffsetCurveStructure = vbNull End If Dim offsetDist Dim i,j,k Dim arrPrevPt, arrNextPt k = 0 Rhino.Print "ActualVertNum is " & ActualVertNum arrOffsetStepPolylines(0) = arrPolylineVertices Do While ActualVertNum >3 k = k+1 arrCenterPt = GenCenterPoint(arrPolylineVertices) currentVectorSet = getVectorSet(arrPolylineVertices) 'find which indices meet to make closest intersection arrFirstIntersectionIndex = getFirstIntersection(currentVectorSet)(1) offsetDist = getFirstIntersection(currentVectorSet)(0) 'store offset distance of current step arrOffsetStepDistance(k-1) = offsetDist Rhino.Print "Now working on offset step : " & k+1 & ". and offset distance is " & offsetDist For i = 0 to UBound(arrPolylineVertices)-1 arrPrevPt = getPrevPt(arrPolylineVertices,i) arrNextPt = getNextPt(arrPolylineVertices,i) arrCurrentLine1 = Array(arrPolylineVertices(i),arrPrevPt) arrCurrentLine2 = Array(arrPolylineVertices(i),arrNextPt) ' Offset 2 lines arrCurrentLine1 = OffsetSingleLine(arrCurrentLine1,offsetDist,arrCenterPt) arrCurrentLine2 = OffsetSingleLine(arrCurrentLine2,offsetDist,arrCenterPt) 'Rhino.Addline arrCurrentLine1(0),arrCurrentLine1(1) 'Rhino.Addline arrCurrentLine2(0),arrCurrentLine2(1) 'Get Intersection and store in current step of arrCurrentPolylineVertices arrCurrentPolylineVertices(i) = Rhino.LineLineIntersection (arrCurrentLine1, arrCurrentLine2) 'Rhino.AddPoint arrCurrentPolylineVertices(i) Next arrCurrentPolylineVertices(UBound(arrPolylineVertices)) = arrCurrentPolylineVertices(0) 'Uncomment this, you will see offset thresholds Rhino.AddPolyline(arrCurrentPolylineVertices) 'get the result polylive for current step arrOffsetStepPolylines(k) = arrCurrentPolylineVertices 'set it to arrPolylineVertices for next step arrPolylineVertices = arrCurrentPolylineVertices ActualVertNum = ActualVertNum-1 Loop ' returns arrPolylineVertices and offset distance of each offset step OffsetCurveStructure = Array(arrOffsetStepPolylines,arrOffsetStepDistance) End Function
Took one of my precious weekends to finish this function that returns array of polylines of
each offset thresholds. Default Rhino offset function does not return what I want, so
I had to build my own.

Happy Holidays

Just for fun.