pathAlongArc function
Implementation
PathFunc pathAlongArc(double angle, {Vector3 axis = OUT}) {
if (angle.abs() <= STRAIGHT_PATH_THRESHOLD) {
return straightPath;
}
if (axis.normSquared() == 0) {
axis = OUT;
}
axis = axis.normalize();
return (startPoints, endPoints, alpha) {
var start = Array.fromVectorList(startPoints);
var end = Array.fromVectorList(endPoints);
var vects = start - end;
var centers = start + vects / 2;
if (angle != PI) {
var vectsList = [for (var v in vects.values) Vector3(v[0], v[1], v[2])];
var crossProducts = [for (var vec in vectsList) axis.cross(vec / 1)];
var crossArray = Array.fromVectorList(crossProducts);
centers += crossArray / tan(angle / 2);
}
var rotationMat = rotationMatrix(angle * alpha, axis);
var outMat = centers + (start - centers).matMul(rotationMat.T);
return [for (var row in outMat.values) Vector3(row[0], row[1], row[2])];
};
}