Stack the points as rows of a data matrix X, subtract the mean to get the centered matrix Xc, and take its SVD Xc = UΣV⊤. The columns of V (the right singular vectors) are the principal directions: the first, in red, points along the direction of maximum spread; the second, in green, is orthogonal to it. The singular values σi measure the spread along each direction (variance along axis i is σi2/(N−1)). Drag any point, click empty space to add one, and watch the axes and ellipse update.