algorithmic modeling for Rhino
Hello Guys,
I'm doing a definition for an light/art-object in a very tall atrium. The basic Idea is to have a bunch of ceramic pipes rotated randomly from which a couple of them will become light tubes. I'm using the genoform plug-in to evaluate different proposals of random rotations.
The problem is that I know some of tubes are intersecting each other, this can not happen in a physical situation. So I'll like to create a test that excludes (Boolean operation) those tubes that intersects.
Any Idea
Cheers
Tags:
Try something like this:
Private Sub RunScript(ByVal c As List(Of Curve), ByVal r As Double, ByRef A As Object)
Dim intersect As Boolean = True
While intersect
intersect = False
For i As Integer = 0 To c.Count - 2
For j As Integer =i + 1 To c.count - 1
Dim pta, ptb As point3d
c(i).ClosestPoints(c(j), pta, ptb)
Dim dist As Double = pta.DistanceTo(ptb)
If dist / 2 < r Then
intersect = True
c.RemoveAt(i)
Continue While
End If
Next
Next
End While
a = c
End Sub
Create a vb component, name an input 'c' and set it as list of curves, name another input r and set it as double. Input a list of lines that represent the axis of the pipes into 'c' and input a number value to 'r' that is the radius of the pipes. The code checks for each line if it intersects with any other line (it checks if half of the closest distance between the two lines is smaller than r). If it does, it deletes the line from the list and starts again.
The output would be a smaller list of lines that don't intersect each other.
Right click on the 'c' input and set it as 'list'.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by