TexGen
TextileLayered.h
Go to the documentation of this file.
1/*=============================================================================
2TexGen: Geometric textile modeller.
3Copyright (C) 2014 Louise Brown
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 "Textile.h"
22#include "DomainPlanes.h"
23
24namespace TexGen
25{
26 using namespace std;
27
30 {
31 public:
32
35 CTextileLayered(TiXmlElement &Element);
36 virtual ~CTextileLayered(void);
37
38 virtual CTextile* Copy() const { return new CTextileLayered(*this); }
39 virtual string GetType() const { return "CTextileLayered"; }
40 virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType);
41 string GetDefaultName() const;
42
43 const vector< vector<int> > GetLayerYarnIndices() { return m_LayerYarnIndices; }
45 void SetOffsets( vector<XY> &Offsets );
47 void SetRelativeOffsets( vector<XY> &Offsets );
49 void SetOffsets( XY &Offset );
50 const vector<XY> &GetOffsets() const {return m_LayerOffset; }
51
52 int GetNumLayers();
53
55 void AddLayer( CTextile& Textile, XYZ& Offset );
56 void AddLayer( vector<CYarn> &Yarns, XYZ& Offset );
57
58 void NestLayers();
59 void MaxNestLayers();
60
61 protected:
64 void ApplyOffsets( vector<XY> &Offsets );
65 void ApplyLayerOffset( XYZ &Offset, int iLayer );
66 void GetOffsetMinDist( int iOffset, vector< vector<pair<double,double> > >& LayerIntersections, vector<pair<int,double> >& MinDist, int iNumX, int iNumY);
67 void GetOffsetMinDist( int x, int y, int iLayer, vector< vector<pair<double,double> > >& LayerIntersections, vector<pair<int,double> >& MinDist, int iNumX, int iNumY, int XSize, int YSize, bool bOffsetTop);
68 int GetLayerMeshes( vector<CMesh>& LayerMeshes );
69 void GetLayerRepeats( vector< XY >& Repeats );
70
71 double GreatestCommonDenominator( double X1, double X2 );
72
73 vector<vector<int> > m_LayerYarnIndices;
74 vector<XY> m_LayerOffset;
76 };
77}; // namespace TexGen
#define CLASS_DECLSPEC
Definition: Misc.h:35
Represents a textile cell containing yarns.
Definition: Textile.h:39
Represents a textile made up from several layers of weaves.
const vector< XY > & GetOffsets() const
const vector< vector< int > > GetLayerYarnIndices()
vector< XY > m_LayerOffset
vector< vector< int > > m_LayerYarnIndices
virtual CTextile * Copy() const
virtual string GetType() const
Derived class should return the class name.
Namespace containing a series of customised math operations not found in the standard c++ library.
OUTPUT_TYPE
Definition: Misc.h:105
Struct for representing points in 2D space.
Definition: mymath.h:103
Struct for representing points in 3D space.
Definition: mymath.h:56