TexGen
Domain.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
22#include "Mesh.h"
24
25namespace TexGen
26{
27 using namespace std;
28
29 class CYarn;
30 class CDomainPrism;
31
34 {
35 public:
36 CDomain(void);
37 CDomain(TiXmlElement &Element);
38 virtual ~CDomain(void);
39
40 virtual CDomain* Copy() const = 0;
41
43 virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType = OUTPUT_STANDARD) const;
44
47 vector<pair<int, int> > GetRepeatLimits(const CYarn &Yarn) const;
49 vector<XYZ> GetTranslations(const CYarn &Yarn) const;
50
52
62 virtual void ClipMeshToDomain(CMesh &Mesh, bool bFillGaps = true) const = 0;
64
69 virtual bool ClipMeshToDomain(CMesh &Mesh, vector<CMesh> &DomainMeshes, bool bFillGaps = true) const = 0;
71 virtual string GetType() const = 0;
73 const CMesh &GetMesh() const { return m_Mesh; }
75 virtual double GetVolume() const;
77 virtual void Grow(double dDistance) = 0;
79 virtual void Rotate(WXYZ Rotation) = 0;
81 virtual void Translate(XYZ Vector) = 0;
83 virtual void Deform(CLinearTransformation Transformation) = 0;
84
86 virtual bool PointInDomain(const XYZ &Point) const = 0;
87
88 CDomainPrism* GetPrismDomain();
89
90 protected:
91 static vector<pair<int, int> > ConvertLimitsToInt(const vector<pair<double, double> > &RepeatLimits);
92
94
102 pair<double, double> GetLimits(XYZ RepeatVector, const CMesh &Mesh) const;
103
105
109 bool MeshIntersectsDomain(const CMesh &Mesh) const;
110
113
114 };
115
116}; // namespace TexGen
#define CLASS_DECLSPEC
Definition: Misc.h:35
Abstract base class representing the domain in which a textile cell may lie.
Definition: Domain.h:34
virtual bool PointInDomain(const XYZ &Point) const =0
Check if a point lies inside the domain.
virtual void ClipMeshToDomain(CMesh &Mesh, bool bFillGaps=true) const =0
Clip the surface elements to the domain.
virtual void Translate(XYZ Vector)=0
Translate the domain by given vector.
virtual string GetType() const =0
Derived class should return the class name.
virtual bool ClipMeshToDomain(CMesh &Mesh, vector< CMesh > &DomainMeshes, bool bFillGaps=true) const =0
Clip the surface elements to the domain.
virtual void Grow(double dDistance)=0
Make the domain larger (used mainly for rendering purposes)
const CMesh & GetMesh() const
Get the mesh representing the domain as a surface mesh.
Definition: Domain.h:73
virtual CDomain * Copy() const =0
virtual void Deform(CLinearTransformation Transformation)=0
Deform the domain by given linear transformation.
virtual void Rotate(WXYZ Rotation)=0
Rotate the domain by given rotation quaternion.
CMesh m_Mesh
A mesh representing the domain as a surface mesh.
Definition: Domain.h:112
Domain implementation described using extrusion of a polygon outline.
Definition: DomainPrism.h:36
Represents a linear transformation as a 3x3 matrix.
Defines the nodes and elements of a surface or volume mesh.
Definition: Mesh.h:58
Represents a yarn consisting of master nodes, section and interpolation function.
Definition: Yarn.h:49
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
Struct for representing a quaternion.
Definition: mymath.h:38
Struct for representing points in 3D space.
Definition: mymath.h:56