Catenary
Last updated
Last updated
p1 = Point.ByCoordinates(7,8,25).Translate(Vector.YAxis(),0..50..10);
p2 = Point.ByCoordinates(50,-5,20).Translate(Vector.YAxis(),0..50..10);
a = 10..50..#6;
l=Line.ByStartPointEndPoint(p1,p2);
x=(-l.Length/2)..(l.Length/2)..0.1;
z=a*Math.Cosh(x/a);
p3=Point.ByCoordinates(x,0,z);
p4=p3.Translate(Vector.ZAxis(),-List.FirstItem(p3<1>).Z);
or=l.PointAtParameter(0.5);
vx=Vector.ByTwoPoints(or,l.PointAtParameter(1));
vy=Vector.ByTwoPoints(or,or.Translate(Vector.YAxis(),1));
cs=CoordinateSystem.ByOriginVectors(or,vx,vy);
p5=p4.Transform(cs);
ct=NurbsCurve.ByPoints(p5);
[p1,p2,ct];