// David Eberly, Geometric Tools, Redmond WA 98052 // Copyright (c) 1998-2020 // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt // https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt // Version: 4.0.2019.08.13 #pragma once #include // The triangle is represented as an array of three vertices. The dimension // N must be 2 or larger. namespace WwiseGTE { template class Triangle { public: // Construction and destruction. The default constructor sets // the/ vertices to (0,..,0), (1,0,...,0) and (0,1,0,...,0). Triangle() : v{ Vector::Zero(), Vector::Unit(0), Vector::Unit(1) } { } Triangle(Vector const& v0, Vector const& v1, Vector const& v2) : v{ v0, v1, v2 } { } Triangle(std::array, 3> const& inV) : v(inV) { } // Public member access. std::array, 3> v; public: // Comparisons to support sorted containers. bool operator==(Triangle const& triangle) const { return v == triangle.v; } bool operator!=(Triangle const& triangle) const { return v != triangle.v; } bool operator< (Triangle const& triangle) const { return v < triangle.v; } bool operator<=(Triangle const& triangle) const { return v <= triangle.v; } bool operator> (Triangle const& triangle) const { return v > triangle.v; } bool operator>=(Triangle const& triangle) const { return v >= triangle.v; } }; // Template aliases for convenience. template using Triangle2 = Triangle<2, Real>; template using Triangle3 = Triangle<3, Real>; }