86 lines
1.8 KiB
C++
86 lines
1.8 KiB
C++
#include "stdafx.h"
|
|
#include "AecMInterfaces.h"
|
|
|
|
AecMInterfaces::AecMInterfaces(void) { }
|
|
|
|
AecMInterfaces::~AecMInterfaces(void) { }
|
|
|
|
bool AecMInterfaces::GetInterface(const AcGePoint3d& ptHit, AecInterface& inf) const
|
|
{
|
|
AcArray<AecInterface> arInfs;
|
|
GetInterface(arInfs);
|
|
|
|
AcGePoint3d ptHit2 = ptHit;
|
|
for (int i = 0; i < arInfs.length(); i++)
|
|
{
|
|
AecInterface& infTmp = arInfs.at(i);
|
|
if (infTmp.ptPos.distanceTo(ptHit) < 1.e-2)
|
|
{
|
|
inf = infTmp;
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
//当是立管时候,不可 ptHit2.z = infTmp.ptPos.z;
|
|
//影响 AecPipeLineModify::ModifyByInfAssoc --> if (pMInfMeetWith->GetInterface(inf.ptPos,infOn))
|
|
//导致立管变更出错
|
|
if (!infTmp.vtDir.isParallelTo(AcGeVector3d::kZAxis))
|
|
ptHit2.z = infTmp.ptPos.z;
|
|
|
|
if (infTmp.ptPos.distanceTo(ptHit2) < 1.e-2)
|
|
{
|
|
inf = infTmp;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool AecMInterfaces::HasInterface(const AcGePoint3d& ptCon, const AcGeVector3d& vtDir)
|
|
{
|
|
AcArray<AecInterface> arInfs;
|
|
GetInterface(arInfs);
|
|
|
|
AcGePoint3d ptHit2 = ptCon;
|
|
for (int i = 0; i < arInfs.length(); i++)
|
|
{
|
|
AecInterface& infTmp = arInfs.at(i);
|
|
if (infTmp.ptPos.distanceTo(ptCon) < 1.e-3 && infTmp.vtDir.isParallelTo(vtDir))
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
ptHit2.z = infTmp.ptPos.z;
|
|
if (infTmp.ptPos.distanceTo(ptHit2) < 1.e-3 && infTmp.vtDir.isParallelTo(vtDir))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool AecMInterfaces::GetNearInf(const AcGePoint3d& ptOn,AecInterface& inf)
|
|
{
|
|
AcArray<AecInterface> arInfs;
|
|
GetInterface(arInfs);
|
|
|
|
bool bFind = false;
|
|
double dDis = 0.0;
|
|
double dMin = 999999999999.0;
|
|
for (int i = 0; i < arInfs.length(); i++)
|
|
{
|
|
AecInterface& infTmp = arInfs.at(i);
|
|
|
|
dDis = infTmp.ptPos.distanceTo(ptOn);
|
|
if (dDis < dMin)
|
|
{
|
|
dMin = dDis;
|
|
inf = infTmp;
|
|
bFind = true;
|
|
}
|
|
}
|
|
return bFind;
|
|
} |