もうひとつ質問ですが、ここは何をやっているのでしょうか?

double norm1 = v1.x * v1.x + v1.y * v1.y; // |v1|^2
double norm2 = v2.x * v2.x + v2.y * v2.y; // |v2|^2