createC1

Creates a spline where the tangents at each control point are the same. The curves are guaranteed to be at least in the class C1.

const points = [
new Cartesian3(1235398.0, -4810983.0, 4146266.0),
new Cartesian3(1372574.0, -5345182.0, 4606657.0),
new Cartesian3(-757983.0, -5542796.0, 4514323.0),
new Cartesian3(-2821260.0, -5248423.0, 4021290.0),
new Cartesian3(-2539788.0, -4724797.0, 3620093.0)
];

// Add tangents
const tangents = new Array(points.length);
tangents[0] = new Cartesian3(1125196, -161816, 270551);
const temp = new Cartesian3();
for (let i = 1; i < tangents.length - 1; ++i) {
tangents[i] = Cartesian3.multiplyByScalar(Cartesian3.subtract(points[i + 1], points[i - 1], temp), 0.5, new Cartesian3());
}
tangents[tangents.length - 1] = new Cartesian3(1165345, 112641, 47281);

const spline = HermiteSpline.createC1({
times : times,
points : points,
tangents : tangents
});

Return

A hermite spline.

See also