Exemplo n.º 1
0
 CAxisRotation::CAxisRotation(const CQuaternion & oQuat) {
    CLog oLog("math","CAxisRotation::Constructor (CQuaternion)",LL_OBJECT);
    double dHalfAngle = acos(oQuat.Scalar());
    double dSinHalfAngle = sin(dHalfAngle);
    m_dAngle = 2.0F * dHalfAngle;
    if (fabs(dSinHalfAngle) == 0) {
       CVector3D temp(0,1,0);
       m_oAxis = temp;
    }
    else {
       m_oAxis = oQuat.Vector() / dSinHalfAngle;
    }
 } //CAxisRotation(const CQuaternion & quat)
Exemplo n.º 2
0
//************************************
// Method:    OnOpLog
// FullName:  CImgView::OnOpLog
// Access:    protected 
// Returns:   void
// Qualifier:
//************************************
void CImgView::OnOpLog() 
{
	// TODO: Add your command handler code here
	procStatus eRetCode = eNormal;
	CLogarihDlg oDlg;
	INT nRes = oDlg.DoModal();		
	if(nRes == IDOK)
	{
		CPGTLogTransformer oLog(oDlg.m_nConst);
		
		eRetCode = process(&oLog);
		if(eRetCode != eNormal)
		{
			AfxMessageBox(CUtility::MessageTranslate(eRetCode));
		}
	}	
}
Exemplo n.º 3
0
 char* CAxisRotation::ToString(int iPrecision) const {       
    CLog oLog("math","CAxisRotation::ToString");
    // Allocate output buffer space and initialise it to a null string.
    char* pcOutput = (char*)malloc(512);
    pcOutput[0] = 0;
    char* pcStr = 0;
    // Create axis string
    pcStr = m_oAxis.ToString(iPrecision);
    strcat(pcOutput,pcStr);
    free(pcStr);
    strcat(pcOutput," ");
    // Create angle string
    CScalar oComponent(m_dAngle);
    pcStr = oComponent.ToString(iPrecision);
    strcat(pcOutput,pcStr);
    free(pcStr);
    // Chop string and return
    int length = strlen(pcOutput) + 1;
    pcOutput = (char*)realloc(pcOutput,length);
    return pcOutput;
 } //ToString(int iPrecision) const
Exemplo n.º 4
0
 int CTriModel::NumMeshes(void) const {
    CLog oLog("3d","CTriModel::NumMeshes",LL_FUNCTION);
    return m_oMeshes.size();
 }
Exemplo n.º 5
0
 CTriModel::~CTriModel() {
    CLog oLog("3d","CTriModel::Destructor",LL_OBJECT);
 }
Exemplo n.º 6
0
 CTriModel::CTriModel() {
    CLog oLog("3d","CTriModel::Constructor (default)",LL_OBJECT);
 }
Exemplo n.º 7
0
 CAxisRotation CAxisRotation::MergeOutside(const CAxisRotation & oRot) const{
    CLog oLog("math","CAxisRotation::MergeOutside");
    return oRot.MergeInside(*this);
 }
Exemplo n.º 8
0
 CAxisRotation CAxisRotation::MergeInside(const CAxisRotation & oRot) const{
    CLog oLog("math","CAxisRotation::MergeInside");
    CQuaternion first(*this);
    CQuaternion second(oRot);
    return CAxisRotation(first * second);
 }
Exemplo n.º 9
0
 bool CAxisRotation::operator ==(const CAxisRotation& oRot) const {
    CLog oLog("math","CAxisRotation::operator==");
    return ((m_dAngle == oRot.m_dAngle) && (m_oAxis == oRot.m_oAxis));
 }
Exemplo n.º 10
0
 CAxisRotation& CAxisRotation::operator=(const CAxisRotation& oRot) {
    CLog oLog("math","CAxisRotation::operator=");
    m_oAxis = oRot.m_oAxis;
    m_dAngle = oRot.m_dAngle;
    return *this;
 } //operator=(const CAxisRotation& oRot)
Exemplo n.º 11
0
 void CAxisRotation::ToDouble(double& dX, double& dY, double& dZ, double& dAngle) const {
    CLog oLog("math","CAxisRotation::ToDouble");
    m_oAxis.ToDouble(dX, dY, dZ);
    dAngle = m_dAngle;
 } //ToDouble(double& dX, double& dY, double& dZ, double& dAngle) const
Exemplo n.º 12
0
 CMesh& CTriModel::Mesh(int iMesh) {
    CLog oLog("3d","CTriModel::Mesh",LL_FUNCTION);
    return m_oMeshes[iMesh];
 }
Exemplo n.º 13
0
 CAxisRotation::CAxisRotation(const CVector3D & oAxis, const double dAngle) :
    m_dAngle(dAngle),
    m_oAxis(oAxis)
 {
    CLog oLog("math","CAxisRotation::Constructor (CVector3D,double)",LL_OBJECT);
 } //CAxisRotation(const CVector3D & oAxis, const double dAngle)
Exemplo n.º 14
0
 CAxisRotation::CAxisRotation(const double dX, const double dY, const double dZ, const double dAngle) :
    m_dAngle(dAngle),
    m_oAxis(dX,dY,dZ)
 {
    CLog oLog("math","CAxisRotation::Constructor (doubles)",LL_OBJECT);
 } //CAxisRotation(const double dX, const double dY, const double dZ, const double dAngle)
Exemplo n.º 15
0
 CAxisRotation::CAxisRotation(const CAxisRotation & oRot) :
    m_dAngle(oRot.m_dAngle),
    m_oAxis(oRot.m_oAxis)
 {
    CLog oLog("math","CAxisRotation::Constructor (copy)",LL_OBJECT);
 } //CAxisRotation(const CAxisRotation & rot)
Exemplo n.º 16
0
 CAxisRotation::CAxisRotation() :
    m_dAngle(0.0F),
    m_oAxis(0,1,0)
 {
    CLog oLog("math","CAxisRotation::Constructor (default)",LL_OBJECT);
 } //CAxisRotation()	
Exemplo n.º 17
0
 bool CAxisRotation::ParseString(const char* pcInput, int* piUsed) {
    CLog oLog("math","CAxisRotation::ParseString");
    double pdInputData[4];
    const int iNumComponents = 4;
    int iCurrentComponent = 0;
    bool bFractionalPart = false;
    bool bExponentPart = false;
    int iStrLength = strlen(pcInput);
    bool bRetVal = (iStrLength == 0) ? false : true;
    unsigned long int ulIntegerPart = 0;
    unsigned long int ulFractionalPart = 0;
    unsigned long int ulFractionalDivisor = 1;
    long int lExponentPart = 0;
    int iMantissaSign = 1;
    int iExponentSign = 1;
    int iCharIndex = 0;
    bool waiting = false;
    for (iCharIndex=0; (iCharIndex<iStrLength) && bRetVal && (iCurrentComponent < iNumComponents); iCharIndex++) {
       if (waiting) {
          // Assign to current component
          lExponentPart *= iExponentSign;
          pdInputData[iCurrentComponent] = (iMantissaSign * (ulIntegerPart + ((double)ulFractionalPart / (double)ulFractionalDivisor))) * pow(10,lExponentPart);
          // Reset variables
          bFractionalPart = false;
          bExponentPart = false;
          ulIntegerPart = 0;
          ulFractionalPart = 0;
          ulFractionalDivisor = 1;
          lExponentPart = 0;
          iMantissaSign = 1;
          iExponentSign = 1;
          // Move on
          iCurrentComponent++;
          waiting = false;
       }
       if (isdigit(pcInput[iCharIndex])) {
          if (bExponentPart) {
             lExponentPart *= 10;
             lExponentPart += pcInput [iCharIndex] - '0';
          }
          else if (bFractionalPart) {
             ulFractionalPart *= 10;
             ulFractionalDivisor *= 10;
             ulFractionalPart += pcInput[iCharIndex] - '0';
          }
          else {
             ulIntegerPart *= 10;
             ulIntegerPart += pcInput[iCharIndex] - '0';
          }
       }
       else if (pcInput[iCharIndex] == '-') {
          if (bExponentPart) {
             iExponentSign = -1;
          }
          else {
             iMantissaSign = -1;
          }
       }
       else if (pcInput[iCharIndex] == ' ') {
          // Waiting for next component.
          waiting = true;
       }
       else if (pcInput[iCharIndex] == '.') {
          bFractionalPart = true;
       }
       else if ((pcInput[iCharIndex] == 'e') || (pcInput[iCharIndex] == 'E')) {
          bExponentPart = true;
       }
       else bRetVal = false;
    }
    // Assign last component
    if (bRetVal && (iCurrentComponent != iNumComponents)) {
       lExponentPart *= iExponentSign;
       pdInputData[iCurrentComponent] = (iMantissaSign * (ulIntegerPart + ((double)ulFractionalPart / (double)ulFractionalDivisor))) * pow(10,lExponentPart);
    }
    if (iCurrentComponent != iNumComponents-1) bRetVal = false;
    if (piUsed != NULL) {
       *piUsed = iCharIndex;
    }
    m_oAxis.FromDouble(pdInputData[0],pdInputData[1],pdInputData[2]);
    m_dAngle = pdInputData[3];
    return bRetVal;
 } //ParseString(const char* pcInput, int& piUsed)
Exemplo n.º 18
0
 void CAxisRotation::FromDouble(double dX, double dY, double dZ, double dAngle) {
    CLog oLog("math","CAxisRotation::FromDouble");
    m_dAngle = dAngle;
    m_oAxis.FromDouble(dX, dY, dZ);
    return;
 } //FromDouble(double dX, double dY, double dZ, double dAngle)
Exemplo n.º 19
0
 CAxisRotation::CAxisRotation(const CEulerRotation & oRot) {
    CLog oLog("math","CAxisRotation::Constructor (CEulerRotation)",LL_OBJECT);
    CQuaternion oQuat(oRot);
    *this = CAxisRotation(oQuat);
 } //CAxisRotation(const CEulerRotation & oRot)
Exemplo n.º 20
0
 CAxisRotation& CAxisRotation::Normalise() {
    CLog oLog("math","CAxisRotation::Normalise");
    m_oAxis.Normalise();
    return *this;
 } //Normalise()