Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added three more 80s style retro plotter: Isometric, Radar, StarTunnel
Michael Peter Christen78d26f1ec5ae
diff --git a/source/net/yacy/visualization/IsometricPlotter.java b/source/net/yacy/visualization/IsometricPlotter.javanew file mode 100644index 000000000..9a3f1aeb9--- /dev/null+++ b/source/net/yacy/visualization/IsometricPlotter.java@@ -0,0 +1,158 @@+/**+ * IsometricCityscapePlotter+ * Synthesizes a pixelated skyline using a faux-isometric projection.+ * Copyright 2025 by Michael Peter Christen+ * First released 20.09.2025 at https://yacy.net+ *+ * This file is part of YaCy.+ *+ * This library is free software; you can redistribute it and/or+ * modify it under the terms of the GNU Lesser General Public+ * License as published by the Free Software Foundation; either+ * version 2.1 of the License, or (at your option) any later version.+ *+ * This library is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+ * Lesser General Public License for more details.+ *+ * You should have received a copy of the GNU Lesser General Public License+ * along with this program in the file lgpl21.txt+ * If not, see <http://www.gnu.org/licenses/>.+ */+package net.yacy.visualization;++import java.io.File;+import java.io.IOException;++public class IsometricPlotter extends RasterPlotter {++ private static final int TILE_WIDTH = 24;+ private static final int TILE_HEIGHT = 12;+ private static final int BASELINE = 260;+ private static final int ORIGIN_X = 240;++ private final int[][] heightMap;+ private final long[] palette;++ public IsometricPlotter(final int width, final int height, final int[][] heightMap) {+ super(width, height, DrawMode.MODE_REPLACE, 0x00000C);+ this.heightMap = heightMap;+ this.palette = new long[]{0x1A2E59, 0x24407B, 0x33589B, 0x1F6C8F, 0x3F9FBF, 0x7FD3FF};+ }++ public void renderScene() {+ clear();+ drawBackgroundGrid();+ for (int y = 0; y < heightMap.length; y++) {+ for (int x = heightMap[y].length - 1; x >= 0; x--) {+ final int h = heightMap[y][x];+ if (h <= 0) continue;+ final long baseColor = palette[(x + y) % palette.length];+ drawBuilding(x, y, h, baseColor);+ }+ }+ drawForeground();+ }++ private void drawBackgroundGrid() {+ setColor(0x001133);+ for (int i = 0; i < 7; i++) {+ int y = BASELINE + i * 10;+ line(0, y, getWidth(), y, 12 + i * 2);+ }+ setColor(0x002244);+ for (int i = -6; i <= 6; i++) {+ final int x0 = ORIGIN_X + i * TILE_WIDTH / 2;+ line(x0, BASELINE, x0 + TILE_WIDTH * 6, BASELINE + TILE_HEIGHT * 6, 20);+ line(x0, BASELINE, x0 - TILE_WIDTH * 6, BASELINE + TILE_HEIGHT * 6, 20);+ }+ }++ private void drawBuilding(final int gridX, final int gridY, final int height, final long color) {+ final int baseX = ORIGIN_X + (gridX - gridY) * (TILE_WIDTH / 2);+ final int baseY = BASELINE + (gridX + gridY) * (TILE_HEIGHT / 2);+ final int topY = baseY - height;+ final int halfWidth = TILE_WIDTH / 2;+ final int halfHeight = TILE_HEIGHT / 2;++ // top face shading+ setColor(lighten(color, 1.3d));+ for (int i = 0; i <= halfHeight; i++) {+ int y = topY - halfHeight + i;+ int xLeft = baseX - halfWidth + i;+ int xRight = baseX + halfWidth - i;+ if (xLeft <= xRight) line(xLeft, y, xRight, y, 60);+ }+ for (int i = 0; i <= halfHeight; i++) {+ int y = topY + i;+ int xLeft = baseX - halfWidth + i;+ int xRight = baseX + halfWidth - i;+ if (xLeft <= xRight) line(xLeft, y, xRight, y, 60);+ }++ // left wall+ setColor(darken(color, 0.8d));+ for (int i = 0; i <= height; i++) {+ int y = topY + i;+ int xLeft = baseX - halfWidth;+ int xRight = baseX - halfWidth + halfHeight;+ line(xLeft, y, xRight, y + halfHeight, 45);+ }+ // right wall+ setColor(darken(color, 0.6d));+ for (int i = 0; i <= height; i++) {+ int y = topY + i;+ int xLeft = baseX + halfWidth - halfHeight;+ int xRight = baseX + halfWidth;+ line(xLeft, y + halfHeight, xRight, y, 50);+ }++ // outline edges+ setColor(lighten(color, 1.6d));+ line(baseX, topY - halfHeight, baseX + halfWidth, topY, 100);+ line(baseX, topY - halfHeight, baseX - halfWidth, topY, 100);+ line(baseX - halfWidth, topY, baseX - halfWidth, baseY, 80);+ line(baseX + halfWidth, topY, baseX + halfWidth, baseY, 80);+ line(baseX - halfWidth, baseY, baseX, baseY + halfHeight, 70);+ line(baseX + halfWidth, baseY, baseX, baseY + halfHeight, 70);++ // neon windows+ setColor(0xFFEE66);+ for (int row = 4; row < height; row += 6) {+ int y = topY + row;+ line(baseX - halfWidth / 2, y, baseX - halfWidth / 6, y, 85);+ line(baseX + halfWidth / 6, y, baseX + halfWidth / 2, y, 85);+ }+ }++ private void drawForeground() {+ setColor(0x00AAFF);+ PrintTool.print(this, 6, 12, 0, "ISOMETRIC CITYSCAPE", -1, 90);+ setColor(0x66FFFF);+ PrintTool.print(this, 6, 24, 0, "GRID SECTOR 7B", -1, 70);+ setColor(0x00CCAA);+ PrintTool.print(this, getWidth() - 6, getHeight() - 8, 0, "POPULATION: 1.2M", 1, 60);+ }++ public static void main(final String[] args) {+ System.setProperty("java.awt.headless", "true");+ final File target = (args.length > 0) ? new File(args[0]) : new File(".");+ if (!target.exists()) target.mkdirs();+ final int[][] heights = {+ {40, 60, 80, 70, 45},+ {20, 50, 110, 90, 40},+ {10, 30, 140, 120, 70},+ {0, 40, 90, 80, 30},+ {0, 10, 40, 30, 20}+ };+ final IsometricPlotter city = new IsometricPlotter(480, 320, heights);+ city.renderScene();+ final File out = new File(target, "isometric_city.png");+ try {+ city.save(out, "png");+ } catch (final IOException e) {+ throw new RuntimeException("Failed to save cityscape", e);+ }+ }+}diff --git a/source/net/yacy/visualization/RadarPlotter.java b/source/net/yacy/visualization/RadarPlotter.javanew file mode 100644index 000000000..a559fcb2a--- /dev/null+++ b/source/net/yacy/visualization/RadarPlotter.java@@ -0,0 +1,128 @@+/**+ * NeonVectorRadarPlotter+ * Generates a retro radar style wireframe animation.+ * Copyright 2025 by Michael Peter Christen+ * First released 20.09.2025 at https://yacy.net+ *+ * This file is part of YaCy.+ *+ * This library is free software; you can redistribute it and/or+ * modify it under the terms of the GNU Lesser General Public+ * License as published by the Free Software Foundation; either+ * version 2.1 of the License, or (at your option) any later version.+ *+ * This library is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+ * Lesser General Public License for more details.+ *+ * You should have received a copy of the GNU Lesser General Public License+ * along with this program in the file lgpl21.txt+ * If not, see <http://www.gnu.org/licenses/>.+ */+package net.yacy.visualization;++import java.io.File;+import java.io.IOException;++public class RadarPlotter extends RasterPlotter {++ private final int centerX;+ private final int centerY;+ private final int innerRadius;+ private final int outerRadius;+ private final double[] blipAngles;+ private final int[] blipRadius;+ private final long[] blipColors;++ public RadarPlotter(final int width, final int height) {+ super(width, height, DrawMode.MODE_REPLACE, 0x000018);+ this.centerX = width / 2;+ this.centerY = height / 2;+ this.innerRadius = Math.min(width, height) / 6;+ this.outerRadius = Math.min(width, height) / 2 - 20;+ this.blipAngles = new double[]{18, 46, 102, 153, 214, 276, 320};+ this.blipRadius = new int[]{innerRadius + 30, innerRadius + 70, innerRadius + 110, innerRadius + 160, innerRadius + 120, innerRadius + 50, innerRadius + 90};+ this.blipColors = new long[]{0x44FFAA, 0x66FFEE, 0xFF88AA, 0x88AAFF, 0xFFFF66, 0xFF3366, 0x99FF99};+ }++ public void renderFrame(final int frameIndex) {+ clear();+ final double sweepAngle = (frameIndex % 8) * 45.0d;+ drawRadarGrid(sweepAngle);+ drawSweepBeam(sweepAngle);+ drawBlips(sweepAngle);+ drawOverlay();+ }++ private void drawRadarGrid(final double sweepAngle) {+ setColor(0x003366);+ for (int r = innerRadius; r <= outerRadius; r += 30) {+ arc(centerX, centerY, r - 1, r, 25);+ }+ setColor(0x004488);+ for (int a = 0; a < 360; a += 15) {+ arcLine(centerX, centerY, innerRadius - 10, outerRadius, a, true, null, null, -1, -1, -1, false);+ }+ setColor(0x001122);+ arc(centerX, centerY, innerRadius - 15, innerRadius - 8, 18);+ arc(centerX, centerY, outerRadius + 5, outerRadius + 8, 30);++ final double pulse = 10 + 8 * Math.sin(Math.toRadians(sweepAngle));+ setColor(0x00AAFF);+ arc(centerX, centerY, innerRadius + 5, (int) (innerRadius + 5 + pulse), 35);+ }++ private void drawSweepBeam(final double sweepAngle) {+ final int beamWidth = 4;+ final long[] colors = new long[]{0x00FFCC, 0x00BBAA, 0x008877, 0x004433};+ for (int i = 0; i < beamWidth; i++) {+ final double angle = sweepAngle - i * 2.5d;+ setColor(colors[i]);+ arcLine(centerX, centerY, innerRadius - 4, outerRadius + 5, angle, true, null, null, -1, -1, -1, false);+ }+ }++ private void drawBlips(final double sweepAngle) {+ for (int i = 0; i < blipAngles.length; i++) {+ final double angle = blipAngles[i];+ final int radius = blipRadius[i];+ final double diff = Math.abs(((sweepAngle - angle + 540) % 360) - 180);+ final int intensity = diff < 12 ? 90 : diff < 24 ? 60 : 35;+ final long color = blipColors[i];+ setColor(color);+ final int x = centerX + (int) Math.round(Math.cos(Math.toRadians(angle)) * radius);+ final int y = centerY - (int) Math.round(Math.sin(Math.toRadians(angle)) * radius);+ dot(x, y, diff < 10 ? 6 : 4, true, intensity);+ if (diff < 18) {+ setColor(lighten(color, 1.4d));+ dot(x, y, 2, true, 100);+ }+ }+ }++ private void drawOverlay() {+ setColor(0x006699);+ PrintTool.print(this, 4, 12, 0, "NEON VECTOR RADAR", -1, 80);+ setColor(0x00FFFF);+ PrintTool.print(this, 4, 24, 0, "SCAN ACTIVE", -1, 70);+ setColor(0x004466);+ PrintTool.print(this, getWidth() - 4, 12, 0, "RANGE:" + outerRadius + "px", 1, 70);+ }++ public static void main(final String[] args) {+ System.setProperty("java.awt.headless", "true");+ final File target = (args.length > 0) ? new File(args[0]) : new File(".");+ if (!target.exists()) target.mkdirs();+ final RadarPlotter radar = new RadarPlotter(480, 480);+ for (int frame = 0; frame < 8; frame++) {+ radar.renderFrame(frame);+ final File out = new File(target, String.format("neon_radar_%02d.png", frame));+ try {+ radar.save(out, "png");+ } catch (final IOException e) {+ throw new RuntimeException("Failed to save radar frame", e);+ }+ }+ }+}diff --git a/source/net/yacy/visualization/StarTunnelPlotter.java b/source/net/yacy/visualization/StarTunnelPlotter.javanew file mode 100644index 000000000..6349da2ac--- /dev/null+++ b/source/net/yacy/visualization/StarTunnelPlotter.java@@ -0,0 +1,136 @@+/**+ * StarTunnelPlotter+ * Creates an 80s style star tunnel animation reminiscent of hyperspace jumps.+ * Copyright 2025 by Michael Peter Christen+ * First released 20.09.2025 at https://yacy.net+ *+ * This file is part of YaCy.+ *+ * This library is free software; you can redistribute it and/or+ * modify it under the terms of the GNU Lesser General Public+ * License as published by the Free Software Foundation; either+ * version 2.1 of the License, or (at your option) any later version.+ *+ * This library is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+ * Lesser General Public License for more details.+ *+ * You should have received a copy of the GNU Lesser General Public License+ * along with this program in the file lgpl21.txt+ * If not, see <http://www.gnu.org/licenses/>.+ */+package net.yacy.visualization;++import java.io.File;+import java.io.IOException;+import java.util.Random;++public class StarTunnelPlotter extends RasterPlotter {++ private static final class Star {+ double x;+ double y;+ double z;+ }++ private final Star[] stars;+ private final Random random;+ private final double speed;+ private final double focalLength;+ private final int centerX;+ private final int centerY;++ public StarTunnelPlotter(final int width, final int height, final int starCount) {+ super(width, height, DrawMode.MODE_REPLACE, 0x000010);+ this.random = new Random(0xCADCADE);+ this.stars = new Star[starCount];+ this.speed = 12.0d;+ this.focalLength = Math.min(width, height) * 1.2d;+ this.centerX = width / 2;+ this.centerY = height / 2;+ for (int i = 0; i < starCount; i++) {+ this.stars[i] = randomStar();+ }+ }++ private Star randomStar() {+ final Star s = new Star();+ s.z = random.nextDouble() * 400 + 40;+ final double angle = random.nextDouble() * 2 * Math.PI;+ final double radius = Math.sqrt(random.nextDouble()) * 220;+ s.x = Math.cos(angle) * radius;+ s.y = Math.sin(angle) * radius;+ return s;+ }++ public void renderFrame() {+ clear();+ drawGrid();+ setColor(0x66FFFF);+ for (final Star star : stars) {+ star.z -= speed;+ if (star.z < 20) {+ final Star replacement = randomStar();+ star.x = replacement.x;+ star.y = replacement.y;+ star.z = replacement.z + 400;+ }+ final double scale = focalLength / star.z;+ final int x = centerX + (int) Math.round(star.x * scale);+ final int y = centerY + (int) Math.round(star.y * scale);+ if (x < 0 || x >= getWidth() || y < 0 || y >= getHeight()) continue;+ final int intensity = Math.min(100, (int) (120 - star.z / 4));+ final int radius = Math.max(1, (int) (6 - star.z / 80));+ dot(x, y, radius, true, intensity);+ }+ drawOverlay();+ }++ private void drawGrid() {+ setColor(0x002244);+ for (int i = 0; i < 40; i++) {+ final int offset = i * 12;+ final int intensity = 20 + (i % 8) * 4;+ final int y = getHeight() - offset;+ if (y < 0) break;+ line(0, y, getWidth(), y, intensity);+ }+ setColor(0x003366);+ for (int a = -80; a <= 80; a += 10) {+ final double rad = Math.toRadians(a);+ final int x1 = centerX;+ final int y1 = centerY;+ final int x2 = centerX + (int) (Math.cos(rad) * getWidth());+ final int y2 = centerY + (int) (Math.sin(rad) * getHeight());+ line(x1, y1, x2, y2, 28);+ }+ setColor(0x004477);+ dot(centerX, centerY, 12, true, 30);+ }++ private void drawOverlay() {+ setColor(0x00FFCC);+ PrintTool.print(this, 4, 12, 0, "STAR TUNNEL", -1, 90);+ setColor(0x66FFFF);+ PrintTool.print(this, 4, 22, 0, "HYPERSPACE VECTOR", -1, 70);+ setColor(0x00AACC);+ PrintTool.print(this, getWidth() - 4, getHeight() - 6, 0, "SPEED:" + (int) speed * stars.length, 1, 70);+ }++ public static void main(final String[] args) {+ System.setProperty("java.awt.headless", "true");+ final File target = (args.length > 0) ? new File(args[0]) : new File(".");+ if (!target.exists()) target.mkdirs();+ final StarTunnelPlotter tunnel = new StarTunnelPlotter(480, 360, 160);+ for (int frame = 0; frame < 8; frame++) {+ tunnel.renderFrame();+ final File out = new File(target, String.format("star_tunnel_%02d.png", frame));+ try {+ tunnel.save(out, "png");+ } catch (final IOException e) {+ throw new RuntimeException("Failed to store tunnel frame", e);+ }+ }+ }+}