TexGen
SectionHybrid.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
29 {
30 public:
32 CSectionHybrid(void);
34 CSectionHybrid(const CSection &TopHalf, const CSection &BottomHalf);
36 CSectionHybrid(const CSection &TopRight, const CSection &TopLeft, const CSection &BottomLeft, const CSection &BottomRight);
37 CSectionHybrid(TiXmlElement &Element);
38 ~CSectionHybrid(void);
39
40 bool operator == (const CSection &CompareMe) const;
41 CSection* Copy() const { return new CSectionHybrid(*this); }
42
43 void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const;
44
45 string GetType() const { return "CSectionHybrid"; }
46 string GetDefaultName() const;
47
49 void AddDivision(double dFraction);
51 bool AssignSection(int iIndex, const CSection &Section);
52
53 // Accessor methods
54 int GetNumDivisions() const { return (int)m_Divisions.size(); }
55 int GetNumSections() { return (int)m_Sections.size(); }
56 double GetDivision(int iIndex) const;
57 const CSection &GetSection(int iIndex) const;
58 XY GetPoint(double t) const;
59
60 protected:
61 vector<double> m_Divisions;
62 vector<CObjectContainer<CSection> > m_Sections;
63 };
64
65}; // namespace TexGen
66
67
68
69
70
71
72
#define CLASS_DECLSPEC
Definition: Misc.h:35
Abstract base class respresenting a yarn cross-section.
Definition: Section.h:31
Hybrid of any number of other sections.
Definition: SectionHybrid.h:29
int GetNumDivisions() const
Definition: SectionHybrid.h:54
vector< CObjectContainer< CSection > > m_Sections
Definition: SectionHybrid.h:62
CSection * Copy() const
Create a copy of the derived section and return a pointer to the newly created instance.
Definition: SectionHybrid.h:41
string GetType() const
Derived class should return the class name.
Definition: SectionHybrid.h:45
vector< double > m_Divisions
Definition: SectionHybrid.h:61
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