/* ================================================================= DTIM-ZEC ATOM-KONSTRUKTOR (SYNTAX-CLEAN VERSION) Entwickelt für processing.min.js - Jan Bühring Modell ================================================================= */ ArrayList activeAtoms; ArrayList activePhotons; Atom currentAssemblyAtom; boolean isSimulationPaused = false; int buildMode = 0; // 0 = Kern, 1 = Molekül GraphNode selectedNode = null; // Urknall & Raumwölbung boolean isUniverseCreated = false; float genesisRadius = 0.0; float genesisMaxRadius = 700.0; // Hexagonales Waben-Gitter (120-Grad-Geometrie) int hexCols = 16; int hexRows = 12; float hexRadius = 28.0; HexPoint[][] hexGrid; float centerX, centerY; float centralMassG = 0.8; void setup() { size(1100, 750); activeAtoms = new ArrayList(); activePhotons = new ArrayList(); currentAssemblyAtom = new Atom(150, 230, true); centerX = 300 + (width - 300) / 2.0; centerY = height / 2.0; initHexGrid(); } void draw() { background(10, 12, 18); if (!isUniverseCreated) { drawUnstableVacuumState(); drawAssemblyWorkbench(); currentAssemblyAtom.display(); return; } updateAndDrawHexGrid(); if (genesisRadius < genesisMaxRadius) { drawGenesisExpansion(); } drawAssemblyWorkbench(); if (!isSimulationPaused) { checkFusionCollisions(); } for (int i = activeAtoms.size() - 1; i >= 0; i--) { Atom a = (Atom) activeAtoms.get(i); if (!isSimulationPaused) { a.updateGravitationalPhysics(centerX, centerY, centralMassG); a.updateQuantumJumps(); a.checkDecay(); } a.display(); if (a.isDestroyed) { activeAtoms.remove(i); } } for (int i = activePhotons.size() - 1; i >= 0; i--) { Photon p = (Photon) activePhotons.get(i); if (!isSimulationPaused) { p.update(); } p.display(); if (p.isDead) { activePhotons.remove(i); } } currentAssemblyAtom.display(); drawNodeInspector(); displayGlobalHUD(); } // --- URKNALL & RAUM-AUFWÖLBUNG --- void drawUnstableVacuumState() { float pulse = sin(frameCount * 0.1) * 8.0; fill(255, 255, 255, 180 + pulse * 5); noStroke(); ellipse(centerX, centerY, 14 + pulse, 14 + pulse); stroke(0, 180, 255, 100); strokeWeight(1.5); for(int a = 0; a < 3; a++) { float ang = frameCount * 0.03 + a * (TWO_PI / 3.0); line(centerX, centerY, centerX + cos(ang)*(30 + pulse), centerY + sin(ang)*(30 + pulse)); } fill(0, 220, 255); textAlign(CENTER); textSize(14); text("Klicke in das Feld, um die 3D-Raumzeit (DTIM-ZEC Graph) aufzuwölben...", centerX, centerY + 70); } void drawGenesisExpansion() { genesisRadius += 14.0; stroke(0, 255, 200, 255 - (genesisRadius / genesisMaxRadius) * 255); strokeWeight(2); noFill(); ellipse(centerX, centerY, genesisRadius * 2, genesisRadius * 2); for(int i = 0; i < 6; i++) { float ang = i * (TWO_PI / 6.0); line(centerX, centerY, centerX + cos(ang) * genesisRadius, centerY + sin(ang) * genesisRadius); } } // --- HEXAGONALES RAUMZEIT-GITTER --- void initHexGrid() { hexGrid = new HexPoint[hexCols][hexRows]; float startX = 330; float startY = 40; for (int i = 0; i < hexCols; i++) { for (int j = 0; j < hexRows; j++) { float x = startX + i * hexRadius * 1.732; if (j % 2 == 1) { x += (hexRadius * 1.732) / 2.0; } float y = startY + j * hexRadius * 1.5; hexGrid[i][j] = new HexPoint(x, y); } } } void updateAndDrawHexGrid() { for (int i = 0; i < hexCols; i++) { for (int j = 0; j < hexRows; j++) { HexPoint hp = hexGrid[i][j]; float targetX = hp.baseX; float targetY = hp.baseY; float dCenter = dist(targetX, targetY, centerX, centerY); if (dCenter > 1) { float pull = 1200.0 / (dCenter + 40); targetX += (centerX - targetX) * (pull / dCenter); targetY += (centerY - targetY) * (pull / dCenter); } for (int k = 0; k < activeAtoms.size(); k++) { Atom a = (Atom) activeAtoms.get(k); float dAtom = dist(targetX, targetY, a.x, a.y); if (dAtom < 160) { float massFactor = (a.protons + a.neutrons + 1) * 4.0; float atomPull = massFactor / (dAtom + 15); targetX += (a.x - targetX) * (atomPull / dAtom); targetY += (a.y - targetY) * (atomPull / dAtom); } } hp.currX += (targetX - hp.currX) * 0.1; hp.currY += (targetY - hp.currY) * 0.1; } } stroke(0, 180, 255, 35); strokeWeight(1.2); noFill(); for (int i = 0; i < hexCols - 1; i++) { for (int j = 0; j < hexRows - 1; j++) { HexPoint p1 = hexGrid[i][j]; HexPoint p2 = hexGrid[i+1][j]; HexPoint p3 = hexGrid[i][j+1]; line(p1.currX, p1.currY, p2.currX, p2.currY); line(p1.currX, p1.currY, p3.currX, p3.currY); } } noStroke(); fill(0, 180, 255, 15); ellipse(centerX, centerY, 120, 120); fill(0, 220, 255, 40); ellipse(centerX, centerY, 30, 30); } // --- FUSION & COLLISION --- void checkFusionCollisions() { for (int i = 0; i < activeAtoms.size(); i++) { Atom a1 = (Atom) activeAtoms.get(i); for (int j = i + 1; j < activeAtoms.size(); j++) { Atom a2 = (Atom) activeAtoms.get(j); float d = dist(a1.x, a1.y, a2.x, a2.y); if (d < 45) { a1.mergeWith(a2); a2.isDestroyed = true; activePhotons.add(new Photon(a1.x, a1.y, random(TWO_PI), 3.5)); break; } } } } // --- INTERAKTIONEN --- void mousePressed() { if (!isUniverseCreated && mouseX > 300) { isUniverseCreated = true; genesisRadius = 1.0; return; } if (mouseX > 15 && mouseX < 285) { if (mouseY > 370 && mouseY < 400) { buildMode = 0; } if (mouseY > 405 && mouseY < 435) { buildMode = 1; } if (mouseY > 450 && mouseY < 485) { currentAssemblyAtom.addParticle(1, buildMode); } if (mouseY > 495 && mouseY < 530) { currentAssemblyAtom.addParticle(2, buildMode); } if (mouseY > 540 && mouseY < 575) { currentAssemblyAtom.addParticle(3, buildMode); } if (mouseY > 600 && mouseY < 650) { releaseAtomToSimulation(); } } selectedNode = null; for (int i = 0; i < currentAssemblyAtom.nodes.size(); i++) { GraphNode n = (GraphNode) currentAssemblyAtom.nodes.get(i); if (dist(mouseX, mouseY, currentAssemblyAtom.x + n.relX, currentAssemblyAtom.y + n.relY) < 18) { selectedNode = n; break; } } if (mouseX > width - 140 && mouseX < width - 20 && mouseY > 20 && mouseY < 60) { isSimulationPaused = !isSimulationPaused; } } void releaseAtomToSimulation() { if (currentAssemblyAtom.nodes.size() > 0) { if (!isUniverseCreated) { isUniverseCreated = true; } currentAssemblyAtom.isWorkbench = false; currentAssemblyAtom.x = 360; currentAssemblyAtom.y = random(150, height - 150); currentAssemblyAtom.vx = random(2.0, 3.5); currentAssemblyAtom.vy = random(-1.5, 1.5); activeAtoms.add(currentAssemblyAtom); currentAssemblyAtom = new Atom(150, 230, true); } } // --- UI WORKBENCH & HUD --- void drawAssemblyWorkbench() { fill(18, 22, 32); stroke(40, 50, 70); rect(0, 0, 300, height); fill(12, 15, 22); stroke(0, 180, 255, 100); strokeWeight(2); rect(15, 50, 270, 300, 12); fill(0, 180, 255); textSize(13); textAlign(CENTER); text("KONSTRUKTIONS-BOX", 150, 35); strokeWeight(1); if (buildMode == 0) { fill(0, 150, 200); } else { fill(30, 40, 55); } rect(20, 370, 125, 30, 6); fill(255); text("Kern-Modus", 82, 390); if (buildMode == 1) { fill(0, 150, 200); } else { fill(30, 40, 55); } rect(155, 370, 125, 30, 6); fill(255); text("Molekul-Modus", 217, 390); textAlign(LEFT); fill(200, 50, 50); rect(20, 450, 260, 35, 6); fill(255); text("+ Proton (2u, 1d)", 35, 472); fill(120, 130, 140); rect(20, 495, 260, 35, 6); fill(255); text("+ Neutron (1u, 2d)", 35, 517); fill(40, 120, 220); rect(20, 540, 260, 35, 6); fill(255); text("+ Elektron / Hulle", 35, 562); fill(0, 200, 120); rect(20, 600, 260, 50, 10); fill(10, 20, 15); textSize(14); textAlign(CENTER, CENTER); text("FREISETZEN", 150, 625); } void drawNodeInspector() { if (selectedNode != null && selectedNode.type > 0) { fill(22, 28, 42, 230); stroke(0, 200, 255); strokeWeight(1.5); rect(width - 320, height - 180, 300, 160, 10); fill(0, 220, 255); textAlign(LEFT); textSize(13); text("SUBATOMARER INSPEKTOR", width - 305, height - 155); fill(255); textSize(12); if (selectedNode.type == 1) { text("Typ: PROTON (+1 e)", width - 305, height - 130); text("Quarks: 2u (+2/3), 1d (-1/3)", width - 305, height - 110); text("Gluonen-Kanten: 120-Grad Hex", width - 305, height - 90); text("Masse: +938.27 MeV", width - 305, height - 70); } else if (selectedNode.type == 2) { text("Typ: NEUTRON (0 e)", width - 305, height - 130); text("Quarks: 1u (+2/3), 2d (-1/3)", width - 305, height - 110); text("Gluonen-Kanten: 120-Grad Hex", width - 305, height - 90); text("Masse: +939.56 MeV", width - 305, height - 70); } else if (selectedNode.type == 3) { text("Typ: ELEKTRON (-1 e)", width - 305, height - 130); text("Orbit-Schale: " + selectedNode.currentShell, width - 305, height - 110); text("Quantensprung: h*f Wabenwelle", width - 305, height - 90); text("Masse: +0.511 MeV", width - 305, height - 70); } } } void displayGlobalHUD() { if (isSimulationPaused) { fill(220, 120, 40); } else { fill(40, 60, 80); } stroke(255, 50); rect(width - 140, 20, 120, 40, 8); fill(255); textAlign(CENTER, CENTER); if (isSimulationPaused) { text("PLAY", width - 80, 40); } else { text("PAUSE", width - 80, 40); } textAlign(LEFT, CENTER); textSize(12); text("ZEC-Constraint: Tr(rho_0 H) = 0.0000 eV [Invariant]", 320, 30); if (isSimulationPaused) { text("Status: Pausiert zum Untersuchen", 320, 50); } else { text("Status: DTIM-ZEC 120-Grad Gitter aktiv", 320, 50); } } // --- KLASSEN --- class HexPoint { float baseX, baseY; float currX, currY; HexPoint(float x, float y) { this.baseX = x; this.baseY = y; this.currX = x; this.currY = y; } } class Atom { float x, y; float vx, vy; boolean isWorkbench; boolean isDestroyed = false; ArrayList nodes; int protons, neutrons, electrons; float bindingEnergy = 0.0; int decayTimer = 0; boolean isUnstable = false; Atom(float x, float y, boolean isWorkbench) { this.x = x; this.y = y; this.isWorkbench = isWorkbench; nodes = new ArrayList(); vx = 0; vy = 0; protons = 0; neutrons = 0; electrons = 0; } void addParticle(int type, int mode) { float posE = (type == 3) ? 0.511 : 938.27; float rx = 0; float ry = 0; if (mode == 1 || type == 3) { float angle = random(TWO_PI); rx = cos(angle) * 65; ry = sin(angle) * 65; } else { rx = random(-18, 18); ry = random(-18, 18); } GraphNode node = new GraphNode(rx, ry, type, posE); if (type == 3) { node.currentShell = 1; } nodes.add(node); if (type == 1) { protons++; } if (type == 2) { neutrons++; } if (type == 3) { electrons++; } calculateBindingEnergy(); checkStability(); } void mergeWith(Atom other) { for (int i = 0; i < other.nodes.size(); i++) { GraphNode n = (GraphNode) other.nodes.get(i); n.relX = random(-20, 20); n.relY = random(-20, 20); nodes.add(n); } protons += other.protons; neutrons += other.neutrons; electrons += other.electrons; vx = (vx + other.vx) * 0.5; vy = (vy + other.vy) * 0.5; calculateBindingEnergy(); checkStability(); } void updateQuantumJumps() { for (int i = 0; i < nodes.size(); i++) { GraphNode n = (GraphNode) nodes.get(i); if (n.type == 3) { if (random(1.0) < 0.008) { int oldShell = n.currentShell; n.currentShell = (int)random(1, 4); if (oldShell != n.currentShell) { float newRadius = 65 + (n.currentShell - 1) * 30; float angle = random(TWO_PI); n.relX = cos(angle) * newRadius; n.relY = sin(angle) * newRadius; activePhotons.add(new Photon(x + n.relX, y + n.relY, random(TWO_PI), 2.5)); } } else { float angle = atan2(n.relY, n.relX) + 0.03; float r = 65 + (n.currentShell - 1) * 30; n.relX = cos(angle) * r; n.relY = sin(angle) * r; } } } } void calculateBindingEnergy() { if (protons > 0) { bindingEnergy = -13.6 * (protons * protons) / (electrons > 0 ? electrons : 1.0); } else { bindingEnergy = 0.0; } } void checkStability() { if (protons > 0) { float ratio = (float)neutrons / (float)protons; if ((protons > 2 && ratio < 0.5) || ratio > 2.3 || protons > 10) { isUnstable = true; } else { isUnstable = false; decayTimer = 0; } } } void checkDecay() { if (isUnstable && !isWorkbench) { decayTimer++; if (decayTimer > 240) { isDestroyed = true; for(int k = 0; k < 4; k++) { activePhotons.add(new Photon(x, y, random(TWO_PI), 3.5)); } } } } void updateGravitationalPhysics(float cx, float cy, float gConst) { if (!isWorkbench) { float dx = cx - x; float dy = cy - y; float d = sqrt(dx*dx + dy*dy); if (d > 15) { float force = (gConst * (protons + neutrons + 1) * 12.0) / (d * d); vx += (dx / d) * force; vy += (dy / d) * force; } vx *= 0.992; vy *= 0.992; x += vx; y += vy; if (x < 330 || x > width - 30) { vx *= -0.8; } if (y < 30 || y > height - 30) { vy *= -0.8; } } } void display() { pushMatrix(); translate(x, y); drawOrbitals(); for (int i = 0; i < nodes.size(); i++) { GraphNode n = (GraphNode) nodes.get(i); n.display(); } fill(255, 200); textAlign(CENTER); textSize(11); text(getElementName(), 0, 85); fill(0, 220, 255, 180); text("E_bind: " + nf(bindingEnergy, 1, 1) + " eV", 0, 100); if (isUnstable) { if ((frameCount / 15) % 2 == 0) { fill(255, 50, 50); textSize(12); text("⚠️ KERN INSTABIL ⚠️", 0, -80); } } popMatrix(); } void drawOrbitals() { noFill(); strokeWeight(1); if (electrons > 0) { stroke(0, 180, 255, 60); ellipse(0, 0, 130, 130); } if (electrons > 2) { stroke(0, 180, 255, 40); ellipse(0, 0, 190, 190); } if (electrons > 10 || buildMode == 1) { stroke(0, 255, 180, 30); ellipse(0, 0, 250, 250); } } String getElementName() { if (protons == 0) return "Leeres Fach"; if (protons == 1) return "Wasserstoff (H)"; if (protons == 2) return "Helium (He)"; if (protons == 3) return "Lithium (Li)"; if (protons == 4) return "Beryllium (Be)"; if (protons == 5) return "Bor (B)"; if (protons == 6) return "Kohlenstoff (C)"; return "Element Z=" + protons; } } class GraphNode { float relX, relY; int type; float energy; int currentShell = 1; GraphNode(float relX, float relY, int type, float energy) { this.relX = relX; this.relY = relY; this.type = type; this.energy = energy; } void display() { pushMatrix(); translate(relX, relY); if (type == 1 || type == 2) { if (type == 1) { fill(220, 50, 50, 100); } else { fill(140, 150, 160, 100); } stroke(255, 100); strokeWeight(1); ellipse(0, 0, 36, 36); stroke(255, 255, 0, 180); strokeWeight(1); float q1x = sin(0) * 8, q1y = cos(0) * 8; float q2x = sin(TWO_PI/3.0) * 8, q2y = cos(TWO_PI/3.0) * 8; float q3x = sin(2*TWO_PI/3.0) * 8, q3y = cos(2*TWO_PI/3.0) * 8; line(q1x, q1y, q2x, q2y); line(q2x, q2y, q3x, q3y); line(q3x, q3y, q1x, q1y); noStroke(); fill(255, 200, 0); ellipse(q1x, q1y, 7, 7); ellipse(q2x, q2y, 7, 7); if (type == 1) { fill(255, 200, 0); } else { fill(0, 220, 255); } ellipse(q3x, q3y, 7, 7); } else if (type == 3) { fill(40, 140, 255); noStroke(); ellipse(0, 0, 12, 12); stroke(0, 180, 255, 150); noFill(); ellipse(0, 0, 18, 18); } popMatrix(); } } class Photon { float x, y; float vx, vy; int life = 110; boolean isDead = false; Photon(float x, float y, float angle, float speed) { this.x = x; this.y = y; this.vx = cos(angle) * speed; this.vy = sin(angle) * speed; } void update() { x += vx; y += vy; life--; if (life <= 0) { isDead = true; } } void display() { stroke(0, 255, 200, life * 2.2); strokeWeight(2); line(x, y, x - vx*4, y - vy*4); } }