algorithmic modeling for Rhino
Hello,
I have a script that calculates intersection lines between polygons.
As soon as, everything is static it goes perfect. But I am using gHowl to connect it with processing. The speed is very fast between those two applications. But as soon as every frame is re-calculated I noticed that intersection function is very slow. It is actually so slow, that maximum number of polygons to play with is only 10 or less.
Could you help me to find a faster solution for my script?
calculation of intersection lines;
//////////////////////////////////////////////////////////////////////////////////////////
import ghpythonlib.components as ghcomp
import rhinoscriptsyntax as rs
def ctr(crv):
pts = ghcomp.Explode(crv)[1]
pts = ghcomp.CullDuplicates(pts,0.001)[0]
return ghcomp.Average(pts)
pts = []
lines = []
ctr_c1 = ctr(C1)
for crv in C2:
if ctr(crv) != ctr_c1:
int = ghcomp.CurveXCurve(C1, crv)[0]
if int:
[pts.append(x) for x in int]
lines.append(rs.AddLine(int[0],int[1]))
/////////////////////////////////////////////////////////////////////////////////////////////
The overall description of the script:
a)Processing+ghowl is used for moving objects and physics
b)python script (slowest part) calculates intersection lines
c)intersected parts of polygons are rotated in 90 degrees.
I have attached grasshopper and processing files. (processing is not necessary to test the script)
Thank you in advance,
Pereas.
Tags:
Hi Petras
is it actually faster if you use the Grasshopper intersection component?
Or is it about the same in speed as in Python?
I'm asking this because I just fear intersection calculations might take a while on their own. If this is the case, it is actually more difficult to tackle this, except maybe trying to change the document tolerance.
Thanks,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
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