diff --git a/EXE_GeoInters.cpp b/EXE_GeoInters.cpp index 02fbc82..286e452 100644 --- a/EXE_GeoInters.cpp +++ b/EXE_GeoInters.cpp @@ -569,7 +569,7 @@ ExePlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe //------------------------------------------------------------------------------- static int -MyParPlanesSurfTmInters( const Vector3d& vtN, const PNTVECTOR& vPntPlanes, int nId, int nDestGrpId, int nRefType, double dToler, int& nGrpCount) +MyParPlanesSurfTmInters( const Vector3d& vtN, const Point3d& pt, const DBLVECTOR& vdDist, int nId, int nDestGrpId, int nRefType, double dToler, int& nGrpCount) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -588,15 +588,16 @@ MyParPlanesSurfTmInters( const Vector3d& vtN, const PNTVECTOR& vPntPlanes, int n // porto in locale la normale del piano Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frSurf) ; + Point3d ptL = GetPointLocal( pGeomDB, pt, nRefType, frSurf) ; // costruisco il frame dei piani Frame3d frPlanes ; - frPlanes.Set( ORIG, vtNL) ; + frPlanes.Set( ptL, vtNL) ; // intersezione fra superficie e piani paralleli IntersParPlanesSurfTm intPlStm( frPlanes, *pStm) ; int nFirstGrpId = GDB_ID_NULL ; - for ( size_t i = 0 ; i < vPntPlanes.size() ; i++) { + for ( size_t i = 0 ; i < vdDist.size() ; i++) { // creo il layer in cui salvare int nGrpId = pGeomDB->AddGroup( GDB_ID_NULL, nDestGrpId, GLOB_FRM) ; @@ -605,12 +606,11 @@ MyParPlanesSurfTmInters( const Vector3d& vtN, const PNTVECTOR& vPntPlanes, int n nFirstGrpId = nGrpId ; // cerco l'intersezione con il piano - Point3d ptOnL = GetPointLocal( pGeomDB, vPntPlanes[i], nRefType, frSurf) ; PNTVECTOR vPnt ; BIPNTVECTOR vBpt ; TRIA3DVECTOR vTria ; - if ( ! intPlStm.GetInters( ptOnL, vPnt, vBpt, vTria)) { - string sErr = "Error on ParPlanesStmInters at plane passing through " + ToString( vPntPlanes[i]) ; + if ( ! intPlStm.GetInters( vdDist[i], vPnt, vBpt, vTria)) { + string sErr = "Error on ParPlanesStmInters at distance " + ToString( vdDist[i]) ; LOG_ERROR( GetLogger(), sErr.c_str()) ; continue ; } @@ -626,12 +626,12 @@ MyParPlanesSurfTmInters( const Vector3d& vtN, const PNTVECTOR& vPntPlanes, int n //------------------------------------------------------------------------------- int -ExeParPlanesSurfTmInters( const Vector3d& vtN, const PNTVECTOR& vPnt, int nId, int nDestGrpId, int nRefType, double dToler, - int* pnGrpCount) +ExeParPlanesSurfTmInters( const Vector3d& vtN, const Point3d& pt, const DBLVECTOR& vdDist, int nId, int nDestGrpId, int nRefType, double dToler, + int* pnGrpCount) { // eseguo int nGrpCount{ 0} ; - int nFirstId = MyParPlanesSurfTmInters( vtN, vPnt, nId, nDestGrpId, nRefType, dToler, nGrpCount) ; + int nFirstId = MyParPlanesSurfTmInters( vtN, pt, vdDist, nId, nDestGrpId, nRefType, dToler, nGrpCount) ; // aggiorno contatori if ( nFirstId != GDB_ID_NULL) { if ( pnGrpCount != nullptr) @@ -641,12 +641,9 @@ ExeParPlanesSurfTmInters( const Vector3d& vtN, const PNTVECTOR& vPnt, int nId, // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sPC ; - for ( size_t i = 0 ; i < vPnt.size() ; ++ i) { - sPC += ( i == 0 ? "{" : ",{") + ToString( vPnt[i]) + "}" ; - } string sLua = "EgtParPlanesSurfTmInters({" + ToString( vtN) + "},{" + - sPC + "}," + + ToString( pt) + "},{" + + ToString( vdDist) + "}," + ToString( nId) + "," + ToString( nDestGrpId) + "," + RefTypeToString( nRefType) + "," + diff --git a/LUA_GeoInters.cpp b/LUA_GeoInters.cpp index b3ec0d1..19b0502 100644 --- a/LUA_GeoInters.cpp +++ b/LUA_GeoInters.cpp @@ -161,20 +161,22 @@ LuaParPlanesSurfTmInters( lua_State* L) // 4 o 5 o 6 parametri : vtN, vPnt, nId, nDestGrpId [, nRefType] [, dToler] Vector3d vtN ; LuaCheckParam( L, 1, vtN) - PNTVECTOR vPnt ; - LuaCheckParam( L, 2, vPnt) + Point3d pt ; + LuaCheckParam( L, 2, pt) + DBLVECTOR vdDist ; + LuaCheckParam( L, 3, vdDist) int nId ; - LuaCheckParam( L, 3, nId) + LuaCheckParam( L, 4, nId) int nDestGrpId ; - LuaCheckParam( L, 4, nDestGrpId) ; + LuaCheckParam( L, 5, nDestGrpId) ; int nRefType = RTY_DEFAULT ; double dToler = 20 * EPS_SMALL ; - if ( LuaGetParam( L, 5, nRefType)) - LuaGetParam( L, 6, dToler) ; + if ( LuaGetParam( L, 6, nRefType)) + LuaGetParam( L, 7, dToler) ; LuaClearStack( L) ; // eseguo l'intersezione int nGrpCount = 0 ; - int nNewId = ExeParPlanesSurfTmInters( vtN, vPnt, nId, nDestGrpId, nRefType, dToler, &nGrpCount) ; + int nNewId = ExeParPlanesSurfTmInters( vtN, pt, vdDist, nId, nDestGrpId, nRefType, dToler, &nGrpCount) ; // restituisco il risultato if ( nNewId != GDB_ID_NULL) LuaSetParam( L, nNewId) ;