pts = {
new_curve;
new_curve2;
let n = 150;
let [a, b] = [1, 2].map(d3.randomUniform(1, 5));
let [p, q] = [1, 2].map(d3.randomUniform(0.1, 0.9));
let theta = d3.randomUniform(0, 2 * Math.PI)();
let cos_theta = Math.cos(theta);
let sin_theta = Math.sin(theta);
let R = (x, y) => [
cos_theta * x - sin_theta * y,
sin_theta * x + cos_theta * y
];
let skew = d3.randomUniform(0, 0.5)();
function r(t) {
let c = Math.cos(t);
let s = Math.sin(t);
let x = (1 - c * skew) * a * Math.sign(c) * Math.abs(c) ** p;
let y = b * Math.sign(s) * Math.abs(s) ** q;
let [X, Y] = R(x, y);
return [X, Y];
}
let pts = d3.range(0, 2 * Math.PI + Math.PI, Math.PI / n).map(r);
pts.rot = -((180 * theta) / Math.PI + 90);
let [xmin, xmax] = d3.extent(pts.map((pt) => pt[0]));
let [ymin, ymax] = d3.extent(pts.map((pt) => pt[1]));
pts.xmin = xmin;
pts.ymin = ymin;
pts.xmax = xmax;
pts.ymax = ymax;
pts.size = Math.ceil(d3.max([xmax, -xmin, ymax, -ymin]));
return pts;
}