From 75d251f56138c8499a96bc76c3369e46afac8841 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Fri, 13 Mar 2026 13:35:00 +0100 Subject: [PATCH] EgtInterface : - aggiornata interfaccia di EgtSurfBezierParamsFromPoint - aggiunta interfaccia di EgtSurfBezierGetPointNrmD1. --- API_GdbGetSurf.cpp | 40 ++++++++++++++++++++++++++++++++-------- API_GeoDist.cpp | 6 ++++-- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/API_GdbGetSurf.cpp b/API_GdbGetSurf.cpp index d6d05f1..0de1a16 100644 --- a/API_GdbGetSurf.cpp +++ b/API_GdbGetSurf.cpp @@ -344,17 +344,41 @@ __stdcall EgtCopySurfTmFacet( int nId, int nFacet, int nDestGrpId) return ExeCopySurfTmFacet( nId, nFacet, nDestGrpId) ; } +//---------------------------------------------------------------------------- +BOOL +__stdcall EgtSurfBezierParamsFromPoint( int nSurfId, const double ptOnSurf[3], int nRefId, double* pdU, double* pdV) +{ + // verifica parametri + if ( ptOnSurf == nullptr || pdU == nullptr || pdV == nullptr) + return FALSE ; + // eseguo + return ( ExeSurfBezierParamsFromPoint( nSurfId, ptOnSurf, nRefId, *pdU, *pdV) ? TRUE : FALSE) ; +} + +//---------------------------------------------------------------------------- +BOOL +__stdcall EgtSurfBezierGetPointNrmD1( int nSurfId, double dU, double dV, int nUsd, int nVsd, int nRefId, + double ptP[3], double vtNorm[3], double vtDerU[3], double vtDerV[3]) +{ + // verifica parametri di ritorno + if ( ptP == nullptr || vtNorm == nullptr || vtDerU == nullptr || vtDerV == nullptr) + return FALSE ; + // eseguo + Point3d ptMyP ; + Vector3d vtMyNorm, vtMyDerU, vtMyDerV ; + if ( ! ExeSurfBezierGetPointNrmD1( nSurfId, dU, dV, nUsd, nVsd, nRefId, ptMyP, vtMyNorm, vtMyDerU, vtMyDerV)) + return FALSE ; + // assegno risultati + VEC_FROM_3D( ptP, ptMyP) + VEC_FROM_3D( vtNorm, vtMyNorm) + VEC_FROM_3D( vtDerU, vtMyDerU) + VEC_FROM_3D( vtDerV, vtMyDerV) + return TRUE ; +} + //---------------------------------------------------------------------------- int __stdcall EgtExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount) { return ExeExtractSurfBezierLoops( nId, nDestGrpId, pnCount) ; } - -//---------------------------------------------------------------------------- -BOOL -__stdcall EgtSurfBezParamsFromPoint( int nIdSurf, double ptPBez[3], int nDestGroup, double& dU, double& dV) -{ - bool bOk = ExeSurfBezParamsFromPoint( nIdSurf, ptPBez, nDestGroup, dU, dV) ; - return ( bOk ? TRUE : FALSE) ; -} diff --git a/API_GeoDist.cpp b/API_GeoDist.cpp index 581011d..9478738 100644 --- a/API_GeoDist.cpp +++ b/API_GeoDist.cpp @@ -23,6 +23,8 @@ using namespace std ; BOOL __stdcall EgtPointCurveDist( const double ptP[3], int nId, int nRefType, double* pdDist, double* pdU) { + if ( ptP == nullptr || pdDist == NULL || pdU == nullptr) + return FALSE ; Point3d ptTemp ; return ( ExePointCurveDist( ptP, nId, nRefType, pdDist, ptTemp, pdU) ? TRUE : FALSE) ; } @@ -32,7 +34,7 @@ BOOL __stdcall EgtPointCurveDistSide( const double ptP[3], int nId, const double vtN[3], int nRefType, double* pdDist, double ptMin[3], int* pnSide) { - if ( pdDist == nullptr || ptMin == nullptr || pnSide == nullptr) + if ( ptP == nullptr || vtN == nullptr || pdDist == nullptr || ptMin == nullptr || pnSide == nullptr) return FALSE ; Point3d ptTmp ; if ( ! ExePointCurveDistSide( ptP, nId, vtN, nRefType, pdDist, ptTmp, pnSide)) @@ -45,7 +47,7 @@ __stdcall EgtPointCurveDistSide( const double ptP[3], int nId, const double vtN[ BOOL __stdcall EgtPointSurfTmDist( const double ptP[3], int nId, int nRefType, double* pdDist, double ptMin[3], int* pnTria) { - if ( pdDist == nullptr || ptMin == nullptr || pnTria == nullptr) + if ( ptP == nullptr || pdDist == nullptr || ptMin == nullptr || pnTria == nullptr) return FALSE ; Point3d ptTmp ; if ( ! ExePointSurfTmDist( ptP, nId, nRefType, pdDist, ptTmp, pnTria))