| 1234567891011121314151617181920212223242526272829303132333435 |
- namespace Day24;
- public readonly record struct Vec
- {
- public static Vec Zero { get; } = new Vec(0, 0);
-
- public long X { get; }
- public long Y { get; }
-
- public Vec(long x, long y)
- {
- X = x;
- Y = y;
- }
- public Vec Add(Vec other)
- {
- return new Vec(X + other.X, Y + other.Y);
- }
- public Vec Subtract(Vec other)
- {
- return new Vec(X - other.X, Y - other.Y);
- }
- public Vec Multiply(long f)
- {
- return new Vec(f * X, f * Y);
- }
-
- public (double X, double Y) Multiply(double f)
- {
- return (f * X, f * Y);
- }
- }
|