##// END OF EJS Templates
Mesh generation for QColorMap (1)...
Alexandre Leroux -
r1033:c3f3d046e003
parent child
Show More
@@ -12,6 +12,52 Q_DECLARE_LOGGING_CATEGORY(LOG_DataSeriesUtils)
12 12 */
13 13 struct SCIQLOP_CORE_EXPORT DataSeriesUtils {
14 14 /**
15 * Define a meshs.
16 *
17 * A mesh is a regular grid representing cells of the same width (in x) and of the same height
18 * (in y). At each mesh point is associated a value.
19 *
20 * Each axis of the mesh is defined by a minimum value, a number of values is a mesh step.
21 * For example: if min = 1, nbValues = 5 and step = 2 => the axis of the mesh will be [1, 3, 5,
22 * 7, 9].
23 *
24 * The values are defined in an array of size {nbX * nbY}. The data is stored along the X axis.
25 *
26 * For example, the mesh:
27 * Y = 2 [ 7 ; 8 ; 9
28 * Y = 1 4 ; 5 ; 6
29 * Y = 0 1 ; 2 ; 3 ]
30 * X = 0 X = 1 X = 2
31 *
32 * will be represented by data [1, 2, 3, 4, 5, 6, 7, 8, 9]
33 */
34 struct Mesh {
35 explicit Mesh() = default;
36 explicit Mesh(int nbX, double xMin, double xStep, int nbY, double yMin, double yStep)
37 : m_NbX{nbX},
38 m_XMin{xMin},
39 m_XStep{xStep},
40 m_NbY{nbY},
41 m_YMin{yMin},
42 m_YStep{yStep},
43 m_Data(nbX * nbY)
44 {
45 }
46
47 inline bool isEmpty() const { return m_Data.size() == 0; }
48 inline double xMax() const { return m_XMin + (m_NbX - 1) * m_XStep; }
49 inline double yMax() const { return m_YMin + (m_NbY - 1) * m_YStep; }
50
51 int m_NbX{0};
52 double m_XMin{};
53 double m_XStep{};
54 int m_NbY{0};
55 double m_YMin{};
56 double m_YStep{};
57 std::vector<double> m_Data{};
58 };
59
60 /**
15 61 * Represents a resolution used to generate the data of a mesh on the x-axis or in Y.
16 62 *
17 63 * A resolution is represented by a value and flag indicating if it's in the logarithmic scale
General Comments 0
You need to be logged in to leave comments. Login now