I am new to Python. I am trying to get some points of line intersections with rhynoscriptsyntax. Therefore, I simply used LineLineIntersection(), but the result is actually a bunch of other points generated without line intersections (it is shown in the help tab about the LineLineIntersection() process, but I do not get the idea…):
import rhinoscriptsyntax as rs
import math as mt
import numpy as np
import itertools as it
center=rs.CreatePoint(xaxis,yaxis)
def elp1(t):
x = a * mt.cos(t)+xaxis
y = b * mt.sin(t)+yaxis
return [x,y]
def elp2(t):
x = b * mt.cos(t)+xaxis
y = a * mt.sin(t)+yaxis
return [x,y]
domain=np.linspace(0, mt.pi*2, n, False).tolist()
ellipse1=[]
for i in domain:
ellipse1.append(rs.CreatePoint(elp1(i)[0],elp1(i)[1]))
ellipse2=[]
for i in domain:
ellipse2.append(rs.CreatePoint(elp2(i)[0],elp2(i)[1],h))
ellipse2r=rs.RotateObjects(ellipse2,center, 180, None, False)
lines=[]
for i in ellipse1:
lines.append(rs.AddLine(i,ellipse2[ellipse1.index(i)]))
iterator=list(it.combinations(lines,2))
intersections=[]
for i in iterator:
intersections.append(rs.LineLineIntersection(i[0],i[1]))
chaininter=[]
for i in intersections:
for j in i:
chaininter.append(j)
cullpts=rs.CullDuplicatePoints(chaininter)
I think I will need some time to decode this. But, the script, as I could see, returns a lot of other interesting information about the lines, although this data is not needed for me at the moment. Thank you very much!