diff --git a/Engine/src/Runtime/Core/public/Math/Line.hpp b/Engine/src/Runtime/Core/public/Math/Line.hpp index 6d138da..de6638f 100644 --- a/Engine/src/Runtime/Core/public/Math/Line.hpp +++ b/Engine/src/Runtime/Core/public/Math/Line.hpp @@ -6,6 +6,8 @@ #include "Core/public/Math/Vector3.hpp" +#include + namespace Phanes::Core::Math { @@ -17,36 +19,54 @@ namespace Phanes::Core::Math { public: using Real = T; - union - { - struct - { - /** X component of line */ - Real x; - - /** Y component of line */ - Real y; - - /** Z component of line */ - Real z; - }; - TVector3 normal; - }; - /** Moment of line */ + /** Direction of line */ - Real m; + TVector3 direction; + + /** Base point of line */ + + TVector3 base; public: - /** Construct line from base and normal + /** Construct line from base and direction * - * @param(normal) Normal of line + * @param(direction) Direction of line * @param(p) Base of line */ - TLine(const TVector3& normal, const TVector3& p) {}; + TLine(const TVector3& direction, const TVector3& p) : direction(direction), base(p) {}; }; + /** + * Normalizes the direction of the line + * + * @param(l1) Line + */ + + template + TLine NormalizeV(TLine& l1) + { + std::any + + NormalizeV(l1.direction); + return l1; + } + + + /** + * Normalizes the direction of the line + * + * @param(l1) Line + * + * @return Line with normalized direction. + */ + + template + TLine NormalizeV(const TLine& l1) + { + return TLine(Normalize(l1.direction), l1.base); + } } \ No newline at end of file