Table of Contents

Method CircularMeanDegrees

Namespace
LMKit.Graphics.Geometry
Assembly
LM-Kit.NET.dll

CircularMeanDegrees(ReadOnlySpan<double>)

Computes the circular mean of a set of angles in degrees.

public static double CircularMeanDegrees(ReadOnlySpan<double> anglesDeg)

Parameters

anglesDeg ReadOnlySpan<double>

Sequence of angles in degrees.

Returns

double

Circular mean in degrees normalized to [0, 360), or NaN if the mean is undefined (e.g., angles uniformly distributed around the circle).

Remarks

The mean is computed by averaging unit vectors on the circle and taking atan2(Σsin, Σcos).

CircularMeanDegrees(ReadOnlySpan<double>, ReadOnlySpan<double>)

Computes the weighted circular mean of angles in degrees.

public static double CircularMeanDegrees(ReadOnlySpan<double> anglesDeg, ReadOnlySpan<double> weights)

Parameters

anglesDeg ReadOnlySpan<double>

Angles in degrees.

weights ReadOnlySpan<double>

Non-negative weights, same length as anglesDeg.

Returns

double

Weighted circular mean in degrees normalized to [0, 360), or NaN if undefined (e.g., zero total weight).

Exceptions

ArgumentException

Thrown when lengths differ or any weight is negative or NaN/Infinity.