66 m_Point.x = m_Point.y = 0.;
76 CSG_TIN_Node::~CSG_TIN_Node(
void)
84 for(
int i=0; i<m_nTriangles; i++)
86 if( m_Triangles[i] == pTriangle )
93 m_Triangles[m_nTriangles++] = pTriangle;
103 bool CSG_TIN_Node::_Add_Neighbor(
CSG_TIN_Node *pNeighbor)
105 if( pNeighbor ==
this )
110 for(
int i=0; i<m_nNeighbors; i++)
112 if( m_Neighbors[i] == pNeighbor )
119 m_Neighbors[m_nNeighbors++] = pNeighbor;
125 bool CSG_TIN_Node::_Del_Relations(
void)
127 if( m_nTriangles > 0 )
134 if( m_nNeighbors > 0 )
156 if( (dx = sqrt(dx*dx + dy*dy)) > 0.0 )
171 return( z1 < z2 ? -1 : z1 > z2 ? 1 : 0 );
179 if( m_nTriangles >= 3 )
183 for(i=0; i<m_nTriangles; i++)
187 p.
Add(c.
x, c.
y, atan2(m_Point.
y - c.
y, m_Point.
x - c.
x));
192 for(i=0; i<m_nTriangles; i++)
194 Points.
Add(p[i].x, p[i].y);
231 CSG_TIN_Edge::~CSG_TIN_Edge(
void)
250 double xMin, yMin, xMax, yMax;
252 xMin = xMax = a->
Get_X();
253 yMin = yMax = a->
Get_Y();
255 if( xMin > b->
Get_X() )
257 else if( xMax < b->Get_X() )
260 if( yMin > b->
Get_Y() )
262 else if( yMax < b->Get_Y() )
265 if( xMin > c->
Get_X() )
267 else if( xMax < c->Get_X() )
270 if( yMin > c->
Get_Y() )
272 else if( yMax < c->Get_Y() )
275 m_Extent.
Assign(xMin, yMin, xMax, yMax);
293 CSG_TIN_Triangle::~CSG_TIN_Triangle(
void)
304 #define IS_ONLINE(A, B) (A.y == B.y && ((A.x <= x && x <= B.x) || (B.x <= x && x <= A.x)))
314 if( (x == m_Nodes[0]->Get_Point().x && y == m_Nodes[0]->Get_Point().y)
315 || (x == m_Nodes[1]->Get_Point().x && y == m_Nodes[1]->Get_Point().y)
316 || (x == m_Nodes[2]->Get_Point().x && y == m_Nodes[2]->Get_Point().y) )
321 if(
IS_ONLINE(m_Nodes[0]->Get_Point(), m_Nodes[1]->Get_Point())
322 ||
IS_ONLINE(m_Nodes[1]->Get_Point(), m_Nodes[2]->Get_Point())
323 ||
IS_ONLINE(m_Nodes[2]->Get_Point(), m_Nodes[0]->Get_Point()) )
329 if( (y == m_Nodes[0]->Get_Point().y && x > m_Nodes[0]->Get_Point().x)
330 || (y == m_Nodes[1]->Get_Point().y && x > m_Nodes[1]->Get_Point().x)
331 || (y == m_Nodes[2]->Get_Point().y && x > m_Nodes[2]->Get_Point().x) )
334 A.x = m_Extent.
xMin - 1.0;
347 return( nCrossings == 1 );
364 for(
int i=0; i<3; i++)
367 M[i][1] = m_Nodes[i]->
Get_X();
368 M[i][2] = m_Nodes[i]->
Get_Y();
369 Z[i] = m_Nodes[i]->
asDouble(zField);
373 B = (Mt * M).Get_Inverse() * (Mt * Z);
375 z =
B[0] +
B[1] * x +
B[2] * y;
384 double x[3], y[3], z[3],
A,
B,
C;
388 x[i] = m_Nodes[i]->
Get_X();
389 y[i] = m_Nodes[i]->
Get_Y();
390 z[i] = m_Nodes[i]->
asDouble(zField);
393 A = z[0] * (x[1] - x[2]) + z[1] * (x[2] - x[0]) + z[2] * (x[0] - x[1]);
394 B = y[0] * (z[1] - z[2]) + y[1] * (z[2] - z[0]) + y[2] * (z[0] - z[1]);
395 C = x[0] * (y[1] - y[2]) + x[1] * (y[2] - y[0]) + x[2] * (y[0] - y[1]);
402 Decline = atan(sqrt(
A*
A +
B*
B));