2021-09-13 15:53:43 +03:00
|
|
|
//
|
|
|
|
// Created by Иван Ильин on 13.01.2021.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef ENGINE_TRIANGLE_H
|
|
|
|
#define ENGINE_TRIANGLE_H
|
|
|
|
|
2021-10-12 17:12:47 +03:00
|
|
|
#include "Point4D.h"
|
|
|
|
#include "Vec3D.h"
|
|
|
|
#include "Matrix4x4.h"
|
2021-09-13 15:53:43 +03:00
|
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
|
2021-10-12 20:18:56 +03:00
|
|
|
class Triangle final {
|
2021-09-19 11:25:10 +03:00
|
|
|
private:
|
|
|
|
sf::Color _color;
|
2021-10-12 17:12:47 +03:00
|
|
|
std::vector<Point4D> _points;
|
2021-09-13 15:53:43 +03:00
|
|
|
public:
|
|
|
|
Triangle ();
|
|
|
|
Triangle (const Triangle& triangle);
|
2021-09-19 11:25:10 +03:00
|
|
|
Triangle (const Point4D& p1, const Point4D& p2, const Point4D& p3, sf::Color color = {0, 0, 0});
|
2021-10-12 17:12:47 +03:00
|
|
|
Triangle& operator=(const Triangle&) = delete;
|
2021-09-13 15:53:43 +03:00
|
|
|
|
|
|
|
[[nodiscard]] Point4D operator[] (int i) const;
|
2021-10-12 17:12:47 +03:00
|
|
|
[[nodiscard]] Vec3D norm() const;
|
2021-09-13 15:53:43 +03:00
|
|
|
|
|
|
|
// Operations with Matrix4x4
|
|
|
|
[[nodiscard]] Triangle operator*(const Matrix4x4& matrix4X4) const;
|
|
|
|
|
2021-10-12 17:12:47 +03:00
|
|
|
[[nodiscard]] bool isPointInside(const Vec3D& point) const;
|
2021-09-19 11:25:10 +03:00
|
|
|
|
|
|
|
[[nodiscard]] sf::Color color() const { return _color; }
|
2021-10-12 17:12:47 +03:00
|
|
|
|
2021-09-13 15:53:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //INC_3DZAVR_TRIANGLE_H
|