TexGen
YarnSection.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
22#include "Mesh.h"
23#include "Section.h"
24
25namespace TexGen
26{
27 using namespace std;
28
29 class CSection;
30 class CYarnSectionConstant;
31 class CYarnSectionInterpNode;
32 class CYarnSectionInterpPosition;
33
36 {
39 vector<double> SectionLengths;
40
41 double GetYarnPosition() const;
44 {
45 dSectionPosition = 0;
46 iSection = 0;
47 }
48 };
49
51
58 {
59 public:
60 CYarnSection(bool bConstMesh = true);
61 CYarnSection(TiXmlElement &Element);
62 virtual ~CYarnSection(void);
64
66
70 virtual CYarnSection* Copy() const = 0;
71
73 virtual string GetType() const = 0;
74
76 static CObjectContainer<CYarnSection> CreateYarnSection(TiXmlElement &Element);
77
79 virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const;
80
82
87 virtual vector<XY> GetSection(const YARN_POSITION_INFORMATION PositionInfo, int iNumPoints, bool bEquiSpaced = false) const = 0;
89
94 virtual CMesh GetSectionMesh(const YARN_POSITION_INFORMATION PositionInfo, int iNumPoints, bool bEquiSpaced) const = 0;
95
97 virtual void SetSectionMeshLayersEqual( int iNumPoints ) const {return;}
98
99 bool GetForceMeshLayers() const {return m_bForceEqualMeshLayers;}
100
102
107 CYarnSectionConstant* GetSectionConstant();
108 CYarnSectionInterpNode* GetSectionInterpNode();
109 CYarnSectionInterpPosition* GetSectionInterpPosition();
110
111 protected:
112 };
113
114}; // namespace TexGen
115
116
117
#define CLASS_DECLSPEC
Definition: Misc.h:35
Defines the nodes and elements of a surface or volume mesh.
Definition: Mesh.h:58
Object container to help handle memory management issues.
Creates a section which is constant all along the yarn.
Abstract base class used to define the sections along the length of a yarn.
Definition: YarnSection.h:58
bool GetForceMeshLayers() const
Definition: YarnSection.h:99
virtual CYarnSection * Copy() const =0
This is a function to allow copying of derived classes correctly.
virtual void SetSectionMeshLayersEqual(int iNumPoints) const
Find max value for iNumLayers in section meshes and set iNumLayers to that value.
Definition: YarnSection.h:97
virtual string GetType() const =0
Derived class should return the class name.
virtual CMesh GetSectionMesh(const YARN_POSITION_INFORMATION PositionInfo, int iNumPoints, bool bEquiSpaced) const =0
This function must be implemented by derived classes.
virtual vector< XY > GetSection(const YARN_POSITION_INFORMATION PositionInfo, int iNumPoints, bool bEquiSpaced=false) const =0
This function must be implemented by derived classes.
Creates a section which is linearly interpolated between sections defined at the nodes.
Interpolate sections between arbritrary positions along the length of the yarn.
Namespace containing a series of customised math operations not found in the standard c++ library.
OUTPUT_TYPE
Definition: Misc.h:105
Structure used to represent the position along the length of a yarn.
Definition: YarnSection.h:36
YARN_POSITION_INFORMATION()
Constructor used to initialise all variables to zero on creation.
Definition: YarnSection.h:43
double dSectionPosition
This variables varies linearly with distance from 0 to 1 from the start to the end of the current lin...
Definition: YarnSection.h:37
int iSection
This variable represents the index of the current section (where a section is defined as the part bet...
Definition: YarnSection.h:38
vector< double > SectionLengths
This contains a list of lengths representing the length of each section.
Definition: YarnSection.h:39