#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <utility>
#include <limits>
#include <stdexcept>
#include <vector>
#include <iostream>
struct Vec3 { double x, y, z; };
using Formation = std::vector<Vec3>;
constexpr double pi = 3.14159265358979323846;
Vec3 add(Vec3 a, Vec3 b) {
return {a.x + b.x, a.y + b.y, a.z + b.z};
}
Vec3 sub(Vec3 a, Vec3 b) {
return {a.x - b.x, a.y - b.y, a.z - b.z};
}
Vec3 scale(Vec3 v, double k) {
return {v.x * k, v.y * k, v.z * k};
}
double dot(Vec3 a, Vec3 b) {
return a.x*b.x + a.y*b.y + a.z*b.z;
}
double length(Vec3 v) { return std::sqrt(dot(v,v)); }
bool near(Vec3 a, Vec3 b) {
return length(sub(a,b)) < 1e-8;
}
int main() {
Vec3 punto = {12,5,3};
Vec3 centro = {10,5,3};
double deg = 90;
double rad = (90*pi)/180;
Vec3 dist = sub(punto, centro);
// for (const Vec3& posizione : droni) {
std::cout << "(" << dist.x << ", "
<< dist.y << ", "
<< dist.z << ")\n";
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: