function normal_binormal(d) {
const [x, y, z] = d;
let n;
if (x && y) n = normalize([-y, x, 0]);
else if (x && z) n = normalize([-z, 0, x]);
else if (y && z) n = normalize([0, -z, y]);
if(n !== undefined) {
return [n, normalize(cross(n, d))];
}
if (x) return [[0, 1, 0], [0, 0, 1]];
if (y) return [[1, 0, 0], [0, 0, 1]];
if (z) return [[1, 0, 0], [0, 1, 0]];
return [undefined, undefined];
}