I am trying to achieve a Gilbert Tessellation as an exercise. The idea is simple, lines from random points extend both sides in random directions, until they intersect.
So, the intention is to create a loop that extends each line by a factor, and constantly checks for intersections. The catch is that there is a loop for each line… when the intersection is true for one line, that line stops extending while the others continue.
I am stuck… how can this simple algorithm be achieved?
This is my code so far.
import rhinoscriptsyntax as rs import ghpythonlib.components as gh while bool == False: bool = gh.CollisionManyXMany(curves) extended_curves = rs.ExtendCurveLength(curves, 0, 2, ext) if bool == True: break a = extended_curves
For some reason the error reads:
Runtime error (UnboundNameException): name ‘extended_curves’ is not defined
line 11, in script
Which is utterly useless, it tells me the variable “extended_curves” is not defined. It surely has to do with something regarding global and local variables, and the fact that the variable is being defined inside a loop… but how the f*** can I define extended_curves without extending them??
Oh I know: extended_curves = extended_curves. Pff easy.
I am about to destroy my pc. This cant be so hard. I already had a bad time dealing with GUIDs, GEOMETRY, and all that rhino crap.
GILBERT TRY.gh (10.1 KB)