public Vehicle(int id, Vector2D position, Vector2D velocity) { ID = id; Position = position; Velocity = velocity; }
public Vehicle(Vector2D position, Vector2D velocity) { // Take an ID. ID = nextID; // ID 0 is reserved. nextID++; if (nextID == 0) nextID++; Position = position; Velocity = velocity; }
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; }
public static double Angle(Vector2D a, Vector2D b) { return Math.Acos((a * b) / (a.length * b.length)); }
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)); }
public static bool PointOnCircle(Vector2D origin, int radius, Vector2D point) { return GetDistanceBetweenPoints(origin, point) <= radius; }