shooter/engine/Triangle.h

45 lines
1.1 KiB
C
Raw Normal View History

2021-09-13 15:53:43 +03:00
//
// Created by Иван Ильин on 13.01.2021.
//
#ifndef ENGINE_TRIANGLE_H
#define ENGINE_TRIANGLE_H
#include "utils/Point4D.h"
#include "utils/Matrix4x4.h"
#include <SFML/Graphics.hpp>
class Triangle {
public:
// This is for clipping debug: you can distinguish how this triangle was clipped
enum ClipMode {
None = 0,
Cropped,
Doubled,
Skipped
};
ClipMode clip = None;
sf::Color color;
Point4D p[3];
2021-09-13 15:53:43 +03:00
Triangle ();
Triangle (const Triangle& triangle);
Triangle (const Point4D& p1, const Point4D& p2, const Point4D& p3, double w = 1);
Triangle& operator=(const Triangle& triangle);
[[nodiscard]] Point4D operator[] (int i) const;
[[nodiscard]] Point4D& operator[] (int i);
[[nodiscard]] Point4D norm() const;
// Operations with Matrix4x4
[[nodiscard]] Triangle operator*(const Matrix4x4& matrix4X4) const;
Triangle& operator*=(const Matrix4x4& matrix4X4);
[[nodiscard]] Point4D pos() const;
[[nodiscard]] bool isPointInside(const Point4D& point) const;
};
#endif //INC_3DZAVR_TRIANGLE_H