Skip to content
OE_pattern.cpp 3.97 KiB
Newer Older
/*
 * Copyright (c) 2015 Tricoire Sebastien 3dsman@free.fr
 *
 * This software is provided 'as-is', without any express or implied
 * warranty.  In no event will the authors be held liable for any damages
 * arising from the use of this software.
 *
 * Permission is granted to anyone to use this software for any purpose,
 * including commercial applications, and to alter it and redistribute it
 * freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you must not
 * claim that you wrote the original software. If you use this software
 * in a product, an acknowledgment in the product documentation would be
 * appreciated but is not required.
 * 2. Altered source versions must be plainly marked as such, and must not be
 * misrepresented as being the original software.
 * 3. This notice may not be removed or altered from any source distribution.
 *
 */

#include "OE_pattern.h"

3dsman's avatar
3dsman committed
OE_pattern::OE_pattern()
{
}

raoul's avatar
raoul committed
OE_pattern::OE_pattern(std::vector<vector_2d> _pts, bool _endPoints, std::string _name)
raoul's avatar
raoul committed
	pts = _pts;
	endPoints = _endPoints;
	name = _name;
3dsman's avatar
3dsman committed
void OE_pattern::persist(Pakal::Archive* archive)
{
	archive->value("pts", pts);
	archive->value("endPoints", endPoints);
	archive->value("name", name);
}

std::list<OE_pattern*> OE_pattern::createStandardPatterns()
{
	std::list<OE_pattern*> standardPattern;
raoul's avatar
raoul committed
	standardPattern.push_back(new OE_pattern({vector_2d(0, 0)}, false, "straight"));
	standardPattern.push_back(new OE_pattern({vector_2d(0, 0),
	                                          vector_2d(1, 0),
	                                          vector_2d(0, 0)}, false, "triple straight"));
	standardPattern.push_back(new OE_pattern({vector_2d(0, 0.5),
	                                          vector_2d(0.5, -0.5)}, false, "satin"));
	standardPattern.push_back(new OE_pattern({vector_2d(0, -0.5),
	                                          vector_2d(0, 0.5)}, false, "stretch"));
	standardPattern.push_back(new OE_pattern({vector_2d(0, -0.5),
	                                          vector_2d(0.3, 0.5),
	                                          vector_2d(0.6, -0.5)}, false, "overcast"));
	standardPattern.push_back(new OE_pattern({vector_2d(0, -0.5),
	                                          vector_2d(0, 0.5),
	                                          vector_2d(0, -0.5)}, false, "applique"));
	standardPattern.push_back(new OE_pattern({vector_2d(1, 0.5),
	                                          vector_2d(0.5, 0),
	                                          vector_2d(0, 0.5),
	                                          vector_2d(1, -0.5)}, false, "cross"));
	standardPattern.push_back(new OE_pattern({vector_2d(0, -0.5),
	                                          vector_2d(0.5, -0.5),
	                                          vector_2d(0.5, 0.1),
	                                          vector_2d(0.3, 0.3),
	                                          vector_2d(0.5, 0.5),
	                                          vector_2d(0.7, 0.3),
	                                          vector_2d(0.5, 0.1),
	                                          vector_2d(0.5, -0.5)}, false, "applique circle"));
	standardPattern.push_back(new OE_pattern({vector_2d(0.5, 0),
	                                          vector_2d(0.8, 0),
	                                          vector_2d(0.2, 0),
	                                          vector_2d(0.5, 0),
	                                          vector_2d(0.5, -0.3),
	                                          vector_2d(0.5, 0.3),
	                                          vector_2d(0.5, 0),
	                                          vector_2d(0.3, -0.2),
	                                          vector_2d(0.7, 0.2),
	                                          vector_2d(0.5, 0),
	                                          vector_2d(0.7, -0.2),
	                                          vector_2d(0.3, 0.2),
	                                          vector_2d(0.5, 0)}, false, "flower"));

	return standardPattern;
}