TexGen
DomainPlanes.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 "Domain.h"
22#include "Plane.h"
23
24namespace TexGen
25{
26 using namespace std;
27
29
37 {
38 public:
40 CDomainPlanes(const vector<PLANE> &Planes);
41 CDomainPlanes(const XYZ &Min, const XYZ &Max);
42 CDomainPlanes(TiXmlElement &Element);
43 ~CDomainPlanes(void);
44
45 CDomain* Copy() const { return new CDomainPlanes(*this); }
46
47 void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType = OUTPUT_STANDARD) const;
48
49 void ClipMeshToDomain(CMesh &Mesh, bool bFillGaps = true) const;
50 bool ClipMeshToDomain(CMesh &Mesh, vector<CMesh> &DomainMeshes, bool bFillGaps = true) const;
51 string GetType() const { return "CDomainPlanes"; }
52
53 void AddPlane(const PLANE &Plane);
54
56 const vector<PLANE> &GetPlanes() const { return m_Planes; }
58 bool GetBoxLimits(XYZ &Min, XYZ &Max);
60 void Grow(double dDistance);
62 void Rotate(WXYZ Rotation);
64 void Translate(XYZ Vector);
66 void Deform(CLinearTransformation Transformation);
68 int GetPlane( XYZ &Normal, PLANE &Plane );
70 void SetPlane( int index, PLANE &Plane );
71
73 bool PointInDomain(const XYZ &Point) const;
74
75 protected:
76
77
79 void BuildMesh();
80
83 static bool FillGaps(CMesh &Mesh, const PLANE &Plane, vector<int> &Polygon, bool bMeshGaps = true);
84
86 vector<PLANE> m_Planes;
87
89 vector<vector<pair<XYZ, XYZ> > > m_PlaneIntersections;
90 };
91
92}; // namespace TexGen
93
#define CLASS_DECLSPEC
Definition: Misc.h:35
Abstract base class representing the domain in which a textile cell may lie.
Definition: Domain.h:34
Domain implementation described using planes, the simplest of which would be a box.
Definition: DomainPlanes.h:37
vector< vector< pair< XYZ, XYZ > > > m_PlaneIntersections
A list of lines for each plane representing the intersections between other planes.
Definition: DomainPlanes.h:89
string GetType() const
Derived class should return the class name.
Definition: DomainPlanes.h:51
CDomain * Copy() const
Definition: DomainPlanes.h:45
const vector< PLANE > & GetPlanes() const
Accessor method to get the planes making up this domain.
Definition: DomainPlanes.h:56
vector< PLANE > m_Planes
List of planes that define the limits of the cell.
Definition: DomainPlanes.h:86
Represents a linear transformation as a 3x3 matrix.
Defines the nodes and elements of a surface or volume mesh.
Definition: Mesh.h:58
Namespace containing a series of customised math operations not found in the standard c++ library.
OUTPUT_TYPE
Definition: Misc.h:105
@ OUTPUT_STANDARD
Definition: Misc.h:107
double Max(XYZ &Vector)
Get maximum element of vector and return it.
Definition: mymath.h:642
XYZ Min(const XYZ &P1, const XYZ &P2)
Given two points, return a new point who's coordinates are the smaller of the two.
Definition: mymath.h:1142
Struct for representing a Plane.
Definition: Plane.h:25
Struct for representing a quaternion.
Definition: mymath.h:38
Struct for representing points in 3D space.
Definition: mymath.h:56