TexGen
Core
BasicVolumes.h
Go to the documentation of this file.
1
/*=============================================================================
2
TexGen: Geometric textile modeller.
3
Copyright (C) 2006 Martin Sherburn
4
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 2
8
of the License, or (at your option) any later version.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
=============================================================================*/
19
20
#pragma once
21
22
#include "
Mesh.h
"
23
24
namespace
TexGen
25
{
26
using namespace
std;
27
28
// class CYarn;
29
class
CTextile;
30
32
class
CLASS_DECLSPEC
CBasicVolumes
33
{
34
public
:
35
CBasicVolumes
(
void
);
36
~CBasicVolumes
(
void
);
37
38
bool
CreateBasicVolumes(
CTextile
&Textile);
39
bool
CreateBasicVolumes(
string
TextileName);
40
41
void
SetSeed
(
double
dSeed) { m_dSeed = dSeed; }
42
double
GetSeed
() {
return
m_dSeed; }
43
44
void
SetPeriodic
(
bool
bPeriodic) { m_bCreatePeriodic = bPeriodic; }
45
bool
GetPeriodic
() {
return
m_bCreatePeriodic; }
46
47
void
SetDebug
(
bool
bDebug) { m_bDebug = bDebug; }
48
bool
GetDebug
() {
return
m_bDebug; }
49
50
protected
:
51
enum
LINE_STATE
52
{
53
FORWARD = 1,
54
REVERSE = 2,
55
};
56
58
struct
PROJECTED_REGION
59
{
60
vector<int>
SegmentIndices
;
61
vector<int>
YarnIndices
;
62
vector<int>
ContourNodes
;
63
XYZ
Center
;
64
double
dArea
;
65
PROJECTED_REGION
():dArea(0){}
66
};
67
69
72
struct
ProjectedRegionArea
73
{
74
bool
operator()
(
const
PROJECTED_REGION
& left,
const
PROJECTED_REGION
& right)
75
{
76
return
left.
dArea
< right.
dArea
;
77
}
78
};
79
80
void
SaveProjectedContoursToVTK(
string
Filename);
81
void
SaveProjectedAreasToVTK(
string
Filename);
82
bool
ValidProjectedMesh();
83
int
SplitLinesByNodes(
CMesh
&Mesh);
84
int
SplitLinesByLines(
CMesh
&Mesh);
85
int
MergeStraightLines(
CMesh
&Mesh);
86
int
RemoveDuplicateSegments(
CMesh
&Mesh);
87
int
RemoveDegenerateSegments(
CMesh
&Mesh);
88
CMesh
GetProjectedMesh(
const
CMesh
&Mesh);
89
bool
GetCommonEdgeIndices(
int
Indices1[3],
int
Indices2[3],
int
Common[2]);
90
bool
CreateProjectedAreas();
91
bool
SeedOuterBoundary();
92
bool
RemoveOuterBoundary();
93
double
GetRegionArea(
const
PROJECTED_REGION &Region);
94
bool
CreateProjectedCenters();
95
bool
PointInsideRegion(
XYZ
Point,
int
iRegion);
96
void
CalculateYarnIndices();
97
bool
MeshProjectedAreas();
110
bool
GetMeshVerticalBounds(
const
CMesh
&Mesh,
XYZ
Point,
double
&dMinZ,
double
&dMaxZ,
bool
bForceFind =
false
);
111
112
CMesh
m_ProjectedMesh
;
113
CMesh
m_DomainMesh
;
114
vector<CMesh>
m_YarnMeshes
;
115
vector<PROJECTED_REGION>
m_ProjectedRegions
;
116
// vector<int> m_TriangleNeighbors;
117
118
// A map of triangle index to their region number
119
vector<int>
m_TriangleRegions
;
120
double
m_dTolerance
;
121
CTextile
*
m_pTextile
;
122
double
m_dSeed
;
123
bool
m_bCreatePeriodic
;
124
bool
m_bDebug
;
125
};
126
127
};
// namespace TexGen
128
129
130
131
132
133
134
135
136
137
138
139
140
Mesh.h
CLASS_DECLSPEC
#define CLASS_DECLSPEC
Definition:
Misc.h:35
TexGen::CBasicVolumes
Class for meshing fabric unit cells.
Definition:
BasicVolumes.h:33
TexGen::CBasicVolumes::LINE_STATE
LINE_STATE
Definition:
BasicVolumes.h:52
TexGen::CBasicVolumes::GetPeriodic
bool GetPeriodic()
Definition:
BasicVolumes.h:45
TexGen::CBasicVolumes::m_DomainMesh
CMesh m_DomainMesh
Definition:
BasicVolumes.h:113
TexGen::CBasicVolumes::m_YarnMeshes
vector< CMesh > m_YarnMeshes
Definition:
BasicVolumes.h:114
TexGen::CBasicVolumes::m_dSeed
double m_dSeed
Definition:
BasicVolumes.h:122
TexGen::CBasicVolumes::m_bCreatePeriodic
bool m_bCreatePeriodic
Definition:
BasicVolumes.h:123
TexGen::CBasicVolumes::GetDebug
bool GetDebug()
Definition:
BasicVolumes.h:48
TexGen::CBasicVolumes::m_dTolerance
double m_dTolerance
Definition:
BasicVolumes.h:120
TexGen::CBasicVolumes::m_ProjectedRegions
vector< PROJECTED_REGION > m_ProjectedRegions
Definition:
BasicVolumes.h:115
TexGen::CBasicVolumes::m_TriangleRegions
vector< int > m_TriangleRegions
Definition:
BasicVolumes.h:119
TexGen::CBasicVolumes::SetSeed
void SetSeed(double dSeed)
Definition:
BasicVolumes.h:41
TexGen::CBasicVolumes::m_pTextile
CTextile * m_pTextile
Definition:
BasicVolumes.h:121
TexGen::CBasicVolumes::GetSeed
double GetSeed()
Definition:
BasicVolumes.h:42
TexGen::CBasicVolumes::SetDebug
void SetDebug(bool bDebug)
Definition:
BasicVolumes.h:47
TexGen::CBasicVolumes::m_bDebug
bool m_bDebug
Definition:
BasicVolumes.h:124
TexGen::CBasicVolumes::m_ProjectedMesh
CMesh m_ProjectedMesh
Definition:
BasicVolumes.h:112
TexGen::CBasicVolumes::SetPeriodic
void SetPeriodic(bool bPeriodic)
Definition:
BasicVolumes.h:44
TexGen::CMesh
Defines the nodes and elements of a surface or volume mesh.
Definition:
Mesh.h:58
TexGen::CTextile
Represents a textile cell containing yarns.
Definition:
Textile.h:39
TexGen
Namespace containing a series of customised math operations not found in the standard c++ library.
Definition:
AdjustMeshInterference.h:27
TexGen::CBasicVolumes::PROJECTED_REGION
Struct representing a region projected onto the XY plane.
Definition:
BasicVolumes.h:59
TexGen::CBasicVolumes::PROJECTED_REGION::SegmentIndices
vector< int > SegmentIndices
Definition:
BasicVolumes.h:60
TexGen::CBasicVolumes::PROJECTED_REGION::dArea
double dArea
Definition:
BasicVolumes.h:64
TexGen::CBasicVolumes::PROJECTED_REGION::ContourNodes
vector< int > ContourNodes
Definition:
BasicVolumes.h:62
TexGen::CBasicVolumes::PROJECTED_REGION::PROJECTED_REGION
PROJECTED_REGION()
Definition:
BasicVolumes.h:65
TexGen::CBasicVolumes::PROJECTED_REGION::Center
XYZ Center
Definition:
BasicVolumes.h:63
TexGen::CBasicVolumes::PROJECTED_REGION::YarnIndices
vector< int > YarnIndices
Definition:
BasicVolumes.h:61
TexGen::CBasicVolumes::ProjectedRegionArea
Functor defining the < operator based on the projected region's area.
Definition:
BasicVolumes.h:73
TexGen::CBasicVolumes::ProjectedRegionArea::operator()
bool operator()(const PROJECTED_REGION &left, const PROJECTED_REGION &right)
Definition:
BasicVolumes.h:74
TexGen::XYZ
Struct for representing points in 3D space.
Definition:
mymath.h:56
Generated by
1.9.2