| 12345678910111213141516171819202122232425262728293031 |
- namespace Day24;
- public readonly record struct Vec3(long X, long Y, long Z)
- {
- public static Vec3 Zero { get; } = new Vec3(0, 0, 0);
- public static Vec3 FromSpan(Span<long> nums)
- {
- return new Vec3(nums[0], nums[1], nums[2]);
- }
- public Vec3 Add(Vec3 other)
- {
- return new Vec3(X + other.X, Y + other.Y, Z + other.Z);
- }
- public Vec3 Subtract(Vec3 other)
- {
- return new Vec3(X - other.X, Y - other.Y, Z - other.Z);
- }
- public Vec3 Multiply(long f)
- {
- return new Vec3(f * X, f * Y, f * Z);
- }
- public static explicit operator Vec(Vec3 v)
- {
- return new Vec(v.X, v.Y);
- }
- }
|