Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

another circle computation enhancement

orbiter0f425e01ca0c
diff --git a/source/net/yacy/visualization/CircleTool.java b/source/net/yacy/visualization/CircleTool.java
index 2014c42a7..0958f7c50 100644
--- a/source/net/yacy/visualization/CircleTool.java
+++ b/source/net/yacy/visualization/CircleTool.java
@@ -59,16 +59,19 @@ public class CircleTool {
for (short r = (short) circles.size(); r < rc; r++) {
r1 = (short) (r + 1);
crc = new ArrayList<>();
- for (short a = 0; a < 2 * (r + 1); a++) {
- x = (short) (r1 * Math.cos(RasterPlotter.PI4 * a / r1));
- y = (short) (r1 * Math.sin(RasterPlotter.PI4 * a / r1));
+ for (short a = 0; a < 2 * r1; a++) {
+ double h = RasterPlotter.PI4 * a / r1;
+ double cosh = Math.cos(h);
+ double sinh = Math.sin(h);
+ x = (short) (r1 * cosh);
+ y = (short) (r1 * sinh);
co = x << 16 | y;
if (!(crds.contains(co))) {
crc.add(co);
crds.add(co);
}
- x = (short) ((r + 0.5) * Math.cos(RasterPlotter.PI4 * a / r1));
- y = (short) ((r + 0.5) * Math.sin(RasterPlotter.PI4 * a / r1));
+ x = (short) ((r + 0.5) * cosh);
+ y = (short) ((r + 0.5) * sinh);
co = x << 16 | y;
if (!(crds.contains(co))) {
crc.add(co);