平行
#include <Siv3D.hpp> const double eps = 1e-8; bool isZero(const Vec2& v) { return v.length() < eps; } bool operator||(const Vec2& v1, const Vec2& v2) { return !isZero(v1) && !isZero(v2) && (1.0 - eps) < Abs(v1.normalized().dot(v2.normalized())); } void Main() { const Vec2 v1(1, 0), v2(-1, 0), v3(1, 1); Println(v1 || v2); Println(v1 || v3); WaitKey(); }
春休み中はブログたくさん更新する予定だった…