TexGen
ShearedTextileWeave2D.h
Go to the documentation of this file.
1/*=============================================================================
2TexGen: Geometric textile modeller.
3Copyright (C) 2013 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 "TextileWeave2D.h"
22
23namespace TexGen
24{
25 class CSectionPolygon;
26 using namespace std;
27
29
33 {
34 public:
36
40 CShearedTextileWeave2D(int iWidth, int iHeight, double dSpacing, double dThickness, double ShearAngle, bool bRefine = true, bool bInPlaneTangents = true);
41 CShearedTextileWeave2D(TiXmlElement &Element);
43
44 CTextile* Copy() const { return new CShearedTextileWeave2D(*this); }
45 string GetType() const { return "CShearedTextileWeave2D"; }
46 void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType);
47
50 CDomainPlanes GetDefaultDomain( bool bSheared = false, bool bAddedDomainHeight = true );
51
52 double GetShearAngle() const { return m_ShearAngle; }
53 bool GetShearedDomain() const { return m_bShearedDomain; }
54
55 protected:
56 bool BuildTextile() const;
58 void GetYSpacings() const;
60 XY GetYRepeat() const;
61
62 void Refine() const;
63 bool AdjustSectionsForRotation() const;
64 double CalcSinAngle( double R, double Width, double Height ) const;
65
67
73 void CorrectInterference( bool bMaxCorrection = false ) const;
74 void CalculateModifiers( const CInterpolation *pInterpolation, int Yarn, YARN_POSITION_INFORMATION YarnPosInfo, CMesh& Mesh, vector<vector<vector<double> > >& YarnSectionModifiers, bool bMaxCorrection) const;
75 void ModifySection(CYarnSectionInterpNode* pYarnSection, YARN_POSITION_INFORMATION& YarnPosInfo, vector<double>& Modifiers, int iNodeIndex, int iMidIndex = -1) const;
76
77 void AdjustSections() const;
79 void CreateTopAndBottomMeshes( CMesh& TopMesh, CMesh& BottomMesh ) const;
80 void CalculateModifiers( const CInterpolation *pInterpolation, int Yarn, YARN_POSITION_INFORMATION YarnPosInfo, CMesh& Mesh, vector<double>& YarnSectionModifiers) const;
81 XY Get2DRefPoint( XY& Point, double dAngle ) const;
82 XY RotatePoint( XY& Point, double dAngle ) const;
83 void ModifySection(CYarnSectionInterpNode* pYarnSection, YARN_POSITION_INFORMATION& YarnPosInfo, vector<double>& Modifiers, double dTargetArea, double dOriginalHeight, int iNodeIndex, int iMidIndex = -1) const;
84 double GetArea( vector<XY>& Points ) const;
85 void ReplaceSection( vector<XY>& Points, CYarnSectionInterpNode* pYarnSection, int iNodeIndex, int iMidIndex ) const;
87 const vector<PATTERN2D> &GetCellDir( int x, int y, int iDir ) const;
88 int ModifyPoints( vector<XY>& Points, vector<double>& Modifiers, vector<XY>& MaxHeight, int iModCount, double dy, vector<XY>& NewPoints ) const;
89
92 mutable vector<XY> m_YSpacing;
94 };
95}; // namespace TexGen
96
#define CLASS_DECLSPEC
Definition: Misc.h:35
Domain implementation described using planes, the simplest of which would be a box.
Definition: DomainPlanes.h:37
Abstract base class for describing the yarn path interpolations.
Definition: Interpolation.h:33
Defines the nodes and elements of a surface or volume mesh.
Definition: Mesh.h:58
Respresents a 2d woven textile with shear applied.
vector< XY > m_YSpacing
Vector containing the dx and dy components for spacings along y yarns.
string GetType() const
Derived class should return the class name.
Represents a textile cell containing yarns.
Definition: Textile.h:39
Respresents a 2d woven textile.
Creates a section which is linearly interpolated between sections defined at the nodes.
Namespace containing a series of customised math operations not found in the standard c++ library.
OUTPUT_TYPE
Definition: Misc.h:105
double GetArea(XYZ Points[], int iNumPoints)
Definition: mymath.h:1245
Struct for representing points in 2D space.
Definition: mymath.h:103
Structure used to represent the position along the length of a yarn.
Definition: YarnSection.h:36