From 4ebb43bf1e94fe4aa78893dfbbdfc6dc26eed1e5 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sun, 19 Jan 2014 11:19:56 +0000 Subject: [PATCH] EgtGeomKernel 1.5a6 : prima versione di scalatura non uniforme, aggiunto comando COUNTER in tsc. --- CurveArc.cpp | 4 +-- CurveArc.h | 2 +- CurveBezier.cpp | 4 +-- CurveBezier.h | 2 +- CurveComposite.cpp | 8 ++--- CurveComposite.h | 2 +- CurveLine.cpp | 6 ++-- CurveLine.h | 2 +- EgtGeomKernel.rc | Bin 11710 -> 11710 bytes EgtGeomKernel.vcxproj | 1 + EgtGeomKernel.vcxproj.filters | 3 ++ GdbExecutor.cpp | 58 ++++++++++++++++++++++++++++------ GdbExecutor.h | 4 +++ GdbGroup.cpp | 17 ++++------ GdbGroup.h | 2 +- GdbNode.h | 2 +- GdbObj.cpp | 4 +-- GdbObj.h | 2 +- GeoFrame3d.h | 2 +- GeoPoint3d.h | 4 +-- GeoVector3d.h | 4 +-- GeomDB.cpp | 4 +-- GeomDB.h | 2 +- OutScl.cpp | 23 ++++++++++---- OutScl.h | 5 +-- Point3d.cpp | 8 ++--- Vector3d.cpp | 13 +++++--- 27 files changed, 124 insertions(+), 64 deletions(-) diff --git a/CurveArc.cpp b/CurveArc.cpp index c0b2d80..19f3592 100644 --- a/CurveArc.cpp +++ b/CurveArc.cpp @@ -533,7 +533,7 @@ CurveArc::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, dou //---------------------------------------------------------------------------- bool -CurveArc::Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) +CurveArc::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) { // la curva deve essere validata if ( m_nStatus != OK) @@ -548,7 +548,7 @@ CurveArc::Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dC return false ; // scalo il centro e le dimensioni lineari - m_PtCen.Scale( ptCen, dCoeffX, dCoeffX, dCoeffX) ; + m_PtCen.Scale( frRef, dCoeffX, dCoeffX, dCoeffX) ; m_dRad *= fabs( dCoeffX) ; m_dDeltaN *= dCoeffX ; if ( dCoeffX < 0) diff --git a/CurveArc.h b/CurveArc.h index ed932a6..e28eade 100644 --- a/CurveArc.h +++ b/CurveArc.h @@ -33,7 +33,7 @@ class CurveArc : public ICurveArc virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ; virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) { return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; } - virtual bool Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) ; + virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ; virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) ; virtual bool ToGlob( const Frame3d& frRef) ; virtual bool ToLoc( const Frame3d& frRef) ; diff --git a/CurveBezier.cpp b/CurveBezier.cpp index 34d25aa..017ac00 100644 --- a/CurveBezier.cpp +++ b/CurveBezier.cpp @@ -1239,7 +1239,7 @@ CurveBezier::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, //---------------------------------------------------------------------------- bool -CurveBezier::Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) +CurveBezier::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) { int i ; @@ -1254,7 +1254,7 @@ CurveBezier::Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double // scalo i punti di controllo for ( i = 0 ; i <= m_nDeg ; ++ i) - m_aPtCtrl[i].Scale( ptCen, dCoeffX, dCoeffY, dCoeffZ) ; + m_aPtCtrl[i].Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ; return true ; } diff --git a/CurveBezier.h b/CurveBezier.h index 0a390f5..7154319 100644 --- a/CurveBezier.h +++ b/CurveBezier.h @@ -35,7 +35,7 @@ class CurveBezier : public ICurveBezier virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ; virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) { return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; } - virtual bool Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) ; + virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ; virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) ; virtual bool ToGlob( const Frame3d& frRef) ; virtual bool ToLoc( const Frame3d& frRef) ; diff --git a/CurveComposite.cpp b/CurveComposite.cpp index d5ab2a2..726977d 100644 --- a/CurveComposite.cpp +++ b/CurveComposite.cpp @@ -759,7 +759,7 @@ CurveComposite::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAn //---------------------------------------------------------------------------- bool -CurveComposite::Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) +CurveComposite::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) { PCRVSMPL_LIST::iterator Iter ; @@ -774,11 +774,11 @@ CurveComposite::Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, dou // scalo le singole curve for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter) - (*Iter)->Scale( ptCen, dCoeffX, dCoeffX, dCoeffX) ; + (*Iter)->Scale( frRef, dCoeffX, dCoeffX, dCoeffX) ; // scalo i punti estremi - m_PtStart.Scale( ptCen, dCoeffX, dCoeffX, dCoeffX) ; - m_PtEnd.Scale( ptCen, dCoeffX, dCoeffX, dCoeffX) ; + m_PtStart.Scale( frRef, dCoeffX, dCoeffX, dCoeffX) ; + m_PtEnd.Scale( frRef, dCoeffX, dCoeffX, dCoeffX) ; return Validate() ; } diff --git a/CurveComposite.h b/CurveComposite.h index 7b1b7a3..18e67fb 100644 --- a/CurveComposite.h +++ b/CurveComposite.h @@ -37,7 +37,7 @@ class CurveComposite : public ICurveComposite virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ; virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) { return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; } - virtual bool Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) ; + virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ; virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) ; virtual bool ToGlob( const Frame3d& frRef) ; virtual bool ToLoc( const Frame3d& frRef) ; diff --git a/CurveLine.cpp b/CurveLine.cpp index 895c9a5..54e6ed7 100644 --- a/CurveLine.cpp +++ b/CurveLine.cpp @@ -359,15 +359,15 @@ CurveLine::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, do //---------------------------------------------------------------------------- bool -CurveLine::Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) +CurveLine::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) { // verifico non sia nulla if ( fabs( dCoeffX) < EPS_ZERO && fabs( dCoeffY) < EPS_ZERO && fabs( dCoeffZ) < EPS_ZERO) return false ; // scalo i punti estremi - m_PtStart.Scale( ptCen, dCoeffX, dCoeffY, dCoeffZ) ; - m_PtEnd.Scale( ptCen, dCoeffX, dCoeffY, dCoeffZ) ; + m_PtStart.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ; + m_PtEnd.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ; m_nStatus = TO_VERIFY ; return Validate() ; diff --git a/CurveLine.h b/CurveLine.h index 4f6b252..8d5b306 100644 --- a/CurveLine.h +++ b/CurveLine.h @@ -33,7 +33,7 @@ class CurveLine : public ICurveLine virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ; virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) { return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; } - virtual bool Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) ; + virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ; virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) ; virtual bool ToGlob( const Frame3d& frRef) ; virtual bool ToLoc( const Frame3d& frRef) ; diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index 1c27a355b0ff93e003145028382a3b218ca70916..62d3d8bbe5714e56abd0df9433b1d61eeb213c16 100644 GIT binary patch delta 81 zcmdlNy)SyhH#SDI&FAG5nSs + diff --git a/EgtGeomKernel.vcxproj.filters b/EgtGeomKernel.vcxproj.filters index f26d167..4032ba0 100644 --- a/EgtGeomKernel.vcxproj.filters +++ b/EgtGeomKernel.vcxproj.filters @@ -299,6 +299,9 @@ File di intestazione + + File di intestazione + diff --git a/GdbExecutor.cpp b/GdbExecutor.cpp index cfb93ca..397019c 100644 --- a/GdbExecutor.cpp +++ b/GdbExecutor.cpp @@ -1,13 +1,13 @@ //---------------------------------------------------------------------------- -// EgalTech 2013-2013 +// EgalTech 2013-2014 //---------------------------------------------------------------------------- -// File : GdbExecutor.cpp Data : 25.11.13 Versione : 1.3a5 +// File : GdbExecutor.cpp Data : 19.01.14 Versione : 1.5a6 // Contenuto : Implementazione della classe GdbExecutor. // // // // Modifiche : 27.03.13 DS Creazione modulo. -// +// 19.01.14 DS Agg. COUNTER. // //---------------------------------------------------------------------------- @@ -126,6 +126,8 @@ GdbExecutor::Execute( const string& sCmd1, const string& sCmd2, const STRVECTOR& return ExecuteSave( vsParams) ; else if ( sCmd1 == "OUTSCL") return ExecuteOutScl( sCmd2, vsParams) ; + else if ( sCmd1 == "COUNTER") + return ExecuteCounter( sCmd2, vsParams) ; return false ; } @@ -749,6 +751,18 @@ GdbExecutor::GetPointWParam( const std::string& sParam, Point3d& ptP, double& dW return false ; } +//---------------------------------------------------------------------------- +bool +GdbExecutor::GetFrameParam( const std::string& sParam, Frame3d& frF) +{ + // deve essere nome di frame già nel DB + const IGeoFrame3d* pFr ; + if ( ( pFr = GetGeoFrame3d( m_pGDB->GetGeoObj( GetIdParam( sParam)))) == nullptr) + return false ; + frF = pFr->GetFrame() ; + return true ; +} + //---------------------------------------------------------------------------- bool GdbExecutor::ExecuteCopy( const STRVECTOR& vsParams) @@ -858,19 +872,26 @@ GdbExecutor::ExecuteScale( const STRVECTOR& vsParams) STRVECTOR vsNames ; STRVECTOR::iterator Iter ; Point3d ptPC ; + Frame3d frRef ; double dCoeffX ; double dCoeffY ; double dCoeffZ ; - // 5 parametri ( Nome, Punto, CoeffX, CoeffY, CoeffZ) + // 5 parametri ( Nome, Punto o Frame, CoeffX, CoeffY, CoeffZ) if ( vsParams.size() != 5) return false ; // recupero lista nomi if ( ! GetNamesParam( vsParams[0], vsNames)) return false ; - // recupero il punto - if ( ! GetPointParam( vsParams[1], ptPC)) + // provo a recuperare un punto + if ( GetPointParam( vsParams[1], ptPC)) + frRef.Set( ptPC, Frame3d::TOP) ; + // provo a recuperare un frame + else if ( GetFrameParam( vsParams[1], frRef)) + ; + // altrimenti errore + else return false ; // recupero i coefficienti if ( ! FromString( vsParams[2], dCoeffX) || @@ -879,7 +900,7 @@ GdbExecutor::ExecuteScale( const STRVECTOR& vsParams) return false ; // esecuzione scalature for ( Iter = vsNames.begin() ; Iter != vsNames.end() ; ++Iter) { - if ( ! m_pGDB->Scale( GetIdParam( *Iter), ptPC, dCoeffX, dCoeffY, dCoeffZ)) + if ( ! m_pGDB->Scale( GetIdParam( *Iter), frRef, dCoeffX, dCoeffY, dCoeffZ)) return false ; } @@ -1116,7 +1137,7 @@ GdbExecutor::ExecuteOutScl( const string& sCmd2, const STRVECTOR& vsParams) for ( Iter = vsNames.begin() ; Iter != vsNames.end() ; ++Iter) { // recupero l'oggetto ed eseguo l'output nId = GetIdParam( *Iter) ; - if ( ! m_OutScl.PutCurve( m_pGDB->GetGeoObj( nId), nFlag)) + if ( ! m_OutScl.PutGeoObj( m_pGDB->GetGeoObj( nId), nFlag)) return false ; } return true ; @@ -1160,7 +1181,7 @@ GdbExecutor::OutGroupScl( int nId, int nFlag) while ( bNext) { nGdbType = Iter.GetGdbType() ; if ( nGdbType == GDB_GEO) { - if ( ! m_OutScl.PutCurve( Iter.GetGeoObj(), nFlag)) + if ( ! m_OutScl.PutGeoObj( Iter.GetGeoObj(), nFlag)) return false ; } else if ( nGdbType == GDB_GROUP) { @@ -1173,3 +1194,22 @@ GdbExecutor::OutGroupScl( int nId, int nFlag) return true ; } + +//---------------------------------------------------------------------------- +bool +GdbExecutor::ExecuteCounter( const string& sCmd2, const STRVECTOR& vsParams) +{ + // avvio il counter + if ( sCmd2 == "START") { + m_Counter.Start() ; + } + // fermo il counter ed emetto i risultati + else if ( sCmd2 == "STOP") { + m_Counter.Stop() ; + string sOut = " " + ( ( vsParams.size() >= 1) ? vsParams[0] : "ExecTime =") ; + sOut += " " + ToString( m_Counter.GetTime(), 2) + " ms" ; + LOG_INFO( GetEGkLogger(), sOut.c_str()) + } + + return true ; +} \ No newline at end of file diff --git a/GdbExecutor.h b/GdbExecutor.h index 4c0d134..0a35160 100644 --- a/GdbExecutor.h +++ b/GdbExecutor.h @@ -14,6 +14,7 @@ #pragma once #include "/EgtDev/Include/EgkGdbExecutor.h" +#include "/EgtDev/Include/EgtPerfCounter.h" #include "GeomDB.h" #include "OutScl.h" @@ -35,6 +36,7 @@ class GdbExecutor : public IGdbExecutor bool GetVectorParam( const std::string& sParam, Vector3d& vtV) ; bool GetPointParam( const std::string& sParam, Point3d& ptP) ; bool GetPointWParam( const std::string& sParam, Point3d& ptP, double& dW) ; + bool GetFrameParam( const std::string& sParam, Frame3d& frF) ; bool ExecuteGroup( const std::string& sCmd2, const STRVECTOR& vsParams) ; bool ExecutePoint( const std::string& sCmd2, const STRVECTOR& vsParams) ; bool ExecuteVector( const std::string& sCmd2, const STRVECTOR& vsParams) ; @@ -55,10 +57,12 @@ class GdbExecutor : public IGdbExecutor bool ExecuteSave( const STRVECTOR& vsParams) ; bool ExecuteOutScl( const std::string& sCmd2, const STRVECTOR& vsParams) ; bool OutGroupScl( int nId, int nFlag) ; + bool ExecuteCounter( const std::string& sCmd2, const STRVECTOR& vsParams) ; private : IGeomDB* m_pGDB ; OutScl m_OutScl ; typedef std::unordered_map NameMap ; NameMap m_NameMap ; + PerformanceCounter m_Counter ; } ; diff --git a/GdbGroup.cpp b/GdbGroup.cpp index 91ed495..f7436b8 100644 --- a/GdbGroup.cpp +++ b/GdbGroup.cpp @@ -197,11 +197,11 @@ GdbGroup::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, dou //---------------------------------------------------------------------------- bool -GdbGroup::Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) +GdbGroup::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) { bool bOk ; bool bUniform ; - Point3d ptCenLoc ; + Frame3d frRefLoc ; GdbNode* pGdbNode ; @@ -210,20 +210,15 @@ GdbGroup::Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dC // determino se la scalatura è uniforme bUniform = fabs( dCoeffX - dCoeffY) < EPS_SMALL && fabs( dCoeffX - dCoeffZ) < EPS_SMALL ; - // se la scalatura è uniforme, basta portare il centro nel riferimento del gruppo - //if ( bUniform) { - ptCenLoc = ptCen ; - ptCenLoc.ToLoc( m_gfrFrame.m_frF) ; - // } - //// altrimenti si deve propagare il riferimento rispetto al centro - // else - // return false ; // !!!!! TODO !!!!! + // basta portare il riferimento di scalatura nel riferimento del gruppo + frRefLoc = frRef ; + frRefLoc.ToLoc( m_gfrFrame.m_frF) ; // ciclo sui nodi bOk = true ; pGdbNode = GetFirstNode() ; while ( pGdbNode != nullptr) { - if ( ! pGdbNode->Scale( ptCenLoc, dCoeffX, dCoeffY, dCoeffZ)) + if ( ! pGdbNode->Scale( frRefLoc, dCoeffX, dCoeffY, dCoeffZ)) bOk = false ; pGdbNode = pGdbNode->GetNext() ; } diff --git a/GdbGroup.h b/GdbGroup.h index 58ecdec..9bdc0cf 100644 --- a/GdbGroup.h +++ b/GdbGroup.h @@ -36,7 +36,7 @@ class GdbGroup : public GdbNode virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg) { double dAngRad = dAngDeg * DEGTORAD ; return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; } - virtual bool Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) ; + virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ; public : GdbGroup( void) ; diff --git a/GdbNode.h b/GdbNode.h index 974d2d1..039901a 100644 --- a/GdbNode.h +++ b/GdbNode.h @@ -35,7 +35,7 @@ class GdbNode virtual bool Translate( const Vector3d& vtMove) = 0 ; virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) = 0 ; virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) = 0 ; - virtual bool Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) = 0 ; + virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) = 0 ; //virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) = 0 ; public : diff --git a/GdbObj.cpp b/GdbObj.cpp index 07ba07a..d83df5f 100644 --- a/GdbObj.cpp +++ b/GdbObj.cpp @@ -162,7 +162,7 @@ GdbObj::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, doubl //---------------------------------------------------------------------------- bool -GdbObj::Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) +GdbObj::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) { if ( m_pGeoObj != nullptr) { // se scalatura non omogenea e arco, devo trasformare in curva di Bezier @@ -179,7 +179,7 @@ GdbObj::Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoe m_pGeoObj = Release( pCrvBez) ; } // eseguo scalatura - return m_pGeoObj->Scale( ptCen, dCoeffX, dCoeffY, dCoeffZ) ; + return m_pGeoObj->Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ; } else return false ; diff --git a/GdbObj.h b/GdbObj.h index 0d698aa..0fb95f0 100644 --- a/GdbObj.h +++ b/GdbObj.h @@ -33,7 +33,7 @@ class GdbObj : public GdbNode virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg) { double dAngRad = dAngDeg * DEGTORAD ; return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; } - virtual bool Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) ; + virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ; public : GdbObj( void) ; diff --git a/GeoFrame3d.h b/GeoFrame3d.h index ea8aa28..ac7f66f 100644 --- a/GeoFrame3d.h +++ b/GeoFrame3d.h @@ -37,7 +37,7 @@ class GeoFrame3d : public IGeoFrame3d { return m_frF.Rotate( ptAx, vtAx, dCosAng, dSinAng) ; } virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) { return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; } - virtual bool Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) + virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) { return false ; } virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) { return false ; } diff --git a/GeoPoint3d.h b/GeoPoint3d.h index 852c4f9..31b140e 100644 --- a/GeoPoint3d.h +++ b/GeoPoint3d.h @@ -37,8 +37,8 @@ class GeoPoint3d : public IGeoPoint3d { return m_ptP.Rotate( ptAx, vtAx, dCosAng, dSinAng) ; } virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) { return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; } - virtual bool Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) - { return m_ptP.Scale( ptCen, dCoeffX, dCoeffY, dCoeffZ) ;} + virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) + { return m_ptP.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;} virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) { return m_ptP.Mirror( ptOn, vtNorm) ;} virtual bool ToGlob( const Frame3d& frRef) diff --git a/GeoVector3d.h b/GeoVector3d.h index c598aed..e6e121b 100644 --- a/GeoVector3d.h +++ b/GeoVector3d.h @@ -37,8 +37,8 @@ class GeoVector3d : public IGeoVector3d { return m_vtV.Rotate( vtAx, dCosAng, dSinAng) ; } virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) { return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; } - virtual bool Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) - { return m_vtV.Scale( dCoeffX, dCoeffY, dCoeffZ) ;} + virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) + { return m_vtV.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;} virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) { return m_vtV.Mirror( vtNorm) ;} virtual bool ToGlob( const Frame3d& frRef) diff --git a/GeomDB.cpp b/GeomDB.cpp index c97c4be..bd3d6c3 100644 --- a/GeomDB.cpp +++ b/GeomDB.cpp @@ -527,7 +527,7 @@ GeomDB::Rotate( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosA //---------------------------------------------------------------------------- bool -GeomDB::Scale( int nId, const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) +GeomDB::Scale( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) { GdbNode* pGdbNode ; @@ -537,7 +537,7 @@ GeomDB::Scale( int nId, const Point3d& ptCen, double dCoeffX, double dCoeffY, do return false ; // eseguo la scalatura - return pGdbNode->Scale( ptCen, dCoeffX, dCoeffY, dCoeffZ) ; + return pGdbNode->Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ; } //---------------------------------------------------------------------------- diff --git a/GeomDB.h b/GeomDB.h index 6c73ec4..396e4b8 100644 --- a/GeomDB.h +++ b/GeomDB.h @@ -53,7 +53,7 @@ class GeomDB : public IGeomDB virtual bool Rotate( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg) { double dAngRad = dAngDeg * DEGTORAD ; return Rotate( nId, ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; } - virtual bool Scale( int nId, const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) ; + virtual bool Scale( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ; virtual bool Mirror( int nId, const Point3d& ptOn, const Vector3d& vtNorm) ; public : diff --git a/OutScl.cpp b/OutScl.cpp index cd1a3d7..b3b9bfd 100644 --- a/OutScl.cpp +++ b/OutScl.cpp @@ -335,17 +335,28 @@ OutScl::NormalOrNone( const CrvPointDiffGeom& oDiffG) //---------------------------------------------------------------------------- bool -OutScl::PutCurve( const IGeoObj* pGeoObj, int nFlag) +OutScl::PutGeoObj( const IGeoObj* pGeoObj, int nFlag) +{ + if (( pGeoObj->GetType() & GEO_CURVE) != 0) { + const ICurve* pCurve ; + // recupero e controllo la curva + if ( ( pCurve = GetCurve( pGeoObj)) == nullptr) + return false ; + // eseguo output + return PutCurve( pCurve, nFlag) ; + } + else + return true ; +} + +//---------------------------------------------------------------------------- +bool +OutScl::PutCurve( const ICurve* pCurve, int nFlag) { bool bFound ; PolyLine PL ; - const ICurve* pCurve ; - // recupero e controllo la curva - if ( ( pCurve = GetCurve( pGeoObj)) == nullptr) - return false ; - // ciclo per disegnare i segmenti Remark( "Curve") ; Point3d ptIni ; diff --git a/OutScl.h b/OutScl.h index 3de3e8a..0806ca8 100644 --- a/OutScl.h +++ b/OutScl.h @@ -34,8 +34,7 @@ class OutScl bool SetMaterial( double dRed, double dGreen, double dBlue) ; bool SetPartLay( std::string sPart, std::string sLay) ; bool SetPartLayRef( std::string sPart, std::string sLay, const Frame3d& frFrame) ; - bool PutCurve( const IGeoObj* pCurve, int nFlag) ; - bool PutPolygBez( const ICurveBezier& CrvBez) ; + bool PutGeoObj( const IGeoObj* pGeoObj, int nFlag) ; bool PutBBox( const BBox3d& b3B) ; private : @@ -49,6 +48,8 @@ class OutScl bool CircleCR( const Point3d& ptCen, double dRad) ; bool ArcCurvOrTgOrNone( const CrvPointDiffGeom& oDiffG) ; bool NormalOrNone( const CrvPointDiffGeom& oDiffG) ; + bool PutCurve( const ICurve* pCurve, int nFlag) ; + bool PutPolygBez( const ICurveBezier& CrvBez) ; private : std::ofstream m_ofFile ; diff --git a/Point3d.cpp b/Point3d.cpp index 84a2ec0..9b339e0 100644 --- a/Point3d.cpp +++ b/Point3d.cpp @@ -63,22 +63,22 @@ Point3d::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, doub // Scalatura non uniforme //---------------------------------------------------------------------------- bool -Point3d::Scale( const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) +Point3d::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) { Vector3d vtDiff ; // vettore dal centro al punto - vtDiff = *this - ptCen ; + vtDiff = *this - frRef.Orig() ; if ( vtDiff.IsZero()) return true ; // scalatura del vettore - if ( ! vtDiff.Scale( dCoeffX, dCoeffY, dCoeffZ)) + if ( ! vtDiff.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ)) return false ; // ricostruisco il punto - *this = ptCen + vtDiff ; + *this = frRef.Orig() + vtDiff ; return true ; } diff --git a/Vector3d.cpp b/Vector3d.cpp index c108994..7ea5ea3 100644 --- a/Vector3d.cpp +++ b/Vector3d.cpp @@ -204,11 +204,16 @@ Vector3d::Rotate( const Vector3d& vtAx, double dCosAng, double dSinAng) // Scalatura non uniforme //---------------------------------------------------------------------------- bool -Vector3d::Scale( double dCoeffX, double dCoeffY, double dCoeffZ) +Vector3d::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) { - x *= dCoeffX ; - y *= dCoeffY ; - z *= dCoeffZ ; + // verifico validità del frame + if ( frRef.GetType() == Frame3d::ERR) + return false ; + + // ricavo le componenti sugli assi di scalatura, le scalo e riassemblo il vettore completo + *this = ( (*this) * frRef.VersX() * dCoeffX) * frRef.VersX() + + ( (*this) * frRef.VersY() * dCoeffY) * frRef.VersY() + + ( (*this) * frRef.VersZ() * dCoeffZ) * frRef.VersZ() ; return true ; }