TexGen
SectionPolygon.h
Go to the documentation of this file.
1/*=============================================================================
2TexGen: Geometric textile modeller.
3Copyright (C) 2006 Martin Sherburn
4
5This program is free software; you can redistribute it and/or
6modify it under the terms of the GNU General Public License
7as published by the Free Software Foundation; either version 2
8of the License, or (at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18=============================================================================*/
19
20#pragma once
21#include "Section.h"
22
23namespace TexGen
24{
25 using namespace std;
26
28
36 {
37 public:
38 CSectionPolygon(const vector<XY> &PolygonPoints, bool bSingleQuadrant = false, bool bRetainPoints = false);
39 CSectionPolygon(TiXmlElement &Element);
40 ~CSectionPolygon(void);
41
42 bool operator == (const CSection &CompareMe) const;
43 CSection* Copy() const { return new CSectionPolygon(*this); }
44
45 void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const;
46
47 string GetType() const { return "CSectionPolygon"; }
48 string GetDefaultName() const;
49
50 XY GetPoint(double t) const;
51
53 void Scale(XY Scale);
54
56 void Scale(double dScale);
57
58 protected:
60 void CalcTValues();
61
63 void CreateSection() const;
64
65 vector<XY> m_PolygonPoints;
67 vector<double> m_t;
68
71
72 };
73}; // namespace TexGen
#define CLASS_DECLSPEC
Definition: Misc.h:35
Abstract base class respresenting a yarn cross-section.
Definition: Section.h:31
Creates a polygonal section, where a list of points are given to form the closed polygon.
vector< XY > m_PolygonPoints
string GetType() const
Derived class should return the class name.
vector< double > m_t
The proportion of the distance around the total perimeter range from 0 to 1 for each point.
CSection * Copy() const
Create a copy of the derived section and return a pointer to the newly created instance.
bool m_bRetainPoints
Whether or not to use the polygon points to define the section edge points.
Namespace containing a series of customised math operations not found in the standard c++ library.
OUTPUT_TYPE
Definition: Misc.h:105
bool operator==(const XYZ &left, const XYZ &right)
Definition: mymath.h:149
Struct for representing points in 2D space.
Definition: mymath.h:103