// MediumT.cpp: implementation of the CMediumT class. // ////////////////////////////////////////////////////////////////////// #include "geomative.h" #include "MediumT.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif extern int g_iUILanguage; ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CMediumT::CMediumT(int iAR): CMedium(iAR) { } CMediumT::~CMediumT() { } bool CMediumT::GenerateSptRecElecVal(int iEAmount, //电极总数---in int* pMaxLevel, //最大层---out int* pPtAmount, //测点总数---out CPtrArray* pSptRecArray //脚本记录集---out ) //函数功能:生成脚本电极记录集合 { return true; } void CMediumT::CalculateSptPtLoc(int iMul, //倍数---in CSptRecord* pSptRecord //脚本记录指针---out ) //函数功能:计算脚本测点位置 { return; } int CMediumT::GenSptRecLevel(int iA, int iB, int iM, int iN) { return (int)VAL_ZERO; } int CMediumT::GenSptRecPosInLevel(int iA, int iB, int iM, int iN) { return (int)VAL_ZERO; } int CMediumT::GetMaxLevelByEAmount(int iEAmount) { return (int)VAL_ZERO; } float CMediumT::CalculateDepth(float fA, float fFactor) { // return (float)(fabs(fB)+fabs(fA))*fFactor; return (float)((fabs(fA)/0.5)*fFactor); // return 0.0; } float CMediumT::CalculateCESptKVal(float fA, float fB, float fX, float fY) { float fK = (float)VAL_ZERO; // float fAM = (float)VAL_ZERO; // float fAN = (float)VAL_ZERO; // float fBM = (float)VAL_ZERO; // float fBN = (float)VAL_ZERO; // fAM = sqrtf((fA + fX - fB) * (fA + fX - fB) + fY * fY); // fAN = sqrtf((fA + fX + fB) * (fA + fX + fB) + fY * fY); // fBM = sqrtf((fX - fB - fA) * (fX - fB - fA) + fY * fY); // fBN = sqrtf((fX + fB - fA) * (fX + fB - fA) + fY * fY); // // fK = (float)(2.0 * VAL_PI / fabsf((float)(1.0 / fAM - 1.0 / fAN - 1.0 / fBM - 1.0 / fBN))); if (0 == fB) { if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("b的值不能为零!")); else MessageBoxEx(NULL, _T("The value of b can not be zero!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return 0; } float fAM = sqrt(pow(fA+fX-fB, 2) + pow(fY,2)); float fAN = sqrt(pow(fA+fX+fB, 2) + pow(fY,2)); float fBM = sqrt(pow(fX-fB-fA, 2) + pow(fY,2)); float fBN = sqrt(pow(fX+fB-fA, 2) + pow(fY,2)); fK = 2*VAL_PI/fabsf(1.0/fAM - 1.0/fAN - 1.0/fBM + 1.0/fBN); //由于采用新的算法,旧的算法注释掉20170316 /* float fAPlusX = fA + fX; float fANegativeX = fA - fX; float fTmp1 = fAPlusX/sqrt(pow(fAPlusX*fAPlusX + fY*fY, 3)); float fTmp2 = fANegativeX/sqrt(pow(fANegativeX*fANegativeX + fY*fY, 3)); fK = VAL_PI/(fB * (fTmp1+fTmp2)); */ return fK; }