#ifndef POINT_HPP #define POINT_HPP #include "vector3.hpp" #include #define M_PI 3.1415 class Point { private: int64_t x_, y_, z_; public: Point(int64_t x = 0, int64_t y = 0, int64_t z = 0) : x_(x), y_(y), z_(z) {} int64_t x() const { return x_; } int64_t y() const { return y_; } int64_t z() const { return z_; } Point operator+(const Point& p) const; Point operator-(const Point& p) const; bool operator==(const Point& p) const; bool operator!=(const Point& p) const; // ת»» Vector3 toVector3() const; static Point fromVector3(const Vector3& v); friend std::ostream& operator<<(std::ostream& os, const Point& p); }; // Hashº¯Êý namespace std { template<> struct hash { size_t operator()(const Point& p) const { size_t h1 = std::hash()(p.x()); size_t h2 = std::hash()(p.y()); size_t h3 = std::hash()(p.z()); return h1 ^ (h2 << 1) ^ (h3 << 2); } }; } #endif