Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
more image processing hacks
Michael Peter Christen55bdafbaf1dd
diff --git a/source/net/yacy/visualization/CircleTool.java b/source/net/yacy/visualization/CircleTool.javaindex 153bccf60..3da15f086 100644--- a/source/net/yacy/visualization/CircleTool.java+++ b/source/net/yacy/visualization/CircleTool.java@@ -62,15 +62,15 @@ public class CircleTool {r1 = (short) (r + 1);crc = new ArrayList<short[]>();for (short a = 0; a < 2 * (r + 1); a++) {- x = (short) (r1 * Math.cos(Math.PI * a / (4 * r1)));- y = (short) (r1 * Math.sin(Math.PI * a / (4 * r1)));+ x = (short) (r1 * Math.cos(RasterPlotter.PI4 * a / r1));+ y = (short) (r1 * Math.sin(RasterPlotter.PI4 * a / r1));co = x + "|" + y;if (!(crds.contains(co))) {crc.add(new short[]{x, y});crds.add(co);}- x = (short) ((r + 0.5) * Math.cos(Math.PI * a / (4 * r1)));- y = (short) ((r + 0.5) * Math.sin(Math.PI * a / (4 * r1)));+ x = (short) ((r + 0.5) * Math.cos(RasterPlotter.PI4 * a / r1));+ y = (short) ((r + 0.5) * Math.sin(RasterPlotter.PI4 * a / r1));co = x + "|" + y;if (!(crds.contains(co))) {crc.add(new short[]{x, y});diff --git a/source/net/yacy/visualization/GraphPlotter.java b/source/net/yacy/visualization/GraphPlotter.javaindex 5731bfc53..6db6eb919 100644--- a/source/net/yacy/visualization/GraphPlotter.java+++ b/source/net/yacy/visualization/GraphPlotter.java@@ -103,9 +103,6 @@ public class GraphPlotter implements Cloneable {}}- private final static double p2 = Math.PI / 2.0;- private final static double p23 = p2 * 3.0;-public static void force(Point calcPoint, Point currentPoint, Point otherPoint, Ribbon r) {double dx = otherPoint.x - currentPoint.x;double dy = otherPoint.y - currentPoint.y;@@ -121,10 +118,10 @@ public class GraphPlotter implements Cloneable {assert !(!attraction && a < Math.PI) || y1 <= 0 : "attraction = " + attraction + ", a = " + a + ", y1 = " + y1;assert !(attraction && a > Math.PI) || y1 <= 0 : "attraction = " + attraction + ", a = " + a + ", y1 = " + y1;assert !(!attraction && a > Math.PI) || y1 >= 0 : "attraction = " + attraction + ", a = " + a + ", y1 = " + y1;- assert !(attraction && (a < p2 || a > p23)) || x1 >= 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;- assert !(!attraction && (a < p2 || a > p23)) || x1 <= 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;- assert !(attraction && !(a < p2 || a > p23)) || x1 <= 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;- assert !(!attraction && !(a < p2 || a > p23)) || x1 >= 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;+ assert !(attraction && (a < RasterPlotter.PI2 || a > RasterPlotter.PI32)) || x1 >= 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;+ assert !(!attraction && (a < RasterPlotter.PI2 || a > RasterPlotter.PI32)) || x1 <= 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;+ assert !(attraction && !(a < RasterPlotter.PI2 || a > RasterPlotter.PI32)) || x1 <= 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;+ assert !(!attraction && !(a < RasterPlotter.PI2 || a > RasterPlotter.PI32)) || x1 >= 0 : "attraction = " + attraction + ", a = " + a + ", x1 = " + x1;calcPoint.x += x1;calcPoint.y += y1;}diff --git a/source/net/yacy/visualization/RasterPlotter.java b/source/net/yacy/visualization/RasterPlotter.javaindex 4f21f4d1e..1494c6a75 100644--- a/source/net/yacy/visualization/RasterPlotter.java+++ b/source/net/yacy/visualization/RasterPlotter.java@@ -4,10 +4,6 @@//// This is a part of YaCy, a peer-to-peer based web search engine//-// $LastChangedDate$-// $LastChangedRevision$-// $LastChangedBy$-//// LICENSE//// This program is free software; you can redistribute it and/or modify@@ -46,7 +42,6 @@ import java.awt.image.DataBufferByte;import java.awt.image.Raster;import java.awt.image.WritableRaster;import java.io.BufferedOutputStream;-import java.io.ByteArrayOutputStream;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;@@ -66,6 +61,10 @@ public class RasterPlotter {public final Log log = new Log("RasterPlotter");public static final double PI180 = Math.PI / 180.0d;+ public static final double PI4 = Math.PI / 4.0d;+ public static final double PI2 = Math.PI / 2.0d;+ public static final double PI32 = PI2 * 3.0d;+ public static final double TL = Math.sqrt(3) / 2;// colors regarding RGB Color Modelpublic static final long RED = 0xFF0000;@@ -380,9 +379,6 @@ public class RasterPlotter {line(x2, y2, xt, yt, 100); // left lineline(x3, y3, xt, yt, 100); // right line}-- private final static double TL = Math.sqrt(3) / 2;- private final static double PI2 = Math.PI / 2;public int[] getColor(final int x, final int y) {final int[] c = new int[3];@@ -836,10 +832,9 @@ public class RasterPlotter {int i = 0;for (int row = 0; row < height; row++) {compBytes.write(0);- for (int column = 0; column < width; column++) {- compBytes.write(frame, i, 3); // this replaces the whole PixelGrabber process which makes it probably more than 800x faster. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4835595- i += 3;- }+ // this replaces the whole PixelGrabber process which makes it probably more than 800x faster. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4835595+ compBytes.write(frame, i, 3 * width);+ i += 3 * width;}compBytes.close();