Colour the median line in the voronoi frequency graph purple

It's both a quartile line (red) and a 10-percentile line (blue)
master
Treer 2018-06-17 00:41:31 +10:00
parent 2173935d81
commit e4adcb5308
2 changed files with 37 additions and 14 deletions

View File

@ -53,7 +53,7 @@ public class FrequencyGraph {
// No math here, these minDist values for band thicknesses were set by trial/eyeballing
double minDistRed = 0.0000017;
double minDistBlue = 0.000001;
double minDistBlue = 0.0000010;
double minDistBase = 0.00000001;
// the 0.01 percentile is the lowest the ClimateHistogram lookup tables store values for.
@ -104,7 +104,27 @@ public class FrequencyGraph {
distance = Math.abs(frequency - histogram2d.frequencyAtPercentile(percentile));
if (distance <= minDistRed) {
// Draw a quartile boundary line here.
if (percentile == 50) {
// Need to draw both a quartile line here, and a 10-percentile line.
// Colour it purple.
graph.setRGB(x, y, 0x000C000FF | (255 - (int)Math.round((255 * distance) / minDistRed)) << 24);
/*
// A dotted line that alternates between blue and red
// trying to make a dotted circle while avoiding sin() or cos() ;)
int absX = (int)Math.abs(x - xMean);
int absY = (int)Math.abs(y - yMean);
int travel = Math.abs((absX < absY) ? absX - (absY / 2) : absY - (absX / 2));
//int travel = Math.abs((absX < absY) ? absX : absY);
if(((travel / 10) & 1) > 0) {
graph.setRGB(x, y, 0x00FF3030 | (255 - (int)Math.round((255 * distance) / minDistRed)) << 24);
} else {
graph.setRGB(x, y, 0x003050FF | (255 - (int)Math.round((255 * distance) / minDistRed)) << 24);
}*/
} else {
graph.setRGB(x, y, 0x00FF3030 | (255 - (int)Math.round((255 * distance) / minDistRed)) << 24);
}
}
} else if ((percentile % 10) == 0) {
distance = Math.abs(frequency - histogram2d.frequencyAtPercentile(percentile));

View File

@ -248,16 +248,19 @@ public class VoronoiWindow implements BiomeProfileUpdateListener, ChangeListener
+ " * Red dotted ring — the practical limit of temperature and humidity. The\r\n"
+ " temperature and humidity in the world falls within this ring 99.99% of\r\n"
+ " the time.\r\n"
+ " * Red solid rings - these indicate the four quartiles. 25% of the world\r\n"
+ " has a temperature and humidity falling outside the outermost quartile\r\n"
+ " ring. The next ring has 50% of the world inside it, and 50% outside.\r\n"
+ " The innermost red ring contains 25% of the world inside it, with 25%\r\n"
+ " between it and the middle ring, etc.\r\n"
+ " * Blue solid rings - these are spaced at 10 percentile intervals. Note\r\n"
+ " that the 50th percentile ring is drawn red, but should also be\r\n"
+ " * Red or purple solid rings - these indicate the four quartiles. 25% of\r\n"
+ " the world has a temperature and humidity falling outside the outermost\r\n"
+ " quartile ring. The next (purple) ring has 50% of the world inside it,\r\n"
+ " and 50% outside. The innermost red ring contains 25% of the world\r\n"
+ " inside it, with 25% between it and the middle ring, etc.\r\n"
+ " * Blue or purple solid rings - these are spaced at 10 percentile\r\n"
+ " intervals.\r\n"
+ " Note the 50th percentile ring is drawn purple, but should also be\r\n"
+ " considered one of the blue rings.\r\n"
+ " * Red dot - the center of the distribution. This is the most common\r\n"
+ " temperature and humidity value\r\n.");
+ " temperature and humidity value.\r\n"
+ " * Purple solid ring - the median, or 50th percentile. 50% of the world is\r\n"
+ " inside this ring and 50% is outside.\n\n");
TextWindow.showMonospace(windowFrame, "Voronoi diagram data", data.toString());
}