// -180.0 < angle <= 180.0の値を返します // ベクトルbが反時計周りにあるとき、値は負の数を返します public float SignedAngle(PointXY b) { float rad = (float)Math.Acos(InnerProduct(b) / (Length() * b.Length())); if (OuterProduct(b) < 0.0F) { rad = -rad; } return(rad * 180.0F / (float)Math.PI); }
// 0.0 <= angle <= 180.0の値を返します public float Angle(PointXY b) { float rad = (float)Math.Acos(InnerProduct(b) / (Length() * b.Length())); return(rad * 180.0F / (float)Math.PI); }