MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
TL2LPline.h
1 #ifndef _mgTL2LPline_HH_
2 #define _mgTL2LPline_HH_
3 
4 #include "Tl2/TL2Polyline.h"
5 
6 /****************************************************************/
7 /* Copyright (c) 2011 by DG Technologies, Inc. */
8 /* All rights reserved. */
9 /****************************************************************/
10 
11 class MGPosition;
12 
17 
24 
25 public:
26 
28 mgTL2LPline():m_polyline(0),m_idS(0),m_nV(0){;};
29 
32  const mgTL2LPline& lpline
33 ):m_polyline(lpline.m_polyline),m_idS(lpline.m_idS),m_nV(lpline.m_nV){;};
34 
35 //Constructor of whole mgTL2Polyline.
37  const mgTL2Polyline* polyline //Original mgTL2Polyline pointer.
38 ):m_polyline(polyline),m_idS(0),m_nV(polyline->bdim()){;};
39 
41  const mgTL2Polyline* polyline, //Original mgTL2Polyline pointer.
42  int idS, //starting id. Not relative, but absolute value of m_polyline.
43  int nV
44 ):m_polyline(polyline),m_idS(idS),m_nV(nV){;};
45 
48  const mgTL2LPline& lpline,
49  int idS, //starting id of lpline
50  int nV
51 );
52 
54 
55 //Change m_polyline's id to this mgTL2LPline's id.
56 //Function's return value is true if id_in is valid id for this mgTL2LPline.
57 //False if not.
58 bool change_id(
59  int id_in, //id of m_polyline.
60  int& id_out //id of this will be output.
61 )const;
62 
65 mgTL2LPline* clone()const;
66 
67 //Evaluation of this with the normalized parameter value t from 0. to 1.
68 //is provided. t=0. for the start point, t=1. for the end point.
69 MGVector eval(double t, int nderi=0)const;
70 
71 //Get id of m_Bpolylines of m_param of m_polyline from vertex id i.
72 //Function's return value is
73 //true if the point of t is a boundary point, false if not.
74 bool get_id_from_VertexID(int i, short id[3])const;
75 
77 bool is_null()const{return m_polyline==0;};
78 void setNull();
79 
80 //Compute the intersections of sl and this mgTL2LPline.
81 //Function's return value is the (nearest) intersection vertex id of lp if >=0.
82 //If return value is minus, intersection not found.
83 int isectSlTl(
84  const MGStraight& sl
85 )const;
86 
87 //Update this by limiting the parameter range of the curve.
90  int idS, //start point id of this mgTL2LPline.
91  int nV //Number of vertices.
92 );
93 
94 //Get the number of points of this polyline.
95 int number_of_points()const;
96 
98 std::auto_ptr<mgTL2Polyline> getPolygonizedMidLine(
99  const mgTL2LPline& lp2,
100  int& id0, int& id2
101 )const;
102 
103 //Polygonize of the (u,v) space straight line from this->uv(id1V) to pline2.uv(id2V).
104 //The direction of the output is from id1V to id2V.
105 //polygonizeSL does ensure the deviation from the surface to be within the surface
106 //tolerance.
107 std::auto_ptr<mgTL2Polyline> polygonizeSL(
108  const mgTL2LPline& pline2,
109  int id1V, //id of this vertex.
110  int id2V //id of pline2's vertex.
111 )const;
112 
114 std::ostream& out(std::ostream& ostrm)const;
115 
116 //Reverse the direction.
117 void reverse();
118 
119 //Subdivide at the id.
120 void subdivide(
121  int id, //Relative one that start from 0 even for opposite direction.
122  mgTL2LPline& lp1, //devided 1st mgTL2LPline.
123  mgTL2LPline& lp2 //devided 2nd mgTL2LPline.
124 )const;
125 
126 //Obtain the mid point of this line.
127 void mid(MGPosition& uvmid);
128 
129 const mgTL2Polyline* TL2Polyline()const{return m_polyline;};
130 const mgTL2parameter& TL2param()const{return m_polyline->TL2param();};
131 
132 //Get i-th point surface parameter (u,v) of this polyline
133 MGPosition uv(int i)const;
134 
135 //Get i-th point(x,y,z) of this polyline
136 MGPosition xyz(int i, bool need_normal=false)const;
137 
139 friend std::ostream& operator<< (std::ostream& ot, const mgTL2LPline& poly){
140  return poly.out(ot);};
141 
142 private:
143  const mgTL2Polyline* m_polyline;//Original mgTL2Polyline pointer.
144  int m_idS;//starting id. Not relative, but absolute value of m_polyline.
145  int m_nV; //Number of vertices.
146  //When m_nv>0, this mgTL2LPline's direction is the same as m_polyline's.
147  //When m_nv<0, this mgTL2LPline's direction is opposite to m_polyline's.
148 
151 };
152  // end of UseTessellation group
154 #endif
mgTL2LPline is limitted subinterval of mgTL2Polyline.
Definition: TL2LPline.h:23
std::auto_ptr< mgTL2Polyline > polygonizeSL(const mgTL2LPline &pline2, int id1V, int id2V) const
friend std::ostream & operator<<(std::ostream &ot, const mgTL2LPline &poly)
string stream function
Definition: TL2LPline.h:139
mgTL2LPline * clone() const
mgTL2Polyline holds a parameter line(polyline) of a surface.
Definition: TL2Polyline.h:25
void reverse()
mgTL2LPline(const mgTL2LPline &lpline)
Copy constructor.
Definition: TL2LPline.h:31
const mgTL2parameter & TL2param() const
Definition: TL2LPline.h:130
int number_of_points() const
bool change_id(int id_in, int &id_out) const
Vector of a general n space dimension.
Definition: Vector.h:26
const mgTL2Polyline * TL2Polyline() const
Definition: TL2LPline.h:129
std::ostream & out(std::ostream &ostrm) const
Debug Function.
MGVector eval(double t, int nderi=0) const
int isectSlTl(const MGStraight &sl) const
MGStraight is a curve of any space dimension, represent a straight line.
Definition: Straight.h:49
void subdivide(int id, mgTL2LPline &lp1, mgTL2LPline &lp2) const
bool get_id_from_VertexID(int i, short id[3]) const
Represent a positional data.
Definition: Position.h:28
Holds necessary parameter data for face tessellation.
Definition: TL2parameter.h:46
std::auto_ptr< mgTL2Polyline > getPolygonizedMidLine(const mgTL2LPline &lp2, int &id0, int &id2) const
Get the midline from this->uv(id0) to lp2.uv(id2).
MGPosition xyz(int i, bool need_normal=false) const
void mid(MGPosition &uvmid)
mgTL2LPline(const mgTL2Polyline *polyline, int idS, int nV)
Definition: TL2LPline.h:40
mgTL2LPline(const mgTL2Polyline *polyline)
Definition: TL2LPline.h:36
mgTL2LPline & limit(int idS, int nV)
Limitting is done at the knot parameter for both start and end.
bool is_null() const
Test if this is a null LPline.
Definition: TL2LPline.h:77
MGPosition uv(int i) const
const mgTL2parameter & TL2param() const
Definition: TL2Polyline.h:115
void setNull()
mgTL2LPline()
Default constructor.
Definition: TL2LPline.h:28