TexGen
Section.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
24
25namespace TexGen
26{
27 using namespace std;
28
31 {
32 friend class CSectionHybrid;
33 friend class CSectionRotated;
34 friend class CSectionScaled;
35 public:
36 CSection();
37 CSection(TiXmlElement &Element);
38 virtual ~CSection(void);
39
41 virtual bool operator == (const CSection &CompareMe) const = 0;
42
44 virtual CSection* Copy() const = 0;
45
47 static CObjectContainer<CSection> CreateSection(TiXmlElement &Element);
48
50 virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const;
51
53
62 virtual const vector<XY> &GetPoints(int iNumPoints, bool bEquiSpaced = false) const;
63
66 const CMesh &GetMesh(int iNumPoints, bool bEquiSpaced = true) const;
67
69 static double GetArea(const vector<XY> &Section);
70
72 static double GetCircumference(const vector<XY> &Section);
73
74 // double GetCircumference();
75
77 void AssignSectionMesh(const CSectionMesh &SectionMesh);
78
80 virtual string GetDefaultName() const = 0;
81
83 virtual string GetType() const = 0;
84
85 virtual string GetBaseType() const { return "";}
86
88 void SetSectionMeshLayers( int iNum );
89
91 int GetSectionMeshLayers();
92
94
101 virtual XY GetPoint(double t) const = 0;
102 protected:
103
104
106
110 void CreateSection(int iNumPoints) const;
112
116 bool CreateEquiSpacedSection(int iNumPoints) const;
117
119 mutable vector<XY> m_EdgePoints;
120
122 mutable bool m_bEquiSpaced;
123
126
127 private:
128 void AssignDefaults();
129 };
130
131}; // namespace TexGen
132
#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.
Abstract base class respresenting a yarn cross-section.
Definition: Section.h:31
vector< XY > m_EdgePoints
List of 2d points creating the outline of the cross-section.
Definition: Section.h:119
virtual CSection * Copy() const =0
Create a copy of the derived section and return a pointer to the newly created instance.
bool m_bEquiSpaced
Keep this variable to determine whether the section was created with equidistant points or not.
Definition: Section.h:122
virtual string GetType() const =0
Derived class should return the class name.
virtual string GetDefaultName() const =0
Get the default name to assign to a section.
virtual XY GetPoint(double t) const =0
Get a point lying on the perimeter correspending to parametric value t.
CObjectContainer< CSectionMesh > m_pSectionMesh
Pointer to a derived class of SectionMesh, this class is in charge of creating the section mesh.
Definition: Section.h:125
virtual string GetBaseType() const
Definition: Section.h:85
Hybrid of any number of other sections.
Definition: SectionHybrid.h:29
Abstract base class to create a 2D mesh of a section.
Definition: SectionMesh.h:33
Section which represents a rotation of another section angle given in radians.
Section which represents a scaled version of another section.
Definition: SectionScaled.h:29
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
double GetArea(XYZ Points[], int iNumPoints)
Definition: mymath.h:1245
Struct for representing points in 2D space.
Definition: mymath.h:103