Skip to content

Commit

Permalink
[Core] add AngDiff to lua
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-tz committed May 17, 2024
1 parent b2eaa71 commit 870b9d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions Core/src/LuaModule/utils.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ namespace Utils{
bool InTheirPenaltyArea(const CGeoPoint& p,const double buffer);
bool PlayerNumValid(int num);
bool canGo(const CVisionModule* pVision, const int num, const CGeoPoint& target, const int flag, const double avoidBuffer);
double angDiff(double angle1, double angle2);
}
5 changes: 4 additions & 1 deletion Core/src/Utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
#include "staticparams.h"
#include <GDebugEngine.h>
#include <iostream>

#include "geomcalc.h"
namespace Utils{
double angDiff(double angle1, double angle2){
return angleDiff(angle1,angle2);
}
double dirDiff(const CVector& v1, const CVector& v2) { return fabs(Normalize(v1.dir() - v2.dir()));}
double Normalize(double angle)
{
Expand Down
2 changes: 2 additions & 0 deletions Core/src/Utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
class CVisionModule;
struct PlayerPoseT;
namespace Utils {
extern double angDiff(double angle1, double angle2);

extern double Normalize(double angle);///<把角度规范化到(-PI,PI]
extern CVector Polar2Vector(double m, double angle); ///<极坐标转换到直角坐标
extern double VectorDot(const CVector& v1, const CVector& v2); // 向量点乘
Expand Down

0 comments on commit 870b9d6

Please sign in to comment.