Commit abde9227 authored by vigmond's avatar vigmond

new Purple-orange divergent colour scale

parent 3fd4b072
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
meshalyzer uses a vMAJOR.PATCH versioning scheme. We increase the
* MAJOR version when we add functionality, and the
* PATCH version when we make backwards compatible bug fixes
## [2.0] - 2020-28-06
- manipulation of meshes improved by completely rewriting rendering to use Vertex Buffer Objects
- Lighting
- lighting direction controlled by trackball
- better control of object coloring
- eye and world lighting direction specification
- reverse direction button
- Clipping
- plane selection radio buttons removed (just click)
- copy/paste of orientations
- choose screen plane as clipping plane
- Adjacent `Ln` elements in `.elem` file which share endpoints are joined in 3D
- Isolines
- When rendered in 3D, lines are formed with smoothly joined segments
- filtering by coalescing close points
- `match colors` button to match isolines with the number of colour used to display mesh data
- more PNG metadata added for auxgrids and vector data
- axes drawn as coloured 3D cylinders
- vertex selection only possible when vertices are displayed
- Purple-orange divergent colour scale added
## [1.0] - 2020-23-06
- Initial and final release for immediate mode OpenGL rendering (pre 3.3)
## meshalyzer contributors
* Edward Vigmond
* Aurel Neic
* Anton Prassl
* Brock Tice
* Ed Vigmond
* Gio De Francesco
* Robert Blake
......@@ -21,6 +21,101 @@ void Colourscale :: calibrate( double tmin, double tmax )
b = 1.;
}
}
/** python code to get colour table:
* from matplotlib import cm
* cmap = cm.get_cmap("PuOr")
* for a in range(256):
* print('{{{0[0]:.4}, {0[1]:.4}, {0[2]:.4}}},'.format(cmap(a/255.)))
*/
float PuOr[][3] = {
{0.498, 0.2314, 0.03137}, {0.506, 0.2358, 0.03106}, {0.514, 0.2403, 0.03076},
{0.522, 0.2448, 0.03045}, {0.53, 0.2492, 0.03014}, {0.538, 0.2537, 0.02983},
{0.546, 0.2581, 0.02953}, {0.554, 0.2626, 0.02922}, {0.562, 0.2671, 0.02891},
{0.57, 0.2715, 0.0286}, {0.578, 0.276, 0.0283}, {0.586, 0.2804, 0.02799},
{0.594, 0.2849, 0.02768}, {0.602, 0.2894, 0.02737}, {0.61, 0.2938, 0.02707},
{0.618, 0.2983, 0.02676}, {0.626, 0.3027, 0.02645}, {0.634, 0.3072, 0.02614},
{0.642, 0.3116, 0.02584}, {0.65, 0.3161, 0.02553}, {0.658, 0.3206, 0.02522},
{0.666, 0.325, 0.02491}, {0.674, 0.3295, 0.02461}, {0.682, 0.3339, 0.0243},
{0.69, 0.3384, 0.02399}, {0.698, 0.3429, 0.02368}, {0.7054, 0.3483, 0.02461},
{0.7123, 0.3548, 0.02676}, {0.7193, 0.3612, 0.02891}, {0.7262, 0.3677, 0.03106},
{0.7331, 0.3742, 0.03322}, {0.74, 0.3806, 0.03537}, {0.7469, 0.3871, 0.03752},
{0.7539, 0.3935, 0.03968}, {0.7608, 0.4, 0.04183}, {0.7677, 0.4065, 0.04398},
{0.7746, 0.4129, 0.04614}, {0.7815, 0.4194, 0.04829}, {0.7885, 0.4258, 0.05044},
{0.7954, 0.4323, 0.0526}, {0.8023, 0.4388, 0.05475}, {0.8092, 0.4452, 0.0569},
{0.8161, 0.4517, 0.05905}, {0.8231, 0.4581, 0.06121}, {0.83, 0.4646, 0.06336},
{0.8369, 0.471, 0.06551}, {0.8438, 0.4775, 0.06767}, {0.8507, 0.484, 0.06982},
{0.8577, 0.4904, 0.07197}, {0.8646, 0.4969, 0.07413}, {0.8715, 0.5033, 0.07628},
{0.8784, 0.5098, 0.07843}, {0.8829, 0.5181, 0.09058}, {0.8874, 0.5264, 0.1027},
{0.8918, 0.5347, 0.1149}, {0.8963, 0.543, 0.127}, {0.9007, 0.5513, 0.1392},
{0.9052, 0.5596, 0.1513}, {0.9097, 0.5679, 0.1635}, {0.9141, 0.5762, 0.1756},
{0.9186, 0.5845, 0.1878}, {0.923, 0.5928, 0.1999}, {0.9275, 0.6012, 0.2121},
{0.9319, 0.6095, 0.2242}, {0.9364, 0.6178, 0.2364}, {0.9409, 0.6261, 0.2485},
{0.9453, 0.6344, 0.2607}, {0.9498, 0.6427, 0.2728}, {0.9542, 0.651, 0.285},
{0.9587, 0.6593, 0.2971}, {0.9632, 0.6676, 0.3093}, {0.9676, 0.6759, 0.3214},
{0.9721, 0.6842, 0.3336}, {0.9765, 0.6925, 0.3457}, {0.981, 0.7008, 0.3579},
{0.9855, 0.7091, 0.37}, {0.9899, 0.7174, 0.3822}, {0.9922, 0.7246, 0.3946},
{0.9924, 0.7308, 0.4074}, {0.9925, 0.7369, 0.4201}, {0.9927, 0.7431, 0.4329},
{0.9928, 0.7493, 0.4457}, {0.993, 0.7554, 0.4584}, {0.9932, 0.7616, 0.4712},
{0.9933, 0.7677, 0.484}, {0.9935, 0.7739, 0.4967}, {0.9936, 0.78, 0.5095},
{0.9938, 0.7862, 0.5223}, {0.9939, 0.7923, 0.535}, {0.9941, 0.7985, 0.5478},
{0.9942, 0.8046, 0.5606}, {0.9944, 0.8108, 0.5733}, {0.9945, 0.8169, 0.5861},
{0.9947, 0.8231, 0.5988}, {0.9948, 0.8292, 0.6116}, {0.995, 0.8354, 0.6244},
{0.9952, 0.8415, 0.6371}, {0.9953, 0.8477, 0.6499}, {0.9955, 0.8538, 0.6627},
{0.9956, 0.86, 0.6754}, {0.9958, 0.8661, 0.6882}, {0.9959, 0.8723, 0.701},
{0.9961, 0.8784, 0.7137}, {0.995, 0.882, 0.7237}, {0.9939, 0.8855, 0.7337},
{0.9928, 0.889, 0.7437}, {0.9918, 0.8926, 0.7537}, {0.9907, 0.8961, 0.7637},
{0.9896, 0.8997, 0.7737}, {0.9885, 0.9032, 0.7837}, {0.9875, 0.9067, 0.7937},
{0.9864, 0.9103, 0.8037}, {0.9853, 0.9138, 0.8137}, {0.9842, 0.9173, 0.8237},
{0.9832, 0.9209, 0.8337}, {0.9821, 0.9244, 0.8437}, {0.981, 0.928, 0.8537},
{0.9799, 0.9315, 0.8637}, {0.9789, 0.935, 0.8737}, {0.9778, 0.9386, 0.8837},
{0.9767, 0.9421, 0.8937}, {0.9756, 0.9456, 0.9037}, {0.9745, 0.9492, 0.9136},
{0.9735, 0.9527, 0.9236}, {0.9724, 0.9562, 0.9336}, {0.9713, 0.9598, 0.9436},
{0.9702, 0.9633, 0.9536}, {0.9692, 0.9669, 0.9636}, {0.9662, 0.9664, 0.9677},
{0.9615, 0.9619, 0.9659}, {0.9567, 0.9575, 0.964}, {0.9519, 0.953, 0.9622},
{0.9472, 0.9486, 0.9603}, {0.9424, 0.9441, 0.9585}, {0.9376, 0.9396, 0.9566},
{0.9329, 0.9352, 0.9548}, {0.9281, 0.9307, 0.9529}, {0.9233, 0.9263, 0.9511},
{0.9186, 0.9218, 0.9493}, {0.9138, 0.9173, 0.9474}, {0.909, 0.9129, 0.9456},
{0.9043, 0.9084, 0.9437}, {0.8995, 0.904, 0.9419}, {0.8947, 0.8995, 0.94},
{0.89, 0.895, 0.9382}, {0.8852, 0.8906, 0.9363}, {0.8804, 0.8861, 0.9345},
{0.8757, 0.8817, 0.9326}, {0.8709, 0.8772, 0.9308}, {0.8661, 0.8727, 0.929},
{0.8614, 0.8683, 0.9271}, {0.8566, 0.8638, 0.9253}, {0.8518, 0.8594, 0.9234},
{0.8471, 0.8549, 0.9216}, {0.8412, 0.8477, 0.9177}, {0.8354, 0.8404, 0.9139},
{0.8295, 0.8332, 0.91}, {0.8237, 0.826, 0.9062}, {0.8178, 0.8188, 0.9023},
{0.812, 0.8115, 0.8985}, {0.8062, 0.8043, 0.8947}, {0.8003, 0.7971, 0.8908},
{0.7945, 0.7899, 0.887}, {0.7886, 0.7826, 0.8831}, {0.7828, 0.7754, 0.8793},
{0.7769, 0.7682, 0.8754}, {0.7711, 0.7609, 0.8716}, {0.7652, 0.7537, 0.8677},
{0.7594, 0.7465, 0.8639}, {0.7536, 0.7393, 0.8601}, {0.7477, 0.732, 0.8562},
{0.7419, 0.7248, 0.8524}, {0.736, 0.7176, 0.8485}, {0.7302, 0.7103, 0.8447},
{0.7243, 0.7031, 0.8408}, {0.7185, 0.6959, 0.837}, {0.7126, 0.6887, 0.8331},
{0.7068, 0.6814, 0.8293}, {0.701, 0.6742, 0.8255}, {0.6942, 0.6663, 0.8206},
{0.6865, 0.6577, 0.8148}, {0.6788, 0.6491, 0.8089}, {0.6711, 0.6404, 0.8031},
{0.6634, 0.6318, 0.7972}, {0.6557, 0.6232, 0.7914}, {0.6481, 0.6146, 0.7855},
{0.6404, 0.606, 0.7797}, {0.6327, 0.5974, 0.7739}, {0.625, 0.5888, 0.768},
{0.6173, 0.5802, 0.7622}, {0.6096, 0.5715, 0.7563}, {0.6019, 0.5629, 0.7505},
{0.5942, 0.5543, 0.7446}, {0.5865, 0.5457, 0.7388}, {0.5789, 0.5371, 0.7329},
{0.5712, 0.5285, 0.7271}, {0.5635, 0.5199, 0.7213}, {0.5558, 0.5113, 0.7154},
{0.5481, 0.5027, 0.7096}, {0.5404, 0.494, 0.7037}, {0.5327, 0.4854, 0.6979},
{0.525, 0.4768, 0.692}, {0.5173, 0.4682, 0.6862}, {0.5097, 0.4596, 0.6804},
{0.502, 0.451, 0.6745}, {0.4952, 0.4393, 0.669}, {0.4884, 0.4276, 0.6634},
{0.4817, 0.4159, 0.6579}, {0.4749, 0.4042, 0.6524}, {0.4681, 0.3925, 0.6468},
{0.4614, 0.3809, 0.6413}, {0.4546, 0.3692, 0.6358}, {0.4478, 0.3575, 0.6302},
{0.4411, 0.3458, 0.6247}, {0.4343, 0.3341, 0.6191}, {0.4275, 0.3224, 0.6136},
{0.4208, 0.3107, 0.6081}, {0.414, 0.299, 0.6025}, {0.4072, 0.2874, 0.597},
{0.4005, 0.2757, 0.5915}, {0.3937, 0.264, 0.5859}, {0.3869, 0.2523, 0.5804},
{0.3802, 0.2406, 0.5749}, {0.3734, 0.2289, 0.5693}, {0.3666, 0.2172, 0.5638},
{0.3599, 0.2055, 0.5582}, {0.3531, 0.1938, 0.5527}, {0.3463, 0.1822, 0.5472},
{0.3396, 0.1705, 0.5416}, {0.3328, 0.1588, 0.5361}, {0.3264, 0.1499, 0.5286},
{0.3204, 0.1439, 0.5193}, {0.3144, 0.1379, 0.5099}, {0.3084, 0.1319, 0.5005},
{0.3024, 0.126, 0.4911}, {0.2964, 0.12, 0.4817}, {0.2904, 0.114, 0.4724},
{0.2844, 0.108, 0.463}, {0.2784, 0.102, 0.4536}, {0.2724, 0.09596, 0.4442},
{0.2664, 0.08997, 0.4348}, {0.2604, 0.08397, 0.4255}, {0.2544, 0.07797, 0.4161},
{0.2484, 0.07197, 0.4067}, {0.2424, 0.06597, 0.3973}, {0.2364, 0.05998, 0.3879},
{0.2304, 0.05398, 0.3785}, {0.2245, 0.04798, 0.3692}, {0.2185, 0.04198, 0.3598},
{0.2125, 0.03599, 0.3504}, {0.2065, 0.02999, 0.341}, {0.2005, 0.02399, 0.3316},
{0.1945, 0.01799, 0.3223}, {0.1885, 0.012, 0.3129}, {0.1825, 0.005998, 0.3035},
{0.1765, 0.0, 0.2941}
};
int viridis[][3] = {
{ 68, 1, 84 }, { 68, 2, 85 }, { 68, 3, 87 }, { 69, 5, 88 },
......@@ -516,23 +611,32 @@ void Colourscale :: scale( CScale_t cs )
}
break;
case CS_DISTINCT:
// cheap Latin Hypercube Sampling of RGB colorspace
srand(1);
const float min_br = 0.1;
const float max_br = 1.;
vector<float> rgb[3];
for ( i = 0; i < 3; i++ )
rgb[i].resize(n);
for ( i = 0; i < n; i++ )
rgb[0][i] = rgb[1][i] = rgb[2][i] = min_br + (max_br-min_br)/n*(i+0.5);
for ( i=0; i<n; i++ ) {
for( int j=0; j<3; j++ ) {
int ri = rand()%(n-i);
cmap[i][j] = rgb[j][ri];
rgb[j].erase(rgb[j].begin()+ri);
{
// cheap Latin Hypercube Sampling of RGB colorspace
srand(1);
const float min_br = 0.1;
const float max_br = 1.;
vector<float> rgb[3];
for ( i = 0; i < 3; i++ )
rgb[i].resize(n);
for ( i = 0; i < n; i++ )
rgb[0][i] = rgb[1][i] = rgb[2][i] = min_br + (max_br-min_br)/n*(i+0.5);
for ( i=0; i<n; i++ ) {
for( int j=0; j<3; j++ ) {
int ri = rand()%(n-i);
cmap[i][j] = rgb[j][ri];
rgb[j].erase(rgb[j].begin()+ri);
}
}
}
break;
case CS_PuOr:
for ( i = 0; i < n; i++ ) {
cmap[i][0] = ((float) PuOr[INTERP(i,n-1,255)][0] );
cmap[i][1] = ((float) PuOr[INTERP(i,n-1,255)][1] );
cmap[i][2] = ((float) PuOr[INTERP(i,n-1,255)][2] );
}
break;
}
}
#undef INTERP
......
......@@ -20,7 +20,7 @@
typedef enum {
CS_HOT, CS_GREY, CS_RGREY, CS_GGREY, CS_BGREY, CS_RAINBOW, CS_BL_RAINBOW,
CS_COLD_HOT, CS_CG, CS_MATLAB_REV, CS_MATLAB, CS_ACID, CS_P2G, CS_VIRIDIS,
CS_VIRIDIS_LIGHT, CS_MAGMA, CS_INFERNO, CS_DISTINCT
CS_VIRIDIS_LIGHT, CS_MAGMA, CS_INFERNO, CS_DISTINCT, CS_PuOr
} CScale_t;
typedef enum {
......
/* XPM */
static char *PuOr[] = {
/* columns rows colors chars-per-pixel */
"70 15 70 1 ",
" c #7F3B08",
". c #2D004B",
"X c #340755",
"o c #3A0D5F",
"O c #3F1267",
"+ c #451870",
"@ c #4A1D79",
"# c #863F08",
"$ c #8D4307",
"% c #954807",
"& c #9D4B07",
"* c #A45006",
"= c #AC5406",
"- c #B35806",
"; c #B95E08",
": c #BF640A",
"> c #C76A0C",
", c #CD700E",
"< c #D37610",
"1 c #DA7C12",
"2 c #E08215",
"3 c #E48A1F",
"4 c #E8922B",
"5 c #ED9936",
"6 c #F1A141",
"7 c #F5A94D",
"8 c #F9B058",
"9 c #FCB863",
"0 c #FDBE6F",
"q c #FDC57F",
"w c #502282",
"e c #552A89",
"r c #5C348F",
"t c #623F94",
"y c #694A99",
"u c #6F559E",
"i c #7660A4",
"p c #7C6BA8",
"a c #8275AE",
"s c #897DB3",
"d c #9185B9",
"f c #988DBE",
"g c #FDCB8B",
"h c #FED197",
"j c #FED6A2",
"k c #FEDCAE",
"l c #FDE1B9",
"z c #9E96C3",
"x c #A69EC9",
"c c #ADA5CF",
"v c #B4ADD4",
"b c #B9B4D6",
"n c #BFBBDA",
"m c #C5C3DE",
"M c #FDE4C3",
"N c #FCE7CC",
"B c #FBEBD5",
"V c #FAEFDE",
"C c #CBCAE2",
"Z c #D0D1E6",
"A c #D6D8EA",
"S c #DBDDEC",
"D c #DFE1EE",
"F c #F9F2E7",
"G c #E4E5F0",
"H c #E8E9F2",
"J c #ECEDF3",
"K c #F1F2F4",
"L c #F5F5F6",
"P c #F8F5F1",
/* pixels */
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX.",
" #$%&*=-;:>,<1234567890qghjklMNBVFPLKJHGDSAZCmnbvcxzfdsapiuytrew@+OoX."
};
......@@ -116,7 +116,7 @@ class Controls {open
} {
Fl_Window window {
label {Meshalyzer Controls} open
xywh {802 64 350 705} type Double box UP_BOX
xywh {971 70 350 705} type Double box UP_BOX
code0 {\#include <FL/Fl_Color_Chooser.H>}
code1 {\#include "VecData.h"} visible
} {
......@@ -124,7 +124,7 @@ class Controls {open
xywh {0 0 350 30} labelcolor 1
} {
Submenu {} {
label File open
label File
xywh {0 0 100 20}
} {
MenuItem {} {
......@@ -909,7 +909,7 @@ reglist->do_callback();}
xywh {10 270 330 260} align 0
} {
Fl_Group hilightgrp {
label Highlight selected
label Highlight
xywh {10 305 330 225} color 11 labelfont 1 labelsize 12 labelcolor 121 align 4
} {
Fl_Value_Input tethi {
......@@ -1950,7 +1950,7 @@ mwtb->redraw();}
}
}
}
Fl_Group colorscalegrp {
Fl_Group colorscalegrp {open
xywh {10 535 330 70} box ENGRAVED_BOX when 0
code0 {\#include "ColourGroup.h"}
class ColourGroup
......@@ -1986,7 +1986,7 @@ mwtb->redraw(VBO_Colour);}
tooltip {autoscale every timestep} xywh {35 575 55 20} labelsize 12 align 16
}
Fl_Choice cstype {
label {colour scale}
label {colour scale} open
xywh {230 540 105 25} down_box BORDER_BOX labelsize 10 align 2
code0 {\#include "Colourscale.h"}
code1 {o->value(1);}
......@@ -2077,6 +2077,12 @@ mwtb->redraw(VBO_Colour|VBO_Isoline_Color);}
mwtb->redraw(VBO_Colour|VBO_Isoline_Color);}
tooltip Qualitative image {images/distinct.xpm} xywh {0 0 33 21}
}
MenuItem {} {
label PurpleOrange
callback {mwtb->cs->scale(CS_PuOr);
mwtb->redraw(VBO_Colour|VBO_Isoline_Color);} selected
image {images/PuOr.xpm} xywh {0 0 33 21}
}
}
Fl_Button {} {
callback {mwtb->SendColourSyncMessage();}
......@@ -2184,7 +2190,7 @@ for( auto &p : recentLst ) {
if( p.first[0] != '/' ) {
mfname.clear();
for( auto c : p.first ) {
if( c == '/' ) mfname.append( string("\\\\") );
//if( c == '/' ) mfname.append( string("\\") );
mfname.append( &c, 1 );
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment