MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / hsv

Function hsv

source/matplot/util/colors.cpp:1961–1997  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1959 return result;
1960 }
1961 std::vector<std::vector<double>> hsv(size_t n) {
1962 static std::vector<std::vector<double>> map = {
1963 {1, 0, 0}, {1, 0.09375, 0}, {1, 0.1875, 0},
1964 {1, 0.28125, 0}, {1, 0.375, 0}, {1, 0.46875, 0},
1965 {1, 0.5625, 0}, {1, 0.65625, 0}, {1, 0.75, 0},
1966 {1, 0.84375, 0}, {1, 0.9375, 0}, {0.96875, 1, 0},
1967 {0.875, 1, 0}, {0.78125, 1, 0}, {0.6875, 1, 0},
1968 {0.59375, 1, 0}, {0.5, 1, 0}, {0.40625, 1, 0},
1969 {0.3125, 1, 0}, {0.21875, 1, 0}, {0.125, 1, 0},
1970 {0.03125, 1, 0}, {0, 1, 0.0625}, {0, 1, 0.15625},
1971 {0, 1, 0.25}, {0, 1, 0.34375}, {0, 1, 0.4375},
1972 {0, 1, 0.53125}, {0, 1, 0.625}, {0, 1, 0.71875},
1973 {0, 1, 0.8125}, {0, 1, 0.90625}, {0, 1, 1},
1974 {0, 0.90625, 1}, {0, 0.8125, 1}, {0, 0.71875, 1},
1975 {0, 0.625, 1}, {0, 0.53125, 1}, {0, 0.4375, 1},
1976 {0, 0.34375, 1}, {0, 0.25, 1}, {0, 0.15625, 1},
1977 {0, 0.0625, 1}, {0.03125, 0, 1}, {0.125, 0, 1},
1978 {0.21875, 0, 1}, {0.3125, 0, 1}, {0.40625, 0, 1},
1979 {0.5, 0, 1}, {0.59375, 0, 1}, {0.6875, 0, 1},
1980 {0.78125, 0, 1}, {0.875, 0, 1}, {0.96875, 0, 1},
1981 {1, 0, 0.9375}, {1, 0, 0.84375}, {1, 0, 0.75},
1982 {1, 0, 0.65625}, {1, 0, 0.5625}, {1, 0, 0.46875},
1983 {1, 0, 0.375}, {1, 0, 0.28125}, {1, 0, 0.1875},
1984 {1, 0, 0.09375}};
1985 if (n == 64) {
1986 return map;
1987 }
1988 std::vector<std::vector<double>> result;
1989 for (size_t i = 0; i < n; ++i) {
1990 std::array<float, 4> ac =
1991 colormap_interpolation(static_cast<double>(i), 0.,
1992 static_cast<double>(n - 1), map);
1993 std::vector<double> vc = {ac[1], ac[2], ac[3]};
1994 result.emplace_back(vc);
1995 }
1996 return result;
1997 }
1998 std::vector<std::vector<double>> hot(size_t n) {
1999 static std::vector<std::vector<double>> map = {
2000 {0.0416667, 0, 0}, {0.0833333, 0, 0}, {0.125, 0, 0},

Callers

nothing calls this directly

Calls 1

colormap_interpolationFunction · 0.85

Tested by

no test coverage detected