You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.
It throw out exception "Must between -FP.One and FP.One"
The demo is as follow:
FPx1= FP.FromRaw(3492999344);FPy1= FP.FromRaw(2499139782);FPx2= FP.FromRaw(-3492914803);FPy2= FP.FromRaw(-2499256617);
Debug.Log("x1: "+x1+" y1: "+y1+" x2: "+x2+" y2: "+y2);// x1: 0.8132773 y1: 0.5818763 x2: -0.8132576 y2: -0.5819035FPx1_normalized=x1/ FP.Sqrt(x1*x1+y1*y1);FPy1_normalized=y1/ FP.Sqrt(x1*x1+y1*y1);
Debug.Log("normalized vector1 x: "+x1_normalized+" y: "+y1_normalized);// normalized vector1 x: 0.8132773 y: 0.5818763FPx2_normalized=x2/ FP.Sqrt(x2*x2+y2*y2);FPy2_normalized=y2/ FP.Sqrt(x2*x2+y2*y2);
Debug.Log("normalized vector2 x: "+x2_normalized+" y: "+y2_normalized);// normalized vector2 x: -0.8132578 y: -0.5819036FPdot=x1_normalized*x2_normalized+y1_normalized*y2_normalized;
Debug.Log("Dot of vector1 and vector2: "+dot);// Dot of vector1 and vector2: -1
FP.Acos(dot);// ArgumentOutOfRangeException: x // Parameter name: Must between -FP.One and FP.One
The code of Fix64:
/// <summary>/// Returns the arccos of of the specified number, calculated using Atan and Sqrt/// This function has at least 7 decimals of accuracy./// </summary>publicstatic FP Acos(FPx){if(x<-One||x>One){thrownew ArgumentOutOfRangeException("Must between -FP.One and FP.One","x");}if(x.RawValue ==0)returnPiOver2;varresult= Atan(Sqrt(One-x*x)/x);return x.RawValue <0?result+Pi:result;}
The text was updated successfully, but these errors were encountered:
It throw out exception "Must between -FP.One and FP.One"
The demo is as follow:
The code of Fix64:
The text was updated successfully, but these errors were encountered: