Exemple #1
0
        public Vehicle(int id, Vector2D position, Vector2D velocity)
        {
            ID = id;

            Position = position;
            Velocity = velocity;
        }
Exemple #2
0
        public Vehicle(Vector2D position, Vector2D velocity)
        {
            // Take an ID.
            ID = nextID;

            // ID 0 is reserved.
            nextID++;
            if (nextID == 0)
                nextID++;

            Position = position;
            Velocity = velocity;
        }
Exemple #3
0
        public Signal(int originID, int senderID, int hopCount,
            Vector2D emergencyPosition, int emergencyRadius,
            int startTime, int expiryTime)
        {
            OriginID = originID;
            SenderID = senderID;
            HopCount = hopCount;

            EmergencyPosition = emergencyPosition;
            EmergencyRadius = emergencyRadius;

            StartTime = startTime;
            ExpiryTime = expiryTime;
        }
Exemple #4
0
 public static double Angle(Vector2D a, Vector2D b)
 {
     return Math.Acos((a * b) / (a.length * b.length));
 }
Exemple #5
0
 public static double GetDistanceBetweenPoints(Vector2D a, Vector2D b)
 {
     return Math.Sqrt(Math.Pow(b.x - a.x, 2) + Math.Pow(b.y - a.y, 2));
 }
Exemple #6
0
 public static bool PointOnCircle(Vector2D origin, int radius, Vector2D point)
 {
     return GetDistanceBetweenPoints(origin, point) <= radius;
 }