| 18 | // Transform::Transform() = default; |
| 19 | |
| 20 | bool Transform::mapTypeToCartesian(const DatapickerImage::ReferencePoints& axisPoints) { |
| 21 | switch (axisPoints.type) { |
| 22 | case DatapickerImage::GraphType::LnX: { |
| 23 | for (int i = 0; i < 3; ++i) { |
| 24 | if (axisPoints.logicalPos[i].x() <= 0) |
| 25 | return false; |
| 26 | x[i] = log(axisPoints.logicalPos[i].x()); |
| 27 | y[i] = axisPoints.logicalPos[i].y(); |
| 28 | } |
| 29 | break; |
| 30 | } |
| 31 | case DatapickerImage::GraphType::LnY: { |
| 32 | for (int i = 0; i < 3; ++i) { |
| 33 | if (axisPoints.logicalPos[i].y() <= 0) |
| 34 | return false; |
| 35 | x[i] = axisPoints.logicalPos[i].x(); |
| 36 | y[i] = log(axisPoints.logicalPos[i].y()); |
| 37 | } |
| 38 | break; |
| 39 | } |
| 40 | case DatapickerImage::GraphType::LnXY: { |
| 41 | for (int i = 0; i < 3; ++i) { |
| 42 | if (axisPoints.logicalPos[i].x() <= 0) |
| 43 | return false; |
| 44 | x[i] = log(axisPoints.logicalPos[i].x()); |
| 45 | y[i] = log(axisPoints.logicalPos[i].y()); |
| 46 | } |
| 47 | break; |
| 48 | } |
| 49 | case DatapickerImage::GraphType::Log10X: { |
| 50 | for (int i = 0; i < 3; ++i) { |
| 51 | if (axisPoints.logicalPos[i].x() <= 0) |
| 52 | return false; |
| 53 | x[i] = log10(axisPoints.logicalPos[i].x()); |
| 54 | y[i] = axisPoints.logicalPos[i].y(); |
| 55 | } |
| 56 | break; |
| 57 | } |
| 58 | case DatapickerImage::GraphType::Log10Y: { |
| 59 | for (int i = 0; i < 3; ++i) { |
| 60 | if (axisPoints.logicalPos[i].y() <= 0) |
| 61 | return false; |
| 62 | x[i] = axisPoints.logicalPos[i].x(); |
| 63 | y[i] = log10(axisPoints.logicalPos[i].y()); |
| 64 | } |
| 65 | break; |
| 66 | } |
| 67 | case DatapickerImage::GraphType::Log10XY: { |
| 68 | for (int i = 0; i < 3; ++i) { |
| 69 | if (axisPoints.logicalPos[i].x() <= 0) |
| 70 | return false; |
| 71 | x[i] = log10(axisPoints.logicalPos[i].x()); |
| 72 | y[i] = log10(axisPoints.logicalPos[i].y()); |
| 73 | } |
| 74 | break; |
| 75 | } |
| 76 | case DatapickerImage::GraphType::PolarInDegree: { |
| 77 | for (int i = 0; i < 3; ++i) { |