diff --git a/API_CurveModif.cpp b/API_CurveModif.cpp index 3840257..b04affb 100644 --- a/API_CurveModif.cpp +++ b/API_CurveModif.cpp @@ -47,7 +47,7 @@ __stdcall EgtModifyCurveStartPoint( int nId, const double ptP[3]) if ( pCurve == nullptr) return false ; // ne modifico il punto iniziale - return ( pCurve->ModifyStart( Point3d( ptP)) ? TRUE : FALSE) ; + return ( pCurve->ModifyStart( ptP) ? TRUE : FALSE) ; } //---------------------------------------------------------------------------- @@ -61,7 +61,7 @@ __stdcall EgtModifyCurveEndPoint( int nId, const double ptP[3]) if ( pCurve == nullptr) return false ; // ne modifico il punto finale - return ( pCurve->ModifyEnd( Point3d( ptP)) ? TRUE : FALSE) ; + return ( pCurve->ModifyEnd( ptP) ? TRUE : FALSE) ; } //---------------------------------------------------------------------------- diff --git a/API_Exchange.cpp b/API_Exchange.cpp index 39eb9a8..7faf330 100644 --- a/API_Exchange.cpp +++ b/API_Exchange.cpp @@ -57,6 +57,10 @@ __stdcall EgtGetFileType( const string& sFilePath) return 12 ; else if ( sFileExt == "CNC") return 13 ; + else if ( sFileExt == "TSC") + return 101 ; + else if ( sFileExt == "LUA") + return 102 ; else { // emetto info string sInfo = "File type (" + sFileExt + ") not recognized" ; diff --git a/API_GdbCreate.cpp b/API_GdbCreate.cpp index bab9ed3..5fe62b6 100644 --- a/API_GdbCreate.cpp +++ b/API_GdbCreate.cpp @@ -43,7 +43,7 @@ __stdcall EgtCreateGroup( int nParentId, const double ptOrig[3], VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) // costruisco il riferimento Frame3d frFrame ; - if ( ! frFrame.Set( Point3d( ptOrig), Vector3d( vX), Vector3d( vY), Vector3d( vZ))) + if ( ! frFrame.Set( ptOrig, vX, vY, vZ)) return GDB_ID_NULL ; // creo il gruppo return pGeomDB->AddGroup( GDB_ID_NULL, nParentId, frFrame) ; @@ -60,7 +60,7 @@ __stdcall EgtCreateGeoPoint( int nParentId, const double ptP[3]) if ( IsNull( pGeoPnt)) return GDB_ID_NULL ; // setto il punto - if ( ! pGeoPnt->Set( Point3d( ptP))) + if ( ! pGeoPnt->Set( ptP)) return GDB_ID_NULL ; // inserisco il punto nel DB return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoPnt)) ; @@ -77,7 +77,7 @@ __stdcall EgtCreateGeoVector( int nParentId, const double vtV[3], const double p if ( IsNull( pGeoVct)) return GDB_ID_NULL ; // setto il vettore (con il punto base) - if ( ! pGeoVct->Set( Vector3d( vtV), Point3d( ptB))) + if ( ! pGeoVct->Set( vtV, ptB)) return GDB_ID_NULL ; // inserisco il vettore nel DB return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoVct)) ; @@ -95,7 +95,7 @@ __stdcall EgtCreateGeoFrame( int nParentId, const double ptOrig[3], if ( IsNull( pGeoFrm)) return GDB_ID_NULL ; // setto il riferimento - if ( ! pGeoFrm->Set( Point3d( ptOrig), Vector3d( vX), Vector3d( vY), Vector3d( vZ))) + if ( ! pGeoFrm->Set( ptOrig, vX, vY, vZ)) return GDB_ID_NULL ; // inserisco il vettore nel DB return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoFrm)) ; @@ -112,7 +112,7 @@ __stdcall EgtCreateCurveLine( int nParentId, const double ptIni[3], const double if ( IsNull( pCrvLine)) return GDB_ID_NULL ; // setto la linea - if ( ! pCrvLine->Set( Point3d( ptIni), Point3d( ptFin))) + if ( ! pCrvLine->Set( ptIni, ptFin)) return GDB_ID_NULL ; // inserisco la linea nel DB return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvLine)) ; @@ -153,7 +153,7 @@ __stdcall EgtCreateCurveLineMinPointCurve( int nParentId, if ( IsNull( pCrvLine)) return GDB_ID_NULL ; // setto la linea - if ( ! pCrvLine->Set( Point3d( ptStart), ptEnd)) + if ( ! pCrvLine->Set( ptStart, ptEnd)) return GDB_ID_NULL ; // inserisco la linea nel DB return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvLine)) ; @@ -171,7 +171,7 @@ __stdcall EgtCreateCurveCircle( int nParentId, if ( IsNull( pCrvArc)) return GDB_ID_NULL ; // setto la circonferenza - if ( ! pCrvArc->Set( Point3d( ptCen), Vector3d( vtN), dRad)) + if ( ! pCrvArc->Set( ptCen, vtN, dRad)) return GDB_ID_NULL ; // inserisco l'arco nel DB return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ; @@ -189,7 +189,7 @@ __stdcall EgtCreateCurveCircleXY( int nParentId, if ( IsNull( pCrvArc)) return GDB_ID_NULL ; // setto la circonferenza - if ( ! pCrvArc->SetXY( Point3d( ptCen), dRad)) + if ( ! pCrvArc->SetXY( ptCen, dRad)) return GDB_ID_NULL ; // inserisco l'arco nel DB return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ; @@ -207,7 +207,7 @@ __stdcall EgtCreateCurveCircle3P( int nParentId, if ( IsNull( pCrvArc)) return GDB_ID_NULL ; // setto l'arco - if ( ! pCrvArc->Set3P( Point3d( ptP1), Point3d( ptP2), Point3d( ptP3), true)) + if ( ! pCrvArc->Set3P( ptP1, ptP2, ptP3, true)) return GDB_ID_NULL ; // inserisco l'arco nel DB return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ; @@ -226,7 +226,7 @@ __stdcall EgtCreateCurveArc( int nParentId, if ( IsNull( pCrvArc)) return GDB_ID_NULL ; // setto l'arco - if ( ! pCrvArc->Set( Point3d( ptCen), Vector3d( vtN), dRad, Vector3d( vtS), dAngCenDeg, dDeltaN)) + if ( ! pCrvArc->Set( ptCen, vtN, dRad, vtS, dAngCenDeg, dDeltaN)) return GDB_ID_NULL ; // inserisco l'arco nel DB return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ; @@ -245,7 +245,7 @@ __stdcall EgtCreateCurveArcXY( int nParentId, if ( IsNull( pCrvArc)) return GDB_ID_NULL ; // setto l'arco - if ( ! pCrvArc->SetXY( Point3d( ptCen), dRad, dAngStartDeg, dAngCenDeg, dDeltaZ)) + if ( ! pCrvArc->SetXY( ptCen, dRad, dAngStartDeg, dAngCenDeg, dDeltaZ)) return GDB_ID_NULL ; // inserisco l'arco nel DB return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ; @@ -263,7 +263,7 @@ __stdcall EgtCreateCurveArc3P( int nParentId, if ( IsNull( pCrvArc)) return GDB_ID_NULL ; // setto l'arco - if ( ! pCrvArc->Set3P( Point3d( ptP1), Point3d( ptP2), Point3d( ptP3), false)) + if ( ! pCrvArc->Set3P( ptP1, ptP2, ptP3, false)) return GDB_ID_NULL ; // inserisco l'arco nel DB return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ; @@ -533,7 +533,7 @@ __stdcall EgtCreateCurveCompoFromPolygonSide( int nParentId, int nNumSides, if ( IsNull( pCrvCompo)) return GDB_ID_NULL ; // setto la curva - if ( ! pCrvCompo->PolygonSide( nNumSides, Point3d( ptIni), Point3d( ptFin))) + if ( ! pCrvCompo->PolygonSide( nNumSides, ptIni, ptFin)) return GDB_ID_NULL ; // inserisco la curva nel DB return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) ; @@ -569,7 +569,7 @@ int __stdcall EgtCreateText( int nParentId, const wchar_t* wsText, const double ptP[3], double dAngRotDeg, double dH) { - return EgtCreateText( nParentId, wstrztoA( wsText), Point3d( ptP), dAngRotDeg, dH) ; + return EgtCreateText( nParentId, wstrztoA( wsText), ptP, dAngRotDeg, dH) ; } //------------------------------------------------------------------------------- @@ -596,7 +596,7 @@ __stdcall EgtCreateTextEx( int nParentId, const wchar_t* wsText, const double ptP[3], double dAngRotDeg, const wchar_t* wsFont, int nW, BOOL bItalic, double dH, double dRat, double dAddAdv, int nInsPos) { - return EgtCreateTextEx( nParentId, wstrztoA( wsText), Point3d( ptP), dAngRotDeg, + return EgtCreateTextEx( nParentId, wstrztoA( wsText), ptP, dAngRotDeg, wstrztoA( wsFont), nW, ( bItalic != FALSE), dH, dRat, dAddAdv, nInsPos) ; } diff --git a/API_GdbModify.cpp b/API_GdbModify.cpp index a22c252..40fac82 100644 --- a/API_GdbModify.cpp +++ b/API_GdbModify.cpp @@ -42,7 +42,7 @@ __stdcall EgtChangeVectorBase( int nId, const double ptB[3]) if ( pGVect == nullptr) return FALSE ; // imposto il nuovo punto di base - return ( pGVect->ChangeBase( Point3d( ptB)) ? TRUE : FALSE) ; + return ( pGVect->ChangeBase( ptB) ? TRUE : FALSE) ; } //------------------------------------------------------------------------------- diff --git a/API_GdbObjects.cpp b/API_GdbObjects.cpp index 6cdd15b..8239000 100644 --- a/API_GdbObjects.cpp +++ b/API_GdbObjects.cpp @@ -232,7 +232,7 @@ __stdcall EgtGroupDump( int nId, wchar_t*& wsDump) } // ingombro in globale BBox3d b3Glob ; - if ( pGeomDB->GetGlobalBBox( nId, b3Glob)) { + if ( pGeomDB->GetGlobalBBox( nId, b3Glob, BBF_EXACT)) { sDump += "GlobBBox :\r\n" ; Point3d ptMin, ptMax ; if ( b3Glob.GetMinMax( ptMin, ptMax)) { diff --git a/API_GeoBase.cpp b/API_GeoBase.cpp new file mode 100644 index 0000000..e1b347d --- /dev/null +++ b/API_GeoBase.cpp @@ -0,0 +1,433 @@ +//---------------------------------------------------------------------------- +// EgalTech 2014-2014 +//---------------------------------------------------------------------------- +// File : API_GdbObjects.cpp Data : 17.10.14 Versione : 1.5i5 +// Contenuto : Funzioni geometriche di base per API. +// +// +// +// Modifiche : 17.10.14 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +//--------------------------- Include ---------------------------------------- +#include "stdafx.h" +#include "API.h" +#include "API_Macro.h" +#include "/EgtDev/Include/EInAPI.h" +#include "/EgtDev/Include/EGkFrame3d.h" + +using namespace std ; + +//----------------------------------------------------------------------------- +#define VEC_FROM_3D( D, S) { (D)[0] = (S).x ; (D)[1] = (S).y ; (D)[2] = (S).z ; } + +//----------------------------------------------------------------------------- +// Vector3d +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtVectorNormalize( double* pdX, double* pdY, double* pdZ, + double dEps) +{ + // eseguo la trasformazione + Vector3d vtTemp( *pdX, *pdY, *pdZ) ; + if ( ! vtTemp.Normalize( dEps)) + return FALSE ; + // aggiorno il parametro vettore + *pdX = vtTemp.x ; + *pdY = vtTemp.y ; + *pdZ = vtTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtVectorRotate( double* pdX, double* pdY, double* pdZ, + const double vtAx[3], double dAngRotDeg) +{ + // eseguo la trasformazione + Vector3d vtTemp( *pdX, *pdY, *pdZ) ; + if ( ! vtTemp.Rotate( vtAx, dAngRotDeg)) + return FALSE ; + // aggiorno il parametro vettore + *pdX = vtTemp.x ; + *pdY = vtTemp.y ; + *pdZ = vtTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtVectorScale( double* pdX, double* pdY, double* pdZ, + const double ptOrig[3], const double vtX[3], const double vtY[3], const double vtZ[3], + double dCoeffX, double dCoeffY, double dCoeffZ) +{ + // costruisco il frame + Frame3d frRef ; + if ( ! frRef.Set( ptOrig, vtX, vtY, vtZ)) + return FALSE ; + // eseguo la trasformazione + Vector3d vtTemp( *pdX, *pdY, *pdZ) ; + if ( ! vtTemp.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ)) + return FALSE ; + // aggiorno il parametro vettore + *pdX = vtTemp.x ; + *pdY = vtTemp.y ; + *pdZ = vtTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtVectorMirror( double* pdX, double* pdY, double* pdZ, + const double vtNorm[3]) +{ + // eseguo la trasformazione + Vector3d vtTemp( *pdX, *pdY, *pdZ) ; + if ( ! vtTemp.Mirror( vtNorm)) + return FALSE ; + // aggiorno il parametro vettore + *pdX = vtTemp.x ; + *pdY = vtTemp.y ; + *pdZ = vtTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtVectorShear( double* pdX, double* pdY, double* pdZ, + const double vtNorm[3], const double vtDir[3], double dCoeff) +{ + // eseguo la trasformazione + Vector3d vtTemp( *pdX, *pdY, *pdZ) ; + if ( ! vtTemp.Shear( vtNorm, vtDir, dCoeff)) + return FALSE ; + // aggiorno il parametro vettore + *pdX = vtTemp.x ; + *pdY = vtTemp.y ; + *pdZ = vtTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtVectorToGlob( double* pdX, double* pdY, double* pdZ, + const double ptOrig[3], const double vtX[3], const double vtY[3], const double vtZ[3]) +{ + // costruisco il frame + Frame3d frRef ; + if ( ! frRef.Set( ptOrig, vtX, vtY, vtZ)) + return FALSE ; + // eseguo la trasformazione + Vector3d vtTemp( *pdX, *pdY, *pdZ) ; + if ( ! vtTemp.ToGlob( frRef)) + return FALSE ; + // aggiorno il parametro vettore + *pdX = vtTemp.x ; + *pdY = vtTemp.y ; + *pdZ = vtTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtVectorToLoc( double* pdX, double* pdY, double* pdZ, + const double ptOrig[3], const double vtX[3], const double vtY[3], const double vtZ[3]) +{ + // costruisco il frame + Frame3d frRef ; + if ( ! frRef.Set( ptOrig, vtX, vtY, vtZ)) + return FALSE ; + // eseguo la trasformazione + Vector3d vtTemp( *pdX, *pdY, *pdZ) ; + if ( ! vtTemp.ToLoc( frRef)) + return FALSE ; + // aggiorno il parametro vettore + *pdX = vtTemp.x ; + *pdY = vtTemp.y ; + *pdZ = vtTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtVectorLocToLoc( double* pdX, double* pdY, double* pdZ, + const double ptO1[3], const double vtX1[3], const double vtY1[3], const double vtZ1[3], + const double ptO2[3], const double vtX2[3], const double vtY2[3], const double vtZ2[3]) +{ + // costruisco il frame sorgente + Frame3d frSou ; + if ( ! frSou.Set( ptO1, vtX1, vtY1, vtZ1)) + return FALSE ; + // costruisco il frame destinazione + Frame3d frDest ; + if ( ! frDest.Set( ptO2, vtX2, vtY2, vtZ2)) + return FALSE ; + // eseguo la trasformazione + Vector3d vtTemp( *pdX, *pdY, *pdZ) ; + if ( ! vtTemp.LocToLoc( frSou, frDest)) + return FALSE ; + // aggiorno il parametro vettore + *pdX = vtTemp.x ; + *pdY = vtTemp.y ; + *pdZ = vtTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +// Point3d +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtPointTranslate( double* pdX, double* pdY, double* pdZ, + const double vtMove[3]) +{ + // eseguo la trasformazione + Point3d ptTemp( *pdX, *pdY, *pdZ) ; + ptTemp.Translate( vtMove) ; + // aggiorno il parametro vettore + *pdX = ptTemp.x ; + *pdY = ptTemp.y ; + *pdZ = ptTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtPointRotate( double* pdX, double* pdY, double* pdZ, + const double ptAx[3], const double vtAx[3], double dAngRotDeg) +{ + // eseguo la trasformazione + Point3d ptTemp( *pdX, *pdY, *pdZ) ; + if ( ! ptTemp.Rotate( ptAx, vtAx, dAngRotDeg)) + return FALSE ; + // aggiorno il parametro vettore + *pdX = ptTemp.x ; + *pdY = ptTemp.y ; + *pdZ = ptTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtPointScale( double* pdX, double* pdY, double* pdZ, + const double ptOrig[3], const double vtX[3], const double vtY[3], const double vtZ[3], + double dCoeffX, double dCoeffY, double dCoeffZ) +{ + // costruisco il frame + Frame3d frRef ; + if ( ! frRef.Set( ptOrig, vtX, vtY, vtZ)) + return FALSE ; + // eseguo la trasformazione + Point3d ptTemp( *pdX, *pdY, *pdZ) ; + if ( ! ptTemp.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ)) + return FALSE ; + // aggiorno il parametro vettore + *pdX = ptTemp.x ; + *pdY = ptTemp.y ; + *pdZ = ptTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtPointMirror( double* pdX, double* pdY, double* pdZ, + const double ptOn[3], const double vtNorm[3]) +{ + // eseguo la trasformazione + Point3d ptTemp( *pdX, *pdY, *pdZ) ; + if ( ! ptTemp.Mirror( ptOn, vtNorm)) + return FALSE ; + // aggiorno il parametro vettore + *pdX = ptTemp.x ; + *pdY = ptTemp.y ; + *pdZ = ptTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtPointShear( double* pdX, double* pdY, double* pdZ, + const double ptOn[3], const double vtNorm[3], const double vtDir[3], double dCoeff) +{ + // eseguo la trasformazione + Point3d ptTemp( *pdX, *pdY, *pdZ) ; + if ( ! ptTemp.Shear( ptOn, vtNorm, vtDir, dCoeff)) + return FALSE ; + // aggiorno il parametro vettore + *pdX = ptTemp.x ; + *pdY = ptTemp.y ; + *pdZ = ptTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtPointToGlob( double* pdX, double* pdY, double* pdZ, + const double ptOrig[3], const double vtX[3], const double vtY[3], const double vtZ[3]) +{ + // costruisco il frame + Frame3d frRef ; + if ( ! frRef.Set( ptOrig, vtX, vtY, vtZ)) + return FALSE ; + // eseguo la trasformazione + Point3d ptTemp( *pdX, *pdY, *pdZ) ; + if ( ! ptTemp.ToGlob( frRef)) + return FALSE ; + // aggiorno il parametro punto + *pdX = ptTemp.x ; + *pdY = ptTemp.y ; + *pdZ = ptTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtPointToLoc( double* pdX, double* pdY, double* pdZ, + const double ptOrig[3], const double vtX[3], const double vtY[3], const double vtZ[3]) +{ + // costruisco il frame + Frame3d frRef ; + if ( ! frRef.Set( ptOrig, vtX, vtY, vtZ)) + return FALSE ; + // eseguo la trasformazione + Point3d ptTemp( *pdX, *pdY, *pdZ) ; + if ( ! ptTemp.ToLoc( frRef)) + return FALSE ; + // aggiorno il parametro punto + *pdX = ptTemp.x ; + *pdY = ptTemp.y ; + *pdZ = ptTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtPointLocToLoc( double* pdX, double* pdY, double* pdZ, + const double ptO1[3], const double vtX1[3], const double vtY1[3], const double vtZ1[3], + const double ptO2[3], const double vtX2[3], const double vtY2[3], const double vtZ2[3]) +{ + // costruisco il frame sorgente + Frame3d frSou ; + if ( ! frSou.Set( ptO1, vtX1, vtY1, vtZ1)) + return FALSE ; + // costruisco il frame destinazione + Frame3d frDest ; + if ( ! frDest.Set( ptO2, vtX2, vtY2, vtZ2)) + return FALSE ; + // eseguo la trasformazione + Point3d ptTemp( *pdX, *pdY, *pdZ) ; + if ( ! ptTemp.LocToLoc( frSou, frDest)) + return FALSE ; + // aggiorno il parametro punto + *pdX = ptTemp.x ; + *pdY = ptTemp.y ; + *pdZ = ptTemp.z ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +// Frame3d +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtFrameTranslate( double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3], + const double vtMove[3]) +{ + // eseguo la trasformazione + Frame3d frTemp ; + frTemp.Set( ptOrig, vtX, vtY, vtZ) ; + frTemp.Translate( vtMove) ; + // aggiorno i parametri del frame + VEC_FROM_3D( ptOrig, frTemp.Orig()) + VEC_FROM_3D( vtX, frTemp.VersX()) + VEC_FROM_3D( vtY, frTemp.VersY()) + VEC_FROM_3D( vtZ, frTemp.VersZ()) + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtFrameRotate( double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3], + const double ptAx[3], const double vtAx[3], double dAngRotDeg) +{ + // eseguo la trasformazione + Frame3d frTemp ; + frTemp.Set( ptOrig, vtX, vtY, vtZ) ; + frTemp.Rotate( ptAx, vtAx, dAngRotDeg) ; + // aggiorno i parametri del frame + VEC_FROM_3D( ptOrig, frTemp.Orig()) + VEC_FROM_3D( vtX, frTemp.VersX()) + VEC_FROM_3D( vtY, frTemp.VersY()) + VEC_FROM_3D( vtZ, frTemp.VersZ()) + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtFrameToGlob( double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3], + const double ptO1[3], const double vtX1[3], const double vtY1[3], const double vtZ1[3]) +{ + // costruisco il frame di trasformazione + Frame3d frRef ; + if ( ! frRef.Set( ptO1, vtX1, vtY1, vtZ1)) + return FALSE ; + // eseguo la trasformazione + Frame3d frTemp ; + frTemp.Set( ptOrig, vtX, vtY, vtZ) ; + if ( ! frTemp.ToGlob( frRef)) + return FALSE ; + // aggiorno i parametri del frame + VEC_FROM_3D( ptOrig, frTemp.Orig()) + VEC_FROM_3D( vtX, frTemp.VersX()) + VEC_FROM_3D( vtY, frTemp.VersY()) + VEC_FROM_3D( vtZ, frTemp.VersZ()) + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtFrameToLoc( double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3], + const double ptO1[3], const double vtX1[3], const double vtY1[3], const double vtZ1[3]) +{ + // costruisco il frame di trasformazione + Frame3d frRef ; + if ( ! frRef.Set( ptO1, vtX1, vtY1, vtZ1)) + return FALSE ; + // eseguo la trasformazione + Frame3d frTemp ; + frTemp.Set( ptOrig, vtX, vtY, vtZ) ; + if ( ! frTemp.ToLoc( frRef)) + return FALSE ; + // aggiorno i parametri del frame + VEC_FROM_3D( ptOrig, frTemp.Orig()) + VEC_FROM_3D( vtX, frTemp.VersX()) + VEC_FROM_3D( vtY, frTemp.VersY()) + VEC_FROM_3D( vtZ, frTemp.VersZ()) + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtFrameLocToLoc( double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3], + const double ptO1[3], const double vtX1[3], const double vtY1[3], const double vtZ1[3], + const double ptO2[3], const double vtX2[3], const double vtY2[3], const double vtZ2[3]) +{ + // costruisco il frame sorgente + Frame3d frSou ; + if ( ! frSou.Set( ptO1, vtX1, vtY1, vtZ1)) + return FALSE ; + // costruisco il frame destinazione + Frame3d frDest ; + if ( ! frDest.Set( ptO2, vtX2, vtY2, vtZ2)) + return FALSE ; + // eseguo la trasformazione + Frame3d frTemp ; + if ( ! frTemp.LocToLoc( frSou, frDest)) + return FALSE ; + // aggiorno i parametri del frame + VEC_FROM_3D( ptOrig, frTemp.Orig()) + VEC_FROM_3D( vtX, frTemp.VersX()) + VEC_FROM_3D( vtY, frTemp.VersY()) + VEC_FROM_3D( vtZ, frTemp.VersZ()) + return TRUE ; +} \ No newline at end of file diff --git a/API_GeoTransform.cpp b/API_GeoTransform.cpp index d31085d..f4cfbf4 100644 --- a/API_GeoTransform.cpp +++ b/API_GeoTransform.cpp @@ -27,7 +27,7 @@ __stdcall EgtMove( int nId, double vVtMove[3]) IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo traslazione - return ( pGeomDB->Translate( nId, Vector3d( vVtMove)) ? TRUE : FALSE) ; + return ( pGeomDB->Translate( nId, vVtMove) ? TRUE : FALSE) ; } //------------------------------------------------------------------------------- @@ -37,7 +37,7 @@ __stdcall EgtMoveGlob( int nId, double vVtMove[3]) IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo traslazione - return ( pGeomDB->TranslateGlob( nId, Vector3d( vVtMove)) ? TRUE : FALSE) ; + return ( pGeomDB->TranslateGlob( nId, vVtMove) ? TRUE : FALSE) ; } //------------------------------------------------------------------------------- @@ -47,7 +47,7 @@ __stdcall EgtMoveGroup( int nId, double vVtMove[3]) IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo traslazione - return ( pGeomDB->TranslateGroup( nId, Vector3d( vVtMove)) ? TRUE : FALSE) ; + return ( pGeomDB->TranslateGroup( nId, vVtMove) ? TRUE : FALSE) ; } //------------------------------------------------------------------------------- @@ -57,7 +57,7 @@ __stdcall EgtRotate( int nId, double vPtAx[3], double vVtAx[3], double dAngRotDe IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo rotazione - return ( pGeomDB->Rotate( nId, Point3d( vPtAx), Vector3d( vVtAx), dAngRotDeg) ? TRUE : FALSE) ; + return ( pGeomDB->Rotate( nId, vPtAx, vVtAx, dAngRotDeg) ? TRUE : FALSE) ; } //------------------------------------------------------------------------------- @@ -67,7 +67,7 @@ __stdcall EgtRotateGlob( int nId, double vPtAx[3], double vVtAx[3], double dAngR IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo rotazione - return ( pGeomDB->RotateGlob( nId, Point3d( vPtAx), Vector3d( vVtAx), dAngRotDeg) ? TRUE : FALSE) ; + return ( pGeomDB->RotateGlob( nId, vPtAx, vVtAx, dAngRotDeg) ? TRUE : FALSE) ; } //------------------------------------------------------------------------------- @@ -77,7 +77,7 @@ __stdcall EgtRotateGroup( int nId, double vPtAx[3], double vVtAx[3], double dAng IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo rotazione - return ( pGeomDB->RotateGroup( nId, Point3d( vPtAx), Vector3d( vVtAx), dAngRotDeg) ? TRUE : FALSE) ; + return ( pGeomDB->RotateGroup( nId, vPtAx, vVtAx, dAngRotDeg) ? TRUE : FALSE) ; } //------------------------------------------------------------------------------- @@ -90,7 +90,7 @@ __stdcall EgtScale( int nId, const double vOrig[3], VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo rotazione Frame3d frFrame ; - if ( ! frFrame.Set( Point3d( vOrig), Vector3d( vX), Vector3d( vY), Vector3d( vZ))) + if ( ! frFrame.Set( vOrig, vX, vY, vZ)) return FALSE ; return ( pGeomDB->Scale( nId, frFrame, dCoeffX, dCoeffY, dCoeffZ) ? TRUE : FALSE) ; } @@ -105,7 +105,7 @@ __stdcall EgtScaleGlob( int nId, const double vOrig[3], VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo rotazione Frame3d frFrame ; - if ( ! frFrame.Set( Point3d( vOrig), Vector3d( vX), Vector3d( vY), Vector3d( vZ))) + if ( ! frFrame.Set( vOrig, vX, vY, vZ)) return FALSE ; return ( pGeomDB->ScaleGlob( nId, frFrame, dCoeffX, dCoeffY, dCoeffZ) ? TRUE : FALSE) ; } @@ -120,7 +120,7 @@ __stdcall EgtScaleGroup( int nId, const double vOrig[3], VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo rotazione Frame3d frFrame ; - if ( ! frFrame.Set( Point3d( vOrig), Vector3d( vX), Vector3d( vY), Vector3d( vZ))) + if ( ! frFrame.Set( vOrig, vX, vY, vZ)) return FALSE ; return ( pGeomDB->ScaleGroup( nId, frFrame, dCoeffX, dCoeffY, dCoeffZ) ? TRUE : FALSE) ; } @@ -132,7 +132,7 @@ __stdcall EgtMirror( int nId, const double vPnt[3], const double vN[3]) IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo specularità - return ( pGeomDB->Mirror( nId, Point3d( vPnt), Vector3d( vN)) ? TRUE : FALSE) ; + return ( pGeomDB->Mirror( nId, vPnt, vN) ? TRUE : FALSE) ; } //------------------------------------------------------------------------------- @@ -142,7 +142,7 @@ __stdcall EgtMirrorGlob( int nId, const double vPnt[3], const double vN[3]) IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo specularità - return ( pGeomDB->MirrorGlob( nId, Point3d( vPnt), Vector3d( vN)) ? TRUE : FALSE) ; + return ( pGeomDB->MirrorGlob( nId, vPnt, vN) ? TRUE : FALSE) ; } //------------------------------------------------------------------------------- @@ -152,7 +152,7 @@ __stdcall EgtMirrorGroup( int nId, const double vPnt[3], const double vN[3]) IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo specularità - return ( pGeomDB->MirrorGroup( nId, Point3d( vPnt), Vector3d( vN)) ? TRUE : FALSE) ; + return ( pGeomDB->MirrorGroup( nId, vPnt, vN) ? TRUE : FALSE) ; } //------------------------------------------------------------------------------- @@ -163,7 +163,7 @@ __stdcall EgtShear( int nId, const double vPnt[3], const double vN[3], IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo stiramento - return ( pGeomDB->Shear( nId, Point3d( vPnt), Vector3d( vN), Vector3d( vDir), dCoeff) ? TRUE : FALSE) ; + return ( pGeomDB->Shear( nId, vPnt, vN, vDir, dCoeff) ? TRUE : FALSE) ; } //------------------------------------------------------------------------------- @@ -174,7 +174,7 @@ __stdcall EgtShearGlob( int nId, const double vPnt[3], const double vN[3], IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo stiramento - return ( pGeomDB->ShearGlob( nId, Point3d( vPnt), Vector3d( vN), Vector3d( vDir), dCoeff) ? TRUE : FALSE) ; + return ( pGeomDB->ShearGlob( nId, vPnt, vN, vDir, dCoeff) ? TRUE : FALSE) ; } //------------------------------------------------------------------------------- @@ -185,5 +185,5 @@ __stdcall EgtShearGroup( int nId, const double vPnt[3], const double vN[3], IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) // eseguo stiramento - return ( pGeomDB->ShearGroup( nId, Point3d( vPnt), Vector3d( vN), Vector3d( vDir), dCoeff) ? TRUE : FALSE) ; + return ( pGeomDB->ShearGroup( nId, vPnt, vN, vDir, dCoeff) ? TRUE : FALSE) ; } diff --git a/API_Scene.cpp b/API_Scene.cpp index 9b3b4f7..d2f857b 100644 --- a/API_Scene.cpp +++ b/API_Scene.cpp @@ -277,7 +277,7 @@ __stdcall EgtSetGeoLine( const double ptP1[3], const double ptP2[3], BOOL bRedra GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_SCENE( pGseCtx, FALSE) // disegno linea per distanza o similari - pGseCtx->m_pScene->SetGeoLine( Point3d( ptP1), Point3d( ptP2)) ; + pGseCtx->m_pScene->SetGeoLine( ptP1, ptP2) ; if ( bRedraw) pGseCtx->m_pScene->RedrawWindow() ; return TRUE ; @@ -372,7 +372,7 @@ __stdcall EgtSetViewCenter( const double ptP[3], BOOL bRedraw) GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_SCENE( pGseCtx, FALSE) // imposto vista - pGseCtx->m_pScene->SetCenter( Point3d( ptP)) ; + pGseCtx->m_pScene->SetCenter( ptP) ; if ( bRedraw) pGseCtx->m_pScene->RedrawWindow() ; return TRUE ; @@ -442,7 +442,7 @@ __stdcall EgtProjectPoint( const double ptP[3], double ptWin[3]) VERIFY_SCENE( pScene, FALSE) // eseguo la proiezione Point3d ptView ; - if ( ! pScene->Project( Point3d( ptP), ptView)) + if ( ! pScene->Project( ptP, ptView)) return FALSE ; ptWin[0] = ptView.x ; ptWin[1] = ptView.y ; diff --git a/EgtInterface.rc b/EgtInterface.rc index c99b83f..354b429 100644 Binary files a/EgtInterface.rc and b/EgtInterface.rc differ diff --git a/EgtInterface.vcxproj b/EgtInterface.vcxproj index 10298df..1c99d1d 100644 --- a/EgtInterface.vcxproj +++ b/EgtInterface.vcxproj @@ -203,6 +203,7 @@ copy $(TargetPath) \EgtProg\Dll64 + diff --git a/EgtInterface.vcxproj.filters b/EgtInterface.vcxproj.filters index 1eb6f78..33110cb 100644 --- a/EgtInterface.vcxproj.filters +++ b/EgtInterface.vcxproj.filters @@ -128,6 +128,9 @@ File di origine + + File di origine +