MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
TL2Fans.h
1 #ifndef _mgTL2Fans_HH_
2 #define _mgTL2Fans_HH_
3 
4 #include <vector>
5 #include "mg/Pvector.h"
6 #include "Tl2/TL2Fan.h"
7 #include "Tl2/TL2Triangle.h"
8 
9 /****************************************************************/
10 /* Copyright (c) 2005 by DG Technologies, Inc. */
11 /* All rights reserved. */
12 /****************************************************************/
13 
15 
16 class MGPosition;
17 class MGLoop;
18 class mgTL2parameter;
19 class mgTL2Polyline;
20 class mgTL2FanEdges;
21 class mgTL2LPline;
22 class mgTL2Triangles;
23 
30 
33 class mgTL2Fans{
34 public:
37 
38 friend std::ostream& operator<< (std::ostream& out, const mgTL2Fans& fans);
39 
41 mgTL2Fans(
42  const MGLoop& polygon
43 );
44 
45 mgTL2Fans(
46  std::vector<const mgTL2Polyline*>& polylines//Edges of the polyline that are mgTL2Polyline.
47 );
48 
49 mgTL2Fans(
50  const mgTL2LPline pline[4]
51 );
52 
53 mgTL2Fans(
54  const mgTL2Polyline* pline[4]
55 );
56 
58 const mgTL2Fan* operator[](int i)const{return m_fans[i];};
59 mgTL2Fan* operator[](int i){return m_fans[i];};
60 
62 
63  const_iterator begin()const{return m_fans.begin();};
64  const_iterator end()const{return m_fans.end();};
65  iterator begin(){return m_fans.begin();};
66  iterator end(){return m_fans.end();};
67 
68 
70  int find3rdV(
71  int alpha,
72  int beta,
73  int& status
74  );
75 
78  void init_edgeStack(
79  mgTL2FanEdges& edgeStack
80  );
81 
83  bool is_boundary(int alpha, int beta) const;
84 
87  bool has_isect(
88  int v1,
89  int v2
90  )const;
91 
92  void push_back(mgTL2Fan* fan){m_fans.push_back(fan);};
93  void push_back(mgTL2Fans& fans){m_fans.push_back(fans.m_fans);};
94 
97  void push1Vaft(
98  int alpha,
99  int beta,
100  int gamma
101  );
102 
105  void push1Vbefore(
106  int alpha,
107  int beta,
108  int gamma
109  );
110 
112  void push2V(
113  int gamma,
114  int alpha,
115  int beta
116  );
117 
119  void set_edge_used(int alpha, int beta);
120 
122  int size() const{return (int)m_fans.size();};
123 
126  void triangulate(
127  mgTL2Triangles& triangles
128  )const;
129 
131  bool used(int alpha) const;
132 
134  bool used(int alpha, int beta) const;
135 
137  MGPosition uv(int i)const;
138 
140  MGPosition xyz(int i, bool need_normal)const;
141 
143 private:
144  MGPvector<mgTL2Fan> m_fans;
145  std::vector<mgTL2LPline> m_polylines;
146 
147  //Construct mgTL2Fans, that is, construct m_fans from m_polylines.
148  void initialize();
149 };
150 
153 void triangulate(
154  const MGLoop& polygon,
155  mgTL2Triangles& triangles
157 );
158 
161 void triangulate(
162  const mgTL2LPline polygon[4],
163  mgTL2Triangles& triangles
164 );
165 
168 void triangulate(
169  const mgTL2Polyline* polygon[4],
170  mgTL2Triangles& triangles
171 );
172  // end of UseTessellation group
174 #endif
const_iterator begin() const
Return const_iterator that points to the first element in the sequence.
Definition: Pvector.h:147
mgTL2LPline is limitted subinterval of mgTL2Polyline.
Definition: TL2LPline.h:23
const_iterator begin() const
Definition: TL2Fans.h:63
bool used(int alpha) const
check if vertex(alpha) is used or not.
mgTL2Polyline holds a parameter line(polyline) of a surface.
Definition: TL2Polyline.h:25
const mgTL2Fan * operator[](int i) const
Definition: TL2Fans.h:58
A vector of mgTL2Triangle's.
Definition: TL2Triangles.h:25
const_iterator end() const
Definition: TL2Fans.h:64
const_iterator end() const
Return const_iterator that points one past the last element.
Definition: Pvector.h:174
Defines a vector mgTL2Fan.
Definition: TL2Fans.h:33
void set_edge_used(int alpha, int beta)
Set edge(alpha,j) as used.
MGPosition xyz(int i, bool need_normal) const
Retrieve world coordinate value (x,y,z) of the i-th vertex.
mgTL2Fans(const MGLoop &polygon)
size_type size() const
Return the number of items that are in the sequence.
Definition: Pvector.h:342
mgTL2Fan * operator[](int i)
Definition: TL2Fans.h:59
bool is_boundary(int alpha, int beta) const
Test if the edge(alpha, beta) is boundary or not.
void push1Vaft(int alpha, int beta, int gamma)
void triangulate(mgTL2Triangles &triangles) const
void init_edgeStack(mgTL2FanEdges &edgeStack)
iterator end()
Definition: TL2Fans.h:66
int find3rdV(int alpha, int beta, int &status)
3点目の頂点(id of m_fans)を求める(頂点は使用点となる)
Represent a positional data.
Definition: Position.h:28
MGLoop is a boundary of a face, a boundary of 2D manifold cell.
Definition: Loop.h:44
Holds necessary parameter data for face tessellation.
Definition: TL2parameter.h:46
int size() const
Get the number of fans included.
Definition: TL2Fans.h:122
void push_back(T *x)
push element x at the end.
Definition: Pvector.h:250
bool has_isect(int v1, int v2) const
mgTL2Fan is a point list to constitue a fan.
Definition: TL2Fan.h:38
iterator begin()
Definition: TL2Fans.h:65
MGPvector< mgTL2Fan >::const_iterator const_iterator
Definition: TL2Fans.h:36
friend std::ostream & operator<<(std::ostream &out, const mgTL2Fans &fans)
void triangulate(const MGLoop &polygon, mgTL2Triangles &triangles)
MGPosition uv(int i) const
Retrieve surface parameter value (u,v) of the i-th vertex.
void push_back(mgTL2Fans &fans)
Definition: TL2Fans.h:93
void push_back(mgTL2Fan *fan)
Definition: TL2Fans.h:92
MGPvector< mgTL2Fan >::iterator iterator
Definition: TL2Fans.h:35
Defines Vector of newed object pointers.
Definition: Pvector.h:27
void push2V(int gamma, int alpha, int beta)
目的:中心点(center)がgammaで頂点(alpha,beta)のものを新規に作成する
void push1Vbefore(int alpha, int beta, int gamma)