12345678910111213141516171819202122232425262728293031323334353637 |
- using System;
- using Blue;
- using UnityEngine;
- public interface IGetAngleByTwoPointUtility:IUtility
- {
- double GetAngleByTwoPoint(Vector2 startPoint, Vector2 endPoint);
- double GetAngleByTwoPoint(float startPoint_X, float startPoint_Y, float endPoint_X, float ednPoint_Y);
- }
- public class GetAngleByTwoPointUtility : IGetAngleByTwoPointUtility
- {
-
-
-
-
-
-
- double IGetAngleByTwoPointUtility.GetAngleByTwoPoint(Vector2 startPoint,Vector2 endPoint)
- {
- return GetAngleByTwoPoint(startPoint.x,startPoint.y,endPoint.x,endPoint.y);
- }
-
-
-
-
-
-
-
-
- public double GetAngleByTwoPoint(float startPoint_X,float startPoint_Y ,float endPoint_X,float ednPoint_Y)
- {
- return Math.Atan2(ednPoint_Y - startPoint_Y, endPoint_X - startPoint_X) * (180.0 / Math.PI);
- }
- }
|