179 lines
2.4 KiB
C++
179 lines
2.4 KiB
C++
//-----------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TGGe3DFace3Pt Àà
|
|
// = Version : ver2.0
|
|
// = Author : wlw
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: TGGe3DFace3Pt ÀඨÒå
|
|
// = Maintainers:
|
|
//
|
|
//-----------------------------------------------------------------------------+
|
|
#include "StdAfx.h"
|
|
#include "TGGe3DFace3Pt.h"
|
|
#include "TGGeLine.h"
|
|
|
|
TGGe3DFace3Pt::TGGe3DFace3Pt(TEntitySet &entFace)
|
|
: TGGe3DFace(entFace)
|
|
{
|
|
if (GetFlag() & FLAG_UNNORMAL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
int nFlag = GetFlag();
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
int j = i + 1;
|
|
if (j == 4)
|
|
{
|
|
j = 0;
|
|
}
|
|
|
|
TGGeLine aLine(GetVertex(i), GetVertex(j));
|
|
if (aLine.GetLength() < _DIST_SNAP)
|
|
{
|
|
switch(j)
|
|
{
|
|
case 1:
|
|
SetVertex(1, GetVertex(2));
|
|
SetVertex(2, GetVertex(3));
|
|
|
|
if (nFlag & 0x02)
|
|
{
|
|
nFlag |= 0x01;
|
|
}
|
|
|
|
if (nFlag & 0x04)
|
|
{
|
|
nFlag |= 0x02;
|
|
}
|
|
|
|
if (nFlag & 0x08)
|
|
{
|
|
nFlag |= 0x04;
|
|
}
|
|
|
|
break;
|
|
case 2:
|
|
SetVertex(2, GetVertex(3));
|
|
|
|
if (nFlag & 0x04)
|
|
{
|
|
nFlag |= 0x02;
|
|
}
|
|
|
|
if (nFlag & 0x08)
|
|
{
|
|
nFlag |= 0x04;
|
|
}
|
|
|
|
break;
|
|
case 3:
|
|
if (nFlag & 0x08)
|
|
{
|
|
nFlag |= 0x04;
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
nFlag &= ~0x08;
|
|
|
|
if (nFlag == 0x01 || nFlag == 0x02 || nFlag == 0x04)
|
|
{
|
|
;
|
|
}
|
|
else
|
|
{
|
|
nFlag |= FLAG_UNNORMAL;
|
|
}
|
|
SetFlag(nFlag);
|
|
return;
|
|
}
|
|
}
|
|
|
|
nFlag |= FLAG_UNNORMAL;
|
|
SetFlag(nFlag);
|
|
}
|
|
|
|
TGGe3DFace3Pt::~TGGe3DFace3Pt()
|
|
{
|
|
|
|
}
|
|
|
|
int TGGe3DFace3Pt::GetMergeLine(TGGeLine *pLine)
|
|
{
|
|
ASSERT(pLine != NULL);
|
|
|
|
if (!(*this))
|
|
{
|
|
return RTERROR;
|
|
}
|
|
|
|
switch (GetFlag())
|
|
{
|
|
case 0x01:
|
|
pLine->SetPoints(GetVertex(0), GetVertex(1));
|
|
break;
|
|
case 0x02:
|
|
pLine->SetPoints(GetVertex(1), GetVertex(2));
|
|
break;
|
|
default:
|
|
pLine->SetPoints(GetVertex(2), GetVertex(0));
|
|
break;
|
|
}
|
|
|
|
return RTNORM;
|
|
}
|
|
|
|
|
|
int TGGe3DFace3Pt::MergeEdge()
|
|
{
|
|
if (!(*this))
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
int rc;
|
|
switch (GetFlag())
|
|
{
|
|
case 0x01:
|
|
rc = 0;
|
|
break;
|
|
case 0x02:
|
|
rc = 1;
|
|
break;
|
|
default:
|
|
rc = 2;
|
|
break;
|
|
}
|
|
|
|
return rc;
|
|
}
|
|
|
|
int TGGe3DFace3Pt::OppHidePoint()
|
|
{
|
|
if (!(*this))
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
int rc;
|
|
switch(GetFlag())
|
|
{
|
|
case 0x01:
|
|
rc = 2;
|
|
break;
|
|
case 0x02:
|
|
rc = 0;
|
|
break;
|
|
default:
|
|
rc = 1;
|
|
break;
|
|
}
|
|
|
|
return rc;
|
|
}
|
|
|
|
|