mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 23:13:26 +00:00
added trace line
This commit is contained in:
32
include/omath/Triangle3d.hpp
Normal file
32
include/omath/Triangle3d.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by Orange on 11/13/2024.
|
||||
//
|
||||
#pragma once
|
||||
#include "omath/Vector3.hpp"
|
||||
|
||||
namespace omath
|
||||
{
|
||||
class Triangle3d
|
||||
{
|
||||
public:
|
||||
Triangle3d(const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3);
|
||||
Vector3 m_vertex1;
|
||||
Vector3 m_vertex2;
|
||||
Vector3 m_vertex3;
|
||||
|
||||
[[nodiscard]]
|
||||
Vector3 CalculateNormal() const;
|
||||
|
||||
[[nodiscard]]
|
||||
float SideALength() const;
|
||||
|
||||
[[nodiscard]]
|
||||
float SideBLength() const;
|
||||
|
||||
[[nodiscard]]
|
||||
Vector3 SideAVector() const;
|
||||
|
||||
[[nodiscard]]
|
||||
Vector3 SideBVector() const;
|
||||
};
|
||||
}
|
||||
22
include/omath/collision/LineTracer.hpp
Normal file
22
include/omath/collision/LineTracer.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Created by Orange on 11/13/2024.
|
||||
//
|
||||
#pragma once
|
||||
#include "omath/Vector3.hpp"
|
||||
#include "omath/Triangle3d.hpp"
|
||||
namespace omath::collision
|
||||
{
|
||||
struct Ray
|
||||
{
|
||||
Vector3 start;
|
||||
Vector3 end;
|
||||
};
|
||||
class LineTracer
|
||||
{
|
||||
public:
|
||||
LineTracer() = delete;
|
||||
|
||||
[[nodiscard]]
|
||||
static bool CanTraceLine(const Ray& ray, const Triangle3d& triangle);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user