functional bots, small refactoring, readme edit

This commit is contained in:
programsnail 2024-07-26 22:36:12 +03:00
parent 5299e89633
commit 7e67a3bd30
13 changed files with 179 additions and 91 deletions

View file

@ -1,6 +1,7 @@
#pragma once
#include <cmath>
#include <cstdint>
template <typename T> struct Vec {
T x = {};
@ -78,7 +79,7 @@ template <typename T> struct Vec {
//
int len_sq() const { return dot(*this, *this); }
T len_sq() const { return dot(*this, *this); }
double len() const { return std::sqrt(len_sq()); }
@ -86,14 +87,14 @@ template <typename T> struct Vec {
//
int static dot(Vec left, Vec right) {
T static dot(Vec left, Vec right) {
return left.x * right.x + left.y * right.y;
}
int static cross(Vec left, Vec right) {
T static cross(Vec left, Vec right) {
return left.x * right.y - left.y * right.x;
}
};
using Veci = Vec<int>;
using Veci = Vec<int64_t>;
using Vecf = Vec<double>;