// Copyright (C) 2021 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Math module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_MATH_PLANE_HPP #define NAZARA_MATH_PLANE_HPP #include #include namespace Nz { struct SerializationContext; template class Plane { public: Plane() = default; Plane(T normalX, T normalY, T normalZ, T Distance); Plane(const T plane[4]); Plane(const Vector3& Normal, T Distance); Plane(const Vector3& Normal, const Vector3& point); Plane(const Vector3& point1, const Vector3& point2, const Vector3& point3); template explicit Plane(const Plane& plane); Plane(const Plane& plane) = default; ~Plane() = default; T Distance(T x, T y, T z) const; T Distance(const Vector3& point) const; Plane& MakeXY(); Plane& MakeXZ(); Plane& MakeYZ(); Plane& Set(T normalX, T normalY, T normalZ, T Distance); Plane& Set(const T plane[4]); Plane& Set(const Vector3& Normal, T Distance); Plane& Set(const Vector3& Normal, const Vector3& point); Plane& Set(const Vector3& point1, const Vector3& point2, const Vector3& point3); template Plane& Set(const Plane& plane); std::string ToString() const; Plane& operator=(const Plane& other) = default; bool operator==(const Plane& plane) const; bool operator!=(const Plane& plane) const; static Plane Lerp(const Plane& from, const Plane& to, T interpolation); static Plane XY(); static Plane XZ(); static Plane YZ(); Vector3 normal; T distance; }; using Planed = Plane; using Planef = Plane; template bool Serialize(SerializationContext& context, const Plane& plane, TypeTag>); template bool Unserialize(SerializationContext& context, Plane* plane, TypeTag>); } template std::ostream& operator<<(std::ostream& out, const Nz::Plane& plane); #include #endif // NAZARA_MATH_PLANE_HPP