TexGen
SlaveNode.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 "Node.h"
22#include "Mesh.h"
23namespace TexGen
24{
25
26 using namespace std;
27
30 {
31 public:
32 CSlaveNode(XYZ Position = XYZ(), XYZ Tangent = XYZ(), XYZ Up = XYZ());
33 CSlaveNode(TiXmlElement &Element);
34 ~CSlaveNode(void);
35
36 void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const;
37
39
44 void UpdateSectionPoints(const vector<XY> *p2DSectionPoints = NULL);
45
47
53 XYZ GetPointOnSection(const XY &p2DSectionPoints);
54
56
61 void UpdateSectionMesh(const CMesh *p2DSectionMesh = NULL);
62
64 void Rotate(WXYZ Rotation);
65
67 void Translate(XYZ Vector);
68
69 // Accessor functions
70 double GetT() const { return m_T; }
71 void SetT(double t) { m_T = t; }
72 int GetIndex() const { return m_iIndex; }
73 void SetIndex(int iIndex) { m_iIndex = iIndex; }
74 const vector<XYZ> &GetSectionPoints() const { return m_SectionPoints; }
75 const vector<XY> &Get2DSectionPoints() const { return m_2DSectionPoints; }
76 const CMesh &Get2DSectionMesh() const { return *m_2DSectionMesh; }
77 const CMesh &GetSectionMesh() const { return *m_SectionMesh; }
78
79 inline bool operator < ( const CSlaveNode &right)
80 {
81 return m_T < right.m_T;
82 }
83
84 protected:
88 vector<XYZ> m_SectionPoints;
94 double m_T;
97 };
98
99
100
101}; // namespace TexGen
#define CLASS_DECLSPEC
Definition: Misc.h:35
#define NULL
Definition: ShinyConfig.h:50
Defines the nodes and elements of a surface or volume mesh.
Definition: Mesh.h:58
Represents a point on the centreline of a yarn.
Definition: Node.h:28
A derivation of the CNode class which contains data specific to slave nodes such as sections.
Definition: SlaveNode.h:30
const CMesh & GetSectionMesh() const
Definition: SlaveNode.h:77
double GetT() const
Definition: SlaveNode.h:70
CMesh * m_SectionMesh
Section mesh in 3D.
Definition: SlaveNode.h:92
CMesh * m_2DSectionMesh
Section mesh in 2D.
Definition: SlaveNode.h:90
vector< XYZ > m_SectionPoints
Coordinates of the cross-section edge points in 3D.
Definition: SlaveNode.h:88
const vector< XY > & Get2DSectionPoints() const
Definition: SlaveNode.h:75
void SetT(double t)
Definition: SlaveNode.h:71
double m_T
T is the parameter which varies from 0 to 1 which tells us how far along the link the node is.
Definition: SlaveNode.h:94
const CMesh & Get2DSectionMesh() const
Definition: SlaveNode.h:76
const vector< XYZ > & GetSectionPoints() const
Definition: SlaveNode.h:74
int GetIndex() const
Definition: SlaveNode.h:72
vector< XY > m_2DSectionPoints
Coordinates of the cross-section edge points in 2D.
Definition: SlaveNode.h:86
void SetIndex(int iIndex)
Definition: SlaveNode.h:73
int m_iIndex
Index which determines between which master nodes this slave node lies, varies from 0 to number of no...
Definition: SlaveNode.h:96
Namespace containing a series of customised math operations not found in the standard c++ library.
OUTPUT_TYPE
Definition: Misc.h:105
bool operator<(const PROP_YARN_INFO &left, const PROP_YARN_INFO &right)
Used for sorting algorithms.
Struct for representing a quaternion.
Definition: mymath.h:38
Struct for representing points in 2D space.
Definition: mymath.h:103
Struct for representing points in 3D space.
Definition: mymath.h:56