Subdivision of curves with max spacing

Improved Version of the above definition …

OrthBms.dyn (13.8 KB)

def br1(c1,c2,p1,s1)
{
	r1 = c1.ParameterAtPoint(p1);
	p2 = c2.ClosestPointTo(p1);
	r2 = c2.ParameterAtPoint(p2);
	p3 = c2.PointAtChordLength(s1,r2,true);
	p4 = c1.ClosestPointTo(p3);
	d1 = p1.DistanceTo(p4);
	p5 = d1<=s1?p4:c1.PointAtChordLength(s1,r1,true);
	return = p5;
};

def br2(c1,c2,s1)
{
	return = [Imperative]
	{
		n = 0;
		q = Math.Ceiling(c1.Length/s1);
		p1 = c1.StartPoint;
		p3 = {};
		while (n <= q)
		{
			p3[n] = br1(c1,c2,p1,s1);
			p1 = p3[n];
			n = n + 1;

		}
		return = p3;
	}
};

max = 4000;
pt1 = br2(cr1,cr2,max);
pt2 = cr2.ClosestPointTo(pt1);
ln1 = Line.ByStartPointEndPoint(pt1,pt2);