We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am working with intersections of curves. I tried toxiclibs and hemesh libraries at first. But after lots of errors I tried to write a simple script using python in grasshopper. As a result, I noticed that there were issues with data tree, that I could not solve in processing or simple because of my skills of programming.
Long story short, I have an array of polygons. When they intersect, their corners rotate 90 degrees downwards.
Simple, but extensive to write a script in processing. For now I have quite fast script in grasshopper. The main component calculates intersection between curves ant returns diagonals in data tree. When I tried to play with movement and physics, I saw that I need to realize my ideas in processing. As a result, I want to rewrite the script in processing...
Here are diagonals (in purple color) I am working on:
The intersection function for getting intersection diagonals was written in python:
import ghpythonlib.components as ghcomp import rhinoscriptsyntax as rs def ctr(crv): pts = ghcomp.Explode(crv) //polygons are exploded into segmens pts = ghcomp.CullDuplicates(pts,0.001) //duplicate lines are deleted return ghcomp.Average(pts) pts =  lines =  ctr_c1 = ctr(C1) for crv in C2: if ctr(crv) != ctr_c1: int = ghcomp.CurveXCurve(C1, crv) //intersection of curves is calculated if int: [pts.append(x) for x in int] lines.append(rs.AddLine(int,int))
The script returns diagonals of intersected curves in a data tree. By data tree I mean that there are 15 polygons in the picture. And the script returns the output saying that 1st curve has 2 objects as lines, 2nd curve has 3 objects as lines, 3rd curve has 1 object as line and so on. Each polygon is associated with intersection diagonals.
Could you help me to rewrite this python script in processing? If not, maybe you have references for similar scripts in processing using any relevant library?
Thank you in advance, Petras.