我已經設法回答我自己的問題!
double[] d65Vals_X = new double[31] { 0.137, 0.676, 1.603, 2.451, 3.418, 3.699, 3.064, 1.933, 0.802, 0.156, 0.039, 0.347, 1.070, 2.170, 3.397, 4.732, 6.070, 7.311, 8.291, 8.634, 8.672, 7.930, 6.446, 4.669, 3.095, 1.859, 1.056, 0.570, 0.274, .0121, 0.058 };
double[] d65Vals_Y = new double[31] { 0.014, 0.069, 0.168, 0.300, 0.554, 0.890, 1.290, 1.838, 2.520, 3.226, 4.320, 5.621, 6.907, 8.059, 8.668, 8.855, 8.581, 7.951, 7.106, 6.004, 5.079, 4.065, 2.999, 2.042, 1.290, 0.746, 0.417, 0.223, 0.107, 0.047, 0.023 };
double[] d65Vals_Z = new double[31] { 0.612, 3.110, 7.627, 12.095, 17.537, 19.888, 17.695, 13.000, 7.699, 3.938, 2.046, 1.049, 0.544, 0.278, 0.122, 0.035, 0.001, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 };
private double FXYZ(double[] REF, int A){
double XYZref = 0;
double illXYZ = 0;
int i;
for (i = 0; i < 31; i++)
{
if (A == 0){
XYZref = XYZref + (REF[i] * d65Vals_X[i]);
illXYZ = illXYZ + d65Vals_X[i];
} else if (A == 1){
XYZref = XYZref + (REF[i] * d65Vals_Y[i]);
illXYZ = illXYZ + d65Vals_Y[i];
} else {
XYZref = XYZref + (REF[i] * d65Vals_Z[i]);
illXYZ = illXYZ + d65Vals_Z[i];
}
}
return (XYZref/(100 * illXYZ));
}
private void btnCalculate_Click(object sender, EventArgs e)
{
int i;
double L, A, B;
double[] reflexVals = new double[31];
Console.Write("Reflex Data: ");
for (i = 0; i < 31; i++)
{
TextBox reflex = this.Controls["txtReflex_" + (i + 1)] as TextBox;
reflexVals[i] = double.Parse(reflex.Text);
Console.Write(reflexVals[i].ToString() + ", ");
}
Console.Write("\n");
double[] FFXYZ = new double[3];
double[] XYZ = new double[3];
double CR = (1/3);
CR = 0.33333333333333333333333333333333;
for (i = 0; i < 3; i++)
{
XYZ[i] = FXYZ(reflexVals, i);
Console.WriteLine("XYZ[" + i + "] = " + XYZ[i]);
if (XYZ[i] > 0.008856)
{
FFXYZ[i] = Math.Pow(XYZ[i], CR);
Console.WriteLine("FFXYZ[" + i + "] = " + Math.Pow(XYZ[i], CR));
}
else
{
FFXYZ[i] = (7.787 * XYZ[i]) + (16/116);
Console.WriteLine("FFXYZ[" + i + "] = (7.787 * " + XYZ[i] + ") + (16/116)");
}
}
if (XYZ[1] > 0.00856)
{
L = (116 * FFXYZ[1]) - 16;
Console.WriteLine("L = (116 * " + FFXYZ[1] + ") - 16");
}
else
{
L = 903.3 * XYZ[1];
Console.WriteLine("L = 903.3 * " + XYZ[1] + ")");
}
A = 500 * (FFXYZ[0] - FFXYZ[1]);
B = 200 * (FFXYZ[1] - FFXYZ[2]);
Console.WriteLine("A = 500 * (" + FFXYZ[0] + " - " + FFXYZ[1] + ")");
Console.WriteLine("A = 200 * (" + FFXYZ[1] + " - " + FFXYZ[2] + ")");
txtCalcL.Text = L.ToString();
txtCalcA.Text = A.ToString();
txtCalcB.Text = B.ToString();
}
嗨丹尼爾,可悲的沒有太多,因爲沒有太多的東西,我知道頁面上的VB代碼顯示的作品,但我有麻煩翻譯它:( – Neo