Code:
fresnelC(t) {
let sum = 0;
let n = 50;
let dt = t / n;
for (let i = 0; i < n; i++) {
let u = i * dt;
sum += cos((u * u) / 2) * dt;
}
return sum;
}
fresnelS(t) {
let sum = 0;
let n = 50;
let dt = t / n;
for (let i = 0; i < n; i++) {
let u = i * dt;
sum += sin((u * u) / 2) * dt;
}
return sum;
}
cornuSpiral() {
let numPoints = 200;
let maxT = this.a * PI;
for (let i = 0; i < numPoints; i++) {
let t = map(i, 0, numPoints, -maxT, maxT);
let x = this.n + this.r * this.fresnelC(t);
let y = this.n + this.r * this.fresnelS(t);
this.points.push(createVector(x, y));
}
}
Sources:
Recursive circles with cornu spiral |
Rounded Star with cornu spiral |
Square skierpinski with cornu spiral |
Hilbert curve with cornu spiral |