xxxxxxxxxx
54
let residues = [];
let p = 50; // A prime number greater than 50
let numPoints = 10; // Increased number of points for more density
function setup() {
createCanvas(600, 600);
background(255);
noStroke();
// Calculate quadratic residues
for (let a = 1; a < p; a++) {
let residue = (a * a) % p;
if (!residues.includes(residue)) {
residues.push(residue);
}
}
// Print the quadratic residues
console.log("Quadratic Residues:", residues);
// Store points for the path
let points = [];
// Draw the ASCII Arabic characters continuously
for (let i = 0; i < numPoints; i++) {
// Randomly select a residue
let residue = random(residues);
// Random angle and radius to create twists
let angle = random(TWO_PI);
let r = map(residue, 0, p, 50, 250) + random(-30, 30); // Add randomness to radius
let x = width / 2 + r * cos(angle);
let y = height / 2 + r * sin(angle);
// Store the point for the curve
points.push(createVector(x, y));
}
// Draw the connecting curve
noFill();
stroke(0);
beginShape();
for (let i = 0; i < points.length; i++) {
curveVertex(points[i].x, points[i].y);
}
endShape();
function draw() {
// Nothing to animate
}
}