From 0f425e01ca0c9bcdc0477b1126bc12b5f67e783d Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 13 May 2014 21:30:47 +0200 Subject: [PATCH] another circle computation enhancement --- source/net/yacy/visualization/CircleTool.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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);