public static WeightedMean ( double angles, double weights ) : double | ||
angles | double | A double array containing the angles in radians. |
weights | double | An unit vector containing the importance of each angle
/// in |
리턴 | double |
public static double WeightedMean(double[] angles, double[] weights)
{
double cos = 0, sin = 0;
for (int i = 0; i < angles.Length; i++)
{
cos += Math.Cos(angles[i]) * weights[i];
sin += Math.Sin(angles[i]) * weights[i];
}
return Math.Atan2(sin, cos);
}