Wed, 08 Jun 2022 20:41:21 +0300
Refactor colors.cpp/.h
#pragma once #include "main.h" #include "model.h" namespace ldraw { /// Determines how quadrilaterals are split into triangles enum class Diagonal { Diagonal_13, Diagonal_24 }; std::pair<Triangle, Triangle> splitTriangles( const Quadrilateral& q, ldraw::Diagonal diagonal); /* void makeUnofficial(ModelEditor &editor); */ template<typename Fn> void circle(int segments, int divisions, Fn&& fn) { float factor = 2.0f * pi<> / divisions; for (int i = 0; i < segments; i += 1) { fn( glm::vec2{std::sin((i - 1) * factor), std::cos((i - 1) * factor)}, glm::vec2{std::sin(i * factor), std::cos(i * factor)}, glm::vec2{std::sin((i + 1) * factor), std::cos((i - 1) * factor)} ); } } } ModelElement inverted(const ModelElement &element);