MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
TL2Polyline.h
1 #ifndef _mgTL2Polyline_HH_
2 #define _mgTL2Polyline_HH_
3 
4 #include "mg/LBRep.h"
5 #include "topo/Complex.h"
6 
7 /****************************************************************/
8 /* Copyright (c) 2005 by DG Technologies, Inc. */
9 /* All rights reserved. */
10 /****************************************************************/
11 
12 class MGPosition;
13 class mgTL2parameter;
14 class MGEdge;
15 class MGLEPoint;
16 
21 
25 class mgTL2Polyline: public MGLBRep{
26 
27 public:
28 
30  WHOLE_INNER=0, //whole points are free inner points.
31  START_BOUNDARY, //only start point is connected to a boundary line.
32  END_BOUNDARY, //only end point is connected to a boundary line.
33  START_END_BOUNDARY,//Only start and end points are connected to a boundary.
34  //Inner points except start and end are not on a boundary.
35  WHOLE_BOUNDARY //All of the points are on a boundary.
36  };
37 
39 
40 //Construct null mgTL2Polyline.
42 :MGLBRep(),m_tlparam(&para),m_type(WHOLE_INNER){;};
43 
44 //Copy constructor.
45 mgTL2Polyline(const mgTL2Polyline& pline2);
46 
47 //Construct mgTL2Polyline from (u,v) curve representation of the surface.
48 //The type of the boundary is WHOLE_INNER.
50  const mgTL2parameter& para,
51  const MGCurve& uvline
52 );
53 
54 //Construct mgTL2Polyline from the straight from pvS to pvE.
55 //The straight is guaranteed to keep the deviation from the surface
56 //within tessellation curve error and within the maximum edge length.
57 //The type of the boundary is set according the boundary infromation of pvS and pvE.
59  const MGLEPoint& pvE,
60  const MGLEPoint& pvS
61 );
62 
63 polyline_type boundaryType()const{return m_type;};
64 
66 
67 //Compute the angle of this curves's world rep and u=const iso-parameter line world rep
68 //at the parameter t. The parameter t is normalized value from 0.(start point)
69 //to 1.(end point).
70 double angle2Uline(double t)const;
71 
72 //Compute the angle of this curves's world rep and u=const iso-parameter line world rep
73 //at the point id i.
74 double angle2Uline_at_i(int i)const;
75 
78 mgTL2Polyline* clone()const;
79 
80 //Get the direction of the line in the world coordinate at the normalized parameter t.
81 //The parameter t is normalized value from 0.(start point) to 1.(end point).
82 MGVector direWorld(double t)const;
83 
84 //Get the start or end point direction of the line in the world coordinate.
85 const MGVector& direWorld_start()const;
86 const MGVector& direWorld_end()const;
87 
88 //Evaluate the direction at t(not normalized ordinary parameter value) in its
89 //world representation.
91 
92 //Get id of m_Bpolylines of mgTL2Face from point id of this polyline.
93 //Function's return value is
94 //true if the point of idVertex is a boundary point, false if not.
95 bool get_id_from_VertexID(int idVertex, short id[3])const;
96 
97 //Get id of m_Bpolylines of mgTL2Face from the parameter t.
98 //Function's return value is
99 //true if the point of t is a boundary point, false if not.
100 bool get_id(double t, short id[3])const;
101 
102 //Update this by limiting the parameter range of the curve.
104 mgTL2Polyline& limit(const MGInterval& i1);
105 
107 void negate();
108 
109 //Get the number of points of this polyline.
110 int number_of_points()const{return bdim();};
111 
113 std::ostream& out(std::ostream& ostrm)const;
114 
115 const mgTL2parameter& TL2param()const{return *m_tlparam;};
116 
117 //Get i-th point surface parameter (u,v) of this polyline
118 MGPosition uv(int i)const;
119 
120 //Get start point surface parameter (u,v) of this polyline
121 const MGPosition& uv_start()const;
122 
123 //Get i-th point(x,y,z) of this polyline
124 MGPosition xyz(int i, bool need_normal)const;
125 
126 void set_type(polyline_type type){ m_type=type;};
127 void set_startID(const short start[3]);
128 void set_endID(const short end[3]);
129 
130 void get_startID(short start[3]);
131 void get_endID(short end[3]);
132 
133 private:
134  polyline_type m_type;//indicated how this line is connectied to boundaries.
135  const mgTL2parameter* m_tlparam;//Tessellation parameter.
136  short m_start[3], m_end[3];//Ids of m_Bpolylines of mgTL2Face, indicates
137  //this Polyline's start or end point. That is,
138  //e.g. let m_start[.] be (i,j,k), then k-th point of the polyline
139  //m_Bpolylines[i][j] is the start point of this polyline.
140  mutable MGPosition m_uv_start;//Start point uv data if is not null.
141  mutable MGVector m_dire_start, m_dire_end;//Start and end points direction
142  //in the world coordinate if is not null.
143 
144 void construct_TL2Polyline(
145  const mgTL2parameter& para,
146  const MGCurve& uvline
147 );
148 
149 
150 };
151 
152 //Get curve representation(MGLBRep of uniform B-Spline of order 2).
153 const mgTL2Polyline* TL2Polyline(const MGEdge* edg);
155  // end of UseTessellation group
157 #endif
MGCurve is an abstract class which represents a whole curve.
Definition: Curve.h:63
bool get_id(double t, short id[3]) const
mgTL2Polyline holds a parameter line(polyline) of a surface.
Definition: TL2Polyline.h:25
void get_startID(short start[3])
std::ostream & out(std::ostream &ostrm) const
Debug Function.
container_type::const_iterator const_pcellItr
Definition: Complex.h:34
void set_startID(const short start[3])
Definition: TL2Polyline.h:30
int bdim() const
Returns B-Rep Dimension.
Definition: LBRep.h:416
bool get_id_from_VertexID(int idVertex, short id[3]) const
MGLBRep is a class for B-SPline representation.
Definition: LBRep.h:41
MGPosition xyz(int i, bool need_normal) const
Definition: TL2Polyline.h:33
Vector of a general n space dimension.
Definition: Vector.h:26
double angle2Uline_at_i(int i) const
MGEdge is an instance of MGCellNB, represents a boundary element of 2D manifold.
Definition: Edge.h:33
mgTL2Polyline(const mgTL2parameter &para)
Definition: TL2Polyline.h:41
Interval of 1 dimension, i.e. MGInterval is a real line.
Definition: Interval.h:22
Represent a positional data.
Definition: Position.h:28
double angle2Uline(double t) const
mgTL2Polyline & limit(const MGInterval &i1)
Limitting is done at the knot parameter for both start and end.
MGVector direWorld(double t) const
Is to represent a Loop's point.
Definition: LEPoint.h:28
MGCURVE_TYPE type() const
Definition: LBRep.h:948
polyline_type boundaryType() const
Definition: TL2Polyline.h:63
Holds necessary parameter data for face tessellation.
Definition: TL2parameter.h:46
const MGVector & direWorld_start() const
polyline_type
Definition: TL2Polyline.h:29
const mgTL2Polyline * TL2Polyline(const MGEdge *edg)
const MGVector & direWorld_end() const
const MGPosition & uv_start() const
MGPosition uv(int i) const
MGVector direWorld_with_non_normalized(double t) const
void negate()
Change direction of the line.
Definition: TL2Polyline.h:31
mgTL2Polyline * clone() const
int number_of_points() const
Definition: TL2Polyline.h:110
void get_endID(short end[3])
void set_type(polyline_type type)
Definition: TL2Polyline.h:126
void set_endID(const short end[3])
const mgTL2parameter & TL2param() const
Definition: TL2Polyline.h:115
Definition: TL2Polyline.h:32
Definition: TL2Polyline.h:35