private static float cosAngle(LineElement l1, LineElement l2)
{
bool negative = (l1.I.Id == l2.I.Id || l1.J.Id == l2.J.Id);
Vector3 v1 = l1.I.Position - l1.J.Position;
Vector3 v2 = l2.I.Position - l2.J.Position;
v1.Normalize();
v2.Normalize();
return (negative) ? -Vector3.Dot(v1, v2) : Vector3.Dot(v1, v2);
}