@@ -1135,128 +1135,6 @@ EbsdLib::UInt8ArrayType::Pointer CubicLowOps::generateIPFTriangleLegend(int imag
1135
1135
return image;
1136
1136
}
1137
1137
1138
- // -----------------------------------------------------------------------------
1139
- //
1140
- // -----------------------------------------------------------------------------
1141
- EbsdLib::Rgb CubicLowOps::generateMisorientationColor (const QuatD& q, const QuatD& refFrame) const
1142
- {
1143
- throw std::out_of_range (" generateMisorientationColor::generateMisorientationColor NOT Implemented" );
1144
-
1145
- // double n1, n2, n3, w;
1146
- double x, x1, x2, x3, x4;
1147
- double y, y1, y2, y3, y4;
1148
- double z, z1, z2, z3, z4;
1149
- double k, h, s, v, c, r, g, b;
1150
-
1151
- QuatD q1 = q;
1152
- QuatD q2 = refFrame;
1153
-
1154
- OrientationD axisAngle = calculateMisorientation (q1, q2);
1155
-
1156
- // eq c7.1
1157
- k = tan (axisAngle[3 ] / 2.0 );
1158
- x = axisAngle[0 ];
1159
- y = axisAngle[1 ];
1160
- z = axisAngle[2 ];
1161
- OrientationType rod (x, y, z, k);
1162
- rod = getMDFFZRod (rod);
1163
- x = rod[0 ];
1164
- y = rod[1 ];
1165
- z = rod[2 ];
1166
- k = rod[3 ];
1167
-
1168
- // eq c7.2
1169
- k = atan2 (y, x);
1170
- if (k < M_PI_4)
1171
- {
1172
- x1 = z;
1173
- y1 = x;
1174
- z1 = y;
1175
- }
1176
- else
1177
- {
1178
- x1 = y;
1179
- y1 = z;
1180
- z1 = x;
1181
- }
1182
-
1183
- // eq c7.3
1184
- // 3 rotation matricies (in paper) can be multiplied into one (here) for simplicity / speed
1185
- // g1*g2*g3 = {{sqrt(2/3), 0, 1/sqrt(3)},{-1/sqrt(6), 1/sqrt(2), 1/sqrt(3)},{-1/sqrt(6), 1/sqrt(2), 1/sqrt(3)}}
1186
- x2 = x1 * sqrt (2 .0f / 3.0 ) - (y1 + z1) / sqrt (6.0 );
1187
- y2 = (y1 - z1) / sqrt (2.0 );
1188
- z2 = (x1 + y1 + z1) / sqrt (3.0 );
1189
-
1190
- // eq c7.4
1191
- k = (sqrt (3.0 ) * y2 + x2) / (2 .0f * pow (x2 * x2 + y2 * y2, 1 .5f ));
1192
- x3 = x2 * (x2 + sqrt (3.0 ) * y2) * (x2 - sqrt (3.0 ) * y2) * k;
1193
- y3 = y2 * (y2 + sqrt (3.0 ) * x2) * (sqrt (3.0 ) * x2 - y2) * k;
1194
- z3 = z2 * sqrt (3.0 );
1195
-
1196
- // eq c7.5 these hsv are from 0 to 1 in cartesian coordinates
1197
- x4 = -x3;
1198
- y4 = -y3;
1199
- z4 = z3;
1200
-
1201
- // convert to traditional hsv (0-1)
1202
- h = fmod (atan2 (y4, x4) + 2 .0f * M_PI, 2 .0f * M_PI) / (2 .0f * M_PI);
1203
- s = sqrt (x4 * x4 + y4 * y4);
1204
- v = z4;
1205
- if (v > 0 )
1206
- {
1207
- s = s / v;
1208
- }
1209
-
1210
- // hsv to rgb (from wikipedia hsv/hsl page)
1211
- c = v * s;
1212
- k = c * (1 - fabs (fmod (h * 6 , 2 ) - 1 )); // x in wiki article
1213
- h = h * 6 ;
1214
- r = 0 ;
1215
- g = 0 ;
1216
- b = 0 ;
1217
-
1218
- if (h >= 0 )
1219
- {
1220
- if (h < 1 )
1221
- {
1222
- r = c;
1223
- g = k;
1224
- }
1225
- else if (h < 2 )
1226
- {
1227
- r = k;
1228
- g = c;
1229
- }
1230
- else if (h < 3 )
1231
- {
1232
- g = c;
1233
- b = k;
1234
- }
1235
- else if (h < 4 )
1236
- {
1237
- g = k;
1238
- b = c;
1239
- }
1240
- else if (h < 5 )
1241
- {
1242
- r = k;
1243
- b = c;
1244
- }
1245
- else if (h < 6 )
1246
- {
1247
- r = c;
1248
- b = k;
1249
- }
1250
- }
1251
-
1252
- // adjust lumosity and invert
1253
- r = (r + (v - c));
1254
- g = (g + (v - c));
1255
- b = (b + (v - c));
1256
-
1257
- return EbsdLib::RgbColor::dRgb (static_cast <int32_t >(r * 255 ), static_cast <int32_t >(g * 255 ), static_cast <int32_t >(b * 255 ), 255 );
1258
- }
1259
-
1260
1138
// -----------------------------------------------------------------------------
1261
1139
CubicLowOps::Pointer CubicLowOps::NullPointer ()
1262
1140
{
0 commit comments