Kaynağa Gözat

Fixing conflict.

William Lee Sims 12 yıl önce
ebeveyn
işleme
65f0984de6
1 değiştirilmiş dosya ile 37 ekleme ve 21 silme
  1. 37 21
      engine/source/math/math_ScriptBinding.cc

+ 37 - 21
engine/source/math/math_ScriptBinding.cc

@@ -164,65 +164,81 @@ ConsoleFunctionWithDocs( mLog, ConsoleFloat, 2, 2, ( val ))
    return(mLog(dAtof(argv[1])));
 }
 
-/*! Use the mSin function to get the sine of the radian angle val.
-    @param val A value between -3.14159 and 3.14159.
+/*! Use the mSin function to get the sine of the angle val.
+    @param val A value in degrees.
     @return Returns the sine of val. This value will be in the range [ -1.0 , 1.0 ].
     @sa mAsin
 */
 ConsoleFunctionWithDocs( mSin, ConsoleFloat, 2, 2, ( val ))
 {
-   return(mSin(dAtof(argv[1])));
+   return(mSin(mDegToRad(dAtof(argv[1]))));
 }
 
-/*! Use the mCos function to get the cosine of the radian angle val.
-    @param val A value between -3.14159 and 3.14159.
+/*! Use the mCos function to get the cosine of the angle val.
+    @param val A value in degrees.
     @return Returns the cosine of val. This value will be in the range [ -1.0 , 1.0 ].
     @sa mAcos
 */
 ConsoleFunctionWithDocs( mCos, ConsoleFloat, 2, 2, ( val ))
 {
-   return(mCos(dAtof(argv[1])));
+   return(mCos(mDegToRad(dAtof(argv[1]))));
 }
 
-/*! Use the mTan function to get the tangent of the radian angle val.
-    @param val A value between -3.14159/2 and 3.14159/2.
+/*! Use the mTan function to get the tangent of the angle val.
+    @param val A value in degrees.
     @return Returns the tangent of val. This value will be in the range [ -inf.0 , inf.0 ].
     @sa mAtan
 */
 ConsoleFunctionWithDocs( mTan, ConsoleFloat, 2, 2, ( val ))
 {
-   return(mTan(dAtof(argv[1])));
+   return(mTan(mDegToRad(dAtof(argv[1]))));
 }
 
-/*! Use the mAsin function to get the inverse sine of val in radians.
+/*! Use the mAsin function to get the inverse sine of val in degrees.
     @param val A value between -1.0 and 1.0 equal to the sine of some angle theta.
-    @return Returns the inverse sine of val in radians. This value will be in the range [ - 3.14159/2 , 3.14159/2 ].
+    @return Returns the inverse sine of val in degrees. This value will be in the range [ -90, 90 ].
     @sa mSin
 */
 ConsoleFunctionWithDocs( mAsin, ConsoleFloat, 2, 2, ( val ))
 {
-   return(mAsin(dAtof(argv[1])));
+   return(mRadToDeg(mAsin(dAtof(argv[1]))));
 }
 
-/*! Use the mAcos function to get the inverse cosine of val in radians.
+/*! Use the mAcos function to get the inverse cosine of val in degrees.
     @param val A value between -1.0 and 1.0 equal to the cosine of some angle theta.
-    @return Returns the inverse cosine of val in radians. This value will be in the range [ 0 , 3.14159 ].
+    @return Returns the inverse cosine of val in radians. This value will be in the range [ 0 , 180 ].
     @sa mCos
 */
 ConsoleFunctionWithDocs( mAcos, ConsoleFloat, 2, 2, ( val ))
 {
-   return(mAcos(dAtof(argv[1])));
+   return(mRadToDeg(mAcos(dAtof(argv[1]))));
 }
 
-/*! Use the mAtan function to get the inverse tangent of rise/run in radians.
-    @param rise Vertical component of a line.
-    @param run Horizontal component of a line.
-    @return Returns the slope in radians (the arc-tangent) of a line with the given rise and run.
+/*! Use the mAtan function to get the inverse tangent of rise/run in degrees.
+    May be called as mAtan( deltaX, deltaY ) or mAtan( "deltaX deltaY" ).
+    @param x-axis run Horizontal component of a line.
+    @param y-axis rise Vertical component of a line.
+    @return Returns the slope in degrees (the arc-tangent) of a line with the given run and rise.
     @sa mTan
 */
-ConsoleFunctionWithDocs( mAtan, ConsoleFloat, 3, 3, ( val ))
+ConsoleFunctionWithDocs( mAtan, ConsoleFloat, 2, 3, ( val ))
 {
-   return(mAtan(dAtof(argv[1]), dAtof(argv[2])));
+   F32 xRun, yRise;
+   if( argc == 3 )
+   {
+      xRun = dAtof( argv[1] );
+      yRise = dAtof( argv[2] );
+   }
+   else if( StringUnit::getUnitCount( argv[1], " " ) == 2 )
+   {
+     dSscanf( argv[1], "%g %g", &xRun, &yRise );
+   }
+   else
+   {
+     Con::warnf( "mAtan - Invalid parameters." );
+     return 0;
+   }
+   return(mRadToDeg(mAtan(xRun, yRise)));
 }
 
 /*! Use the mRadToDeg function to convert radians to degrees.