src/ldrawalgorithm.h

Thu, 09 Jun 2022 11:51:42 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 09 Jun 2022 11:51:42 +0300
changeset 209
c93e4a1eaadb
parent 206
654661eab7f3
child 232
8efa3a33172e
permissions
-rw-r--r--

remove more dead code

#pragma once
#include "basics.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);

mercurial