diff --git a/API_GeoSnap.cpp b/API_GeoSnap.cpp index c376a88..9bad4c8 100644 --- a/API_GeoSnap.cpp +++ b/API_GeoSnap.cpp @@ -504,6 +504,23 @@ __stdcall EgtSurfTmFacetNormVersor( int nId, int nFacet, int nRefId, double vtNo return TRUE ; } +//---------------------------------------------------------------------------- +BOOL +__stdcall EgtSurfTmFacetOppositeSide( int nId, int nFacet, const double vtDir[3], int nRefId, double ptP1[3], double ptP2[3]) +{ + // verifica parametri + if ( vtDir == nullptr || ptP1 == nullptr || ptP2 == nullptr) + return FALSE ; + // recupero gli estremi del lato opposto + Point3d ptMyP1, ptMyP2 ; + if ( ! ExeSurfTmFacetOppositeSide( nId, nFacet, vtDir, nRefId, ptMyP1, ptMyP2)) + return FALSE ; + // assegno risultati + VEC_FROM_3D( ptP1, ptMyP1) + VEC_FROM_3D( ptP2, ptMyP2) + return TRUE ; +} + //---------------------------------------------------------------------------- BOOL __stdcall EgtSurfTmFacetAdjacencies( int nId, int nFacet, int*& vAdj, int* pnCount) @@ -519,17 +536,22 @@ __stdcall EgtSurfTmFacetAdjacencies( int nId, int nFacet, int*& vAdj, int* pnCou int nDim = 0 ; for ( int i = 0 ; i < int( vTmp.size()) ; ++ i) nDim += int( vTmp[i].size()) + 1 ; - vAdj = (int*) malloc( nDim * sizeof( int)) ; - if ( vAdj == nullptr) - return FALSE ; int nCount = 0 ; - for ( int i = 0 ; i < int( vTmp.size()) ; ++ i) { - for ( int j = 0 ; j < int( vTmp[i].size()) ; ++ j) { - vAdj[nCount] = vTmp[i][j] ; + if ( nDim == 0) { + vAdj = nullptr ; + } + else { + vAdj = (int*) malloc( nDim * sizeof( int)) ; + if ( vAdj == nullptr) + return FALSE ; + for ( int i = 0 ; i < int( vTmp.size()) ; ++ i) { + for ( int j = 0 ; j < int( vTmp[i].size()) ; ++ j) { + vAdj[nCount] = vTmp[i][j] ; + nCount ++ ; + } + vAdj[nCount] = - 2 ; nCount ++ ; } - vAdj[nCount] = - 2 ; - nCount ++ ; } *pnCount = nCount ; return TRUE ; @@ -552,6 +574,41 @@ __stdcall EgtSurfTmFacetsContact( int nId, int nF1, int nF2, int nRefId, bool* p return TRUE ; } +//---------------------------------------------------------------------------- +BOOL +__stdcall EgtSurfTmLineInters( int nId, const double ptP[3], const double vtDir[3], int nRefType, int*& vFlagInters, double*& vParInters, int* pnCount) +{ + // verifica parametri + if ( ptP == nullptr || vtDir == nullptr || &vFlagInters == nullptr || &vParInters == nullptr || pnCount == nullptr) + return FALSE ; + // eseguo intersezione + INTDBLVECTOR vInters ; + if ( ! ExeSurfTmLineInters( nId, ptP, vtDir, nRefType, vInters)) + return FALSE ; + // assegno risultati + int nDim = int( vInters.size()) ; + if ( nDim == 0) { + vFlagInters = nullptr ; + vParInters = nullptr ; + } + else { + vFlagInters = (int*) malloc( nDim * sizeof( int)) ; + if ( vFlagInters == nullptr) + return FALSE ; + vParInters = (double*) malloc( nDim * sizeof( double)) ; + if ( vParInters == nullptr) { + free( vFlagInters) ; + return FALSE ; + } + for ( int i = 0 ; i < nDim ; ++ i) { + vFlagInters[i] = vInters[i].first ; + vParInters[i] = vInters[i].second ; + } + } + *pnCount = nDim ; + return TRUE ; +} + //---------------------------------------------------------------------------- BOOL __stdcall EgtTextNormVersor( int nId, int nRefId, double vtNorm[3]) diff --git a/EgtInterface.rc b/EgtInterface.rc index 80bed40..f7480a4 100644 Binary files a/EgtInterface.rc and b/EgtInterface.rc differ