TexGen
YarnSectionConstant.cpp
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#include "PrecompiledHeaders.h"
21#include "YarnSectionConstant.h"
22#include "SectionEllipse.h"
23//#include "TexGen.h"
24using namespace TexGen;
25
26CYarnSectionConstant::CYarnSectionConstant(const CSection &Section)
27: m_pSection(Section)
28{
29
30}
31
33{
34}
35
37: CYarnSection(Element)
38{
39 TiXmlElement* pSection = Element.FirstChildElement("Section");
40 if (pSection)
42 else
44}
45
46void CYarnSectionConstant::PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
47{
48 CYarnSection::PopulateTiXmlElement(Element, OutputType);
49
50 TiXmlElement Section("Section");
51 m_pSection->PopulateTiXmlElement(Section, OutputType);
52 Element.InsertEndChild(Section);
53}
54
55vector<XY> CYarnSectionConstant::GetSection(const YARN_POSITION_INFORMATION PositionInfo, int iNumPoints, bool bEquiSpaced) const
56{
57 // return the same section ignoring the information given in PositionInfo
58 return m_pSection->GetPoints(iNumPoints, bEquiSpaced);
59}
60
61CMesh CYarnSectionConstant::GetSectionMesh(const YARN_POSITION_INFORMATION PositionInfo, int iNumPoints, bool bEquiSpaced) const
62{
63 // return the same section ignoring the information given in PositionInfo
64 return m_pSection->GetMesh(iNumPoints, bEquiSpaced);
65}
66
67
Defines the nodes and elements of a surface or volume mesh.
Definition: Mesh.h:58
Elliptical Section.
Abstract base class respresenting a yarn cross-section.
Definition: Section.h:31
static CObjectContainer< CSection > CreateSection(TiXmlElement &Element)
Create a section from TiXmlElement.
Definition: Section.cpp:78
CMesh GetSectionMesh(const YARN_POSITION_INFORMATION PositionInfo, int iNumPoints, bool bEquiSpaced) const
This function must be implemented by derived classes.
CYarnSectionConstant(const CSection &Section)
void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
CObjectContainer< CSection > m_pSection
const CSection & GetSection() const
Abstract base class used to define the sections along the length of a yarn.
Definition: YarnSection.h:58
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
Definition: YarnSection.cpp:68
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