EgtInterface 1.5k2 :

- aggiunta EgtCreateSurfTriMeshRuled
- aggiunta EgtExplodeText
- aggiunte EgtExtendCurve*ByLen e EgtExplodeCurveBezier
- aggiunte EgtSelectAll, EgtSelectPartObjs, EgtDeselectPartObjs, EgtSelectLayerObjs, EgtDeselectLayerObjs, EgtGetLastSelectedObj, EgtGetPrevSelectedObj
- aggiunte EgtIntersectionPoint, EgtPointToIdGlob.
This commit is contained in:
Dario Sassi
2014-11-18 16:19:14 +00:00
parent c28d250749
commit 73c8bd68b0
6 changed files with 404 additions and 38 deletions
+74
View File
@@ -20,6 +20,8 @@
#include "/EgtDev/Include/EgkGeoVector3d.h"
#include "/EgtDev/Include/EgkCurve.h"
#include "/EgtDev/Include/EgkExtText.h"
#include "/EgtDev/Include/EgkIntersCurveCurve.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
//----------------------------------------------------------------------------
@@ -237,6 +239,57 @@ __stdcall EgtAtParamPoint( int nId, double dU, double ptP[3])
return FALSE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtIntersectionPoint( int nId1, int nId2, const double ptNear[3], double ptP[3])
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
// devono essere entità geometriche
const IGeoObj* pGObj1 ;
if ( ( pGObj1 = pGeomDB->GetGeoObj( nId1)) == nullptr)
return FALSE ;
const IGeoObj* pGObj2 ;
if ( ( pGObj2 = pGeomDB->GetGeoObj( nId2)) == nullptr)
return FALSE ;
// se curve
if ( ( pGObj1->GetType() & GEO_CURVE) != 0 && ( pGObj2->GetType() & GEO_CURVE) != 0) {
// recupero le curve
const ICurve* pCrv1 = GetCurve( pGObj1) ;
const ICurve* pCrv2 = GetCurve( pGObj2) ;
// recupero i riferimenti in cui sono immerse
Frame3d frEnt1 ;
if ( ! pGeomDB->GetGlobFrame( nId1, frEnt1))
return FALSE ;
Frame3d frEnt2 ;
if ( ! pGeomDB->GetGlobFrame( nId2, frEnt2))
return FALSE ;
// se il riferimento della seconda curva è diverso da quello della prima entità, devo trasformarla
PtrOwner<ICurve> crvTrans( nullptr) ;
if ( ! AreSameFrame( frEnt1, frEnt2)) {
crvTrans.Set( pCrv2->Clone()) ;
if ( IsNull( crvTrans))
return FALSE ;
crvTrans->LocToLoc( frEnt2, frEnt1) ;
pCrv2 = ::Get( crvTrans) ;
}
// porto il punto vicino nel riferimento della prima curva
Point3d ptN( ptNear) ;
ptN.ToLoc( frEnt1) ;
// calcolo il punto di intersezione sulla prima curva più vicino al punto di riferimento
IntersCurveCurve intCC( *pCrv1, *pCrv2, true) ;
Point3d ptI ;
if ( ! intCC.GetIntersPointNearTo( 0, ptN, ptI))
return FALSE ;
// assegno il punto
ptP[0] = ptI.x ;
ptP[1] = ptI.y ;
ptP[2] = ptI.z ;
return TRUE ;
}
return FALSE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtStartVector( int nId, double vtV[3])
@@ -449,6 +502,27 @@ __stdcall EgtVectorToIdLoc( double vtV[3], int nId)
return TRUE ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtPointToIdGlob( double ptP[3], int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
// recupero il riferimento
// se gruppo -> il suo proprio espresso in globale
// se oggetto -> quello del gruppo cui appartiene in globale
Frame3d frRef ;
if ( ! pGeomDB->GetGroupGlobFrame( nId, frRef) &&
! pGeomDB->GetGlobFrame( nId, frRef))
return FALSE ;
// eseguo la trasformazione
Point3d ptPL( ptP) ;
ptPL.ToGlob( frRef) ;
// aggiorno il parametro punto
VEC_FROM_3D( ptP, ptPL)
return TRUE ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtPointToIdLoc( double ptP[3], int nId)