Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Measure curve-curve overlap

$
0
0

@lawrenceyy wrote:

Given large curves (red) and smaller curves (blue) I want to return only blue curves that overlap red curves by more than 99% of its area. Blue curves that have more than 1% area outside of red curves are ignored. My script utilizes Rhino.Geometry.Curve.CreateBooleanDifference() to find if the excess area is more than 1%. My question is: how do you get the area of a closed planar curve via rhinocommon? And/or is there a better way of approaching this?


The red curves start out as un-joined halves, so I join them in the script
import Rhino.Geometry as rg

redclosed=rg.Curve.JoinCurves(red)[0]
bluelist=[]
arealist=[]
for i in blue:
    temp1=rg.Curve.CreateBooleanDifference(i,redclosed)
    if len(temp1)==0:
        arealist.append(0)
    else:
        area=0
        for j in temp1:
            area+=#get area of j
        arealist.append(area)
    if arealist[-1]/ #area of i<.01:
        bluelist.append(i)
a=bluelist
b=arealist

I've attached a model and a grasshopper script.
160616 Temp.3dm (72.7 KB)160616 Area Analysis.gh (7.9 KB)

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles