Merge branch 'master' into CmdCreateSurfBezier
This commit is contained in:
+19
-15
@@ -49,7 +49,7 @@ MyCDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfTmI
|
||||
// porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
|
||||
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
|
||||
// verifico la collisione
|
||||
return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, dSafeDist, *pStm) ? 1 : 0) ;
|
||||
return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, *pStm, dSafeDist) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -69,7 +69,7 @@ MyCDeBoxVolZmap( const Frame3d& frBox, const Vector3d& vtDiag, int nZmapId, doub
|
||||
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
|
||||
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
|
||||
// verifico la collisione
|
||||
return ( pVZM->AvoidBox( frBoxL, vtDiag, dSafeDist, false) ? 0 : 1) ;
|
||||
return ( pVZM->CDeBox( frBoxL, vtDiag, dSafeDist, false) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -118,7 +118,7 @@ MyCDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dBaseLenX, doub
|
||||
// porto in locale alla superficie il riferimento del prismoide rettangolare
|
||||
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ;
|
||||
// verifico la collisione
|
||||
return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, *pStm) ? 1 : 0) ;
|
||||
return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, *pStm, dSafeDist) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -140,7 +140,7 @@ MyCDeRectPrismoidVolZmap( const Frame3d& frPrismoid, double dBaseLenX, double dB
|
||||
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
|
||||
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frLoc) ;
|
||||
// verifico la collisione
|
||||
return ( pVZM->AvoidRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 0 : 1) ;
|
||||
return ( pVZM->CDeRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -193,7 +193,7 @@ MyCDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, int nSurfTmId,
|
||||
// porto in locale alla superficie il riferimento del cilindro
|
||||
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
|
||||
// verifico la collisione
|
||||
return ( CDeCylClosedSurfTm( frCylL, dR, dH, dSafeDist, *pStm) ? 1 : 0) ;
|
||||
return ( CDeCylClosedSurfTm( frCylL, dR, dH, *pStm, dSafeDist) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -213,7 +213,7 @@ MyCDeCylVolZmap( const Frame3d& frCyl, double dR, double dH, int nZmapId, double
|
||||
// porto in locale il riferimento
|
||||
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
|
||||
// verifico la collisione
|
||||
return ( pVZM->AvoidCylinder( frCylL, dR, dH, dSafeDist, false) ? 0 : 1) ;
|
||||
return ( pVZM->CDeCylinder( frCylL, dR, dH, dSafeDist, false) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -261,7 +261,7 @@ MyCDeConeClosedSurfTm( const Frame3d& frCone, double dR1, double dR2, double dH,
|
||||
// porto in locale alla superficie il riferimento del cilindro
|
||||
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ;
|
||||
// verifico la collisione
|
||||
return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, dSafeDist, *pStm) ? 1 : 0) ;
|
||||
return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, *pStm, dSafeDist) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -281,7 +281,7 @@ MyCDeConeVolZmap( const Frame3d& frCone, double dR1, double dR2, double dH, int
|
||||
// porto in locale il riferimento
|
||||
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frLoc) ;
|
||||
// verifico la collisione
|
||||
return ( pVZM->AvoidConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 0 : 1) ;
|
||||
return ( pVZM->CDeConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -330,7 +330,7 @@ MyCDeSpheClosedSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dS
|
||||
// porto in locale alla superficie il centro della sfera
|
||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
|
||||
// verifico la collisione
|
||||
return ( CDeSpheClosedSurfTm( ptCenL, dR, dSafeDist, *pStm) ? 1 : 0) ;
|
||||
return ( CDeSpheClosedSurfTm( ptCenL, dR, *pStm, dSafeDist) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -350,7 +350,7 @@ MyCDeSpheVolZmap( const Point3d& ptCen, double dRad, int nZmapId, double dSafeDi
|
||||
// porto in locale il centro della sfera
|
||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
||||
// verifico la collisione
|
||||
return ( pVZM->AvoidSphere( ptCenL, dRad, dSafeDist, false) ? 0 : 1) ;
|
||||
return ( pVZM->CDeSphere( ptCenL, dRad, dSafeDist, false) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -420,7 +420,7 @@ MyCDeClosedSurfTmVolZmap( int nSurfTmId, int nZmapId, double dSafeDist)
|
||||
if ( pVZM == nullptr)
|
||||
return -1 ;
|
||||
// verifico la collisione
|
||||
return ( pVZM->AvoidSurfTm( *pStm, dSafeDist, false) ? 0 : 1) ;
|
||||
return ( pVZM->CDeSurfTm( *pStm, dSafeDist, false) ? 1 : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -429,10 +429,14 @@ ExeCDeSolidSolid( int nSolid1Id, int nSolid2Id, double dSafeDist)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
int nRes = -1 ;
|
||||
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
|
||||
nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ;
|
||||
else if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP)
|
||||
nRes = MyCDeClosedSurfTmVolZmap( nSolid1Id, nSolid2Id, dSafeDist) ;
|
||||
if ( pGeomDB != nullptr) {
|
||||
if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
|
||||
nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ;
|
||||
else if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP)
|
||||
nRes = MyCDeClosedSurfTmVolZmap( nSolid1Id, nSolid2Id, dSafeDist) ;
|
||||
else if ( pGeomDB->GetGeoType( nSolid1Id) == VOL_ZMAP && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
|
||||
nRes = MyCDeClosedSurfTmVolZmap( nSolid2Id, nSolid1Id, dSafeDist) ;
|
||||
}
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtCDeSolidSolid({" + IdToString( nSolid1Id) + "," +
|
||||
|
||||
@@ -1538,7 +1538,7 @@ ExeCreateSurfTmBySurfBezier( int nParentId, int nSbezId)
|
||||
PtrOwner<ISurfTriMesh> pStm( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
|
||||
bOk = bOk && ! IsNull( pStm) ;
|
||||
// la porto nel riferimento destinazione
|
||||
pStm->LocToLoc( frSou, frLoc) ;
|
||||
bOk = bOk && pStm->LocToLoc( frSou, frLoc) ;
|
||||
// inserisco la superficie trimesh nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
|
||||
+165
-255
@@ -29,14 +29,17 @@
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
||||
#include "/EgtDev/Include/EGkVolZmap.h"
|
||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||
#include "/EgtDev/Include/EGkIntersLineBox.h"
|
||||
#include "/EgtDev/Include/EGkIntersPlaneBox.h"
|
||||
#include "/EgtDev/Include/EGkIntersLinePlane.h"
|
||||
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkIntersLineVolZmap.h"
|
||||
#include "/EgtDev/Include/EGkIntersPlaneBox.h"
|
||||
#include "/EgtDev/Include/EGkIntersLineSurfBez.h"
|
||||
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkIntersPlaneVolZmap.h"
|
||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||
#include "/EgtDev/Include/EGkIntersCurveSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkIntersSurfTmSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkIntersLinePlane.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
@@ -68,7 +71,7 @@ MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, con
|
||||
if ( ! CrvLoc->GetLocalBBox( b3Crv))
|
||||
return false ;
|
||||
b3Crv.Expand( 100 * EPS_SMALL) ;
|
||||
// definisco la linea (punto e direzione sono già nel riferimento di calcolo)
|
||||
// definisco la linea (punto e direzione sono gi� nel riferimento di calcolo)
|
||||
double dLen = 2 * floor( b3Crv.MaxDistFromPoint( ptP)) ;
|
||||
double dOffs = -dLen / 2 ;
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
@@ -158,7 +161,7 @@ ExeLineBoxInters( const Point3d& ptP, const Vector3d& vtDir, const BBox3d& b3Box
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -191,173 +194,9 @@ MyLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRef
|
||||
ILSIVECTOR vInfo ;
|
||||
if ( ! IntersLineSurfTm( ptPL, vtDirL, dLen, *pStm, vInfo, false))
|
||||
return false ;
|
||||
// ciclo sulle intersezioni
|
||||
for ( const auto& Info : vInfo) {
|
||||
// se intersezione puntuale
|
||||
if ( Info.nILTT == ILTT_VERT || Info.nILTT == ILTT_EDGE || Info.nILTT == ILTT_IN) {
|
||||
int nFlag = SLT_TOUCH ;
|
||||
if ( Info.dCosDN > EPS_ZERO)
|
||||
nFlag = SLT_OUT ;
|
||||
else if ( Info.dCosDN < -EPS_ZERO)
|
||||
nFlag = SLT_IN ;
|
||||
vInters.emplace_back( nFlag, Info.dU) ;
|
||||
}
|
||||
// se altrimenti intersezione con coincidenza
|
||||
else if ( Info.nILTT == ILTT_SEGM || Info.nILTT == ILTT_SEGM_ON_EDGE) {
|
||||
vInters.emplace_back( SLT_TG_INI, Info.dU) ;
|
||||
vInters.emplace_back( SLT_TG_FIN, Info.dU2) ;
|
||||
}
|
||||
}
|
||||
// elimino intersezioni ripetute
|
||||
for ( size_t j = 1 ; j < vInters.size() ; ) {
|
||||
// intersezione precedente
|
||||
size_t i = j - 1 ;
|
||||
// se hanno lo stesso parametro
|
||||
if ( abs( vInters[i].second - vInters[j].second) < EPS_SMALL) {
|
||||
// se sono entrambe entranti o uscenti, elimino la seconda
|
||||
if ( ( vInters[i].first == SLT_IN && vInters[j].first == SLT_IN) ||
|
||||
( vInters[i].first == SLT_OUT && vInters[j].first == SLT_OUT)) {
|
||||
vInters.erase( vInters.begin() + j) ;
|
||||
continue ;
|
||||
}
|
||||
// se una entrante e l'altra uscente, cambio in touch ed elimino la seconda
|
||||
else if ( ( vInters[i].first == SLT_IN && vInters[j].first == SLT_OUT) ||
|
||||
( vInters[i].first == SLT_OUT && vInters[j].first == SLT_IN)) {
|
||||
vInters[i].first = SLT_TOUCH ;
|
||||
vInters.erase( vInters.begin() + j) ;
|
||||
continue ;
|
||||
}
|
||||
// se una puntuale e l'altra inizio di coincidenza, elimino la prima
|
||||
else if ( ( vInters[i].first == SLT_IN || vInters[i].first == SLT_OUT || vInters[i].first == SLT_TOUCH) && vInters[j].first == SLT_TG_INI) {
|
||||
vInters.erase( vInters.begin() + i) ;
|
||||
continue ;
|
||||
}
|
||||
// se una fine di coincidenza e l'altra puntuale, elimino la seconda
|
||||
else if ( vInters[i].first == SLT_TG_FIN && ( vInters[j].first == SLT_IN || vInters[j].first == SLT_OUT || vInters[j].first == SLT_TOUCH)) {
|
||||
vInters.erase( vInters.begin() + j) ;
|
||||
continue ;
|
||||
}
|
||||
// se una fine di coincidenza e l'altra inizio di coincidenza, elimino entrambe
|
||||
else if ( i > 0 && vInters[i].first == SLT_TG_FIN && vInters[j].first == SLT_TG_INI) {
|
||||
vInters.erase( vInters.begin() + j) ;
|
||||
vInters.erase( vInters.begin() + i) ;
|
||||
-- j ;
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
// passo alla successiva
|
||||
++ j ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
|
||||
INTDBLVECTOR& vInters)
|
||||
{
|
||||
// eseguo
|
||||
bool bOk = MyLineSurfTmInters( ptP, vtDir, nId, nRefType, vInters) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtLineSurfTmInters({" + ToString( ptP) + "},{" +
|
||||
ToString( vtDir) + "}," +
|
||||
ToString( nId) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
MyLineSurfBzInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
|
||||
INTDBLVECTOR& vInters)
|
||||
{
|
||||
vInters.clear() ;
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie Bezier
|
||||
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pSbz == nullptr)
|
||||
return false ;
|
||||
// recupero il suo riferimento globale
|
||||
Frame3d frSurf ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frSurf))
|
||||
return false ;
|
||||
// porto in locale il punto e la direzione della linea
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frSurf) ;
|
||||
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frSurf) ;
|
||||
vtDirL.Normalize() ;
|
||||
// calcolo l'ingombro della Bezier
|
||||
BBox3d b3Surf ;
|
||||
if ( ! pSbz->GetLocalBBox( b3Surf))
|
||||
return false ;
|
||||
// calcolo l'intersezione
|
||||
double dLen = b3Surf.MaxDistFromPoint( ptPL) ;
|
||||
ILSBIVECTOR vInfo ;
|
||||
if ( ! IntersLineSurfBz( ptPL, vtDirL, dLen, pSbz, vInfo, false))
|
||||
return false ;
|
||||
// ciclo sulle intersezioni
|
||||
for ( const auto& Info : vInfo) {
|
||||
// se intersezione puntuale
|
||||
if ( Info.nILTT == ILTT_VERT || Info.nILTT == ILTT_EDGE || Info.nILTT == ILTT_IN) {
|
||||
int nFlag = SLT_TOUCH ;
|
||||
if ( Info.dCosDN > EPS_ZERO)
|
||||
nFlag = SLT_OUT ;
|
||||
else if ( Info.dCosDN < -EPS_ZERO)
|
||||
nFlag = SLT_IN ;
|
||||
vInters.emplace_back( nFlag, Info.dU) ;
|
||||
}
|
||||
// se altrimenti intersezione con coincidenza
|
||||
else if ( Info.nILTT == ILTT_SEGM || Info.nILTT == ILTT_SEGM_ON_EDGE) {
|
||||
vInters.emplace_back( SLT_TG_INI, Info.dU) ;
|
||||
vInters.emplace_back( SLT_TG_FIN, Info.dU2) ;
|
||||
}
|
||||
}
|
||||
// elimino intersezioni ripetute
|
||||
for ( size_t j = 1 ; j < vInters.size() ; ) {
|
||||
// intersezione precedente
|
||||
size_t i = j - 1 ;
|
||||
// se hanno lo stesso parametro
|
||||
if ( abs( vInters[i].second - vInters[j].second) < EPS_SMALL) {
|
||||
// se sono entrambe entranti o uscenti, elimino la seconda
|
||||
if ( ( vInters[i].first == SLT_IN && vInters[j].first == SLT_IN) ||
|
||||
( vInters[i].first == SLT_OUT && vInters[j].first == SLT_OUT)) {
|
||||
vInters.erase( vInters.begin() + j) ;
|
||||
continue ;
|
||||
}
|
||||
// se una entrante e l'altra uscente, cambio in touch ed elimino la seconda
|
||||
else if ( ( vInters[i].first == SLT_IN && vInters[j].first == SLT_OUT) ||
|
||||
( vInters[i].first == SLT_OUT && vInters[j].first == SLT_IN)) {
|
||||
vInters[i].first = SLT_TOUCH ;
|
||||
vInters.erase( vInters.begin() + j) ;
|
||||
continue ;
|
||||
}
|
||||
// se una puntuale e l'altra inizio di coincidenza, elimino la prima
|
||||
else if ( ( vInters[i].first == SLT_IN || vInters[i].first == SLT_OUT || vInters[i].first == SLT_TOUCH) && vInters[j].first == SLT_TG_INI) {
|
||||
vInters.erase( vInters.begin() + i) ;
|
||||
continue ;
|
||||
}
|
||||
// se una fine di coincidenza e l'altra puntuale, elimino la seconda
|
||||
else if ( vInters[i].first == SLT_TG_FIN && ( vInters[j].first == SLT_IN || vInters[j].first == SLT_OUT || vInters[j].first == SLT_TOUCH)) {
|
||||
vInters.erase( vInters.begin() + j) ;
|
||||
continue ;
|
||||
}
|
||||
// se una fine di coincidenza e l'altra inizio di coincidenza, elimino entrambe
|
||||
else if ( i > 0 && vInters[i].first == SLT_TG_FIN && vInters[j].first == SLT_TG_INI) {
|
||||
vInters.erase( vInters.begin() + j) ;
|
||||
vInters.erase( vInters.begin() + i) ;
|
||||
-- j ;
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
// passo alla successiva
|
||||
++ j ;
|
||||
}
|
||||
|
||||
// filtro le intersezioni
|
||||
FilterLineSurfTmInters( vInfo, vInters) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -372,19 +211,20 @@ ExeLineSurfBzInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRe
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtLineSurfBzInters({" + ToString( ptP) + "},{" +
|
||||
ToString( vtDir) + "}," +
|
||||
ToString( nId) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
ToString( vtDir) + "}," +
|
||||
ToString( nId) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
MyLineVolZmapInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType, INTDBLVECTOR& vInters)
|
||||
MyLineVolZmapInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
|
||||
INTDBLVECTOR& vInters)
|
||||
{
|
||||
vInters.clear() ;
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
@@ -401,78 +241,21 @@ MyLineVolZmapInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRe
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frZmap) ;
|
||||
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frZmap) ;
|
||||
vtDirL.Normalize() ;
|
||||
// calcolo l'ingombro dello Zmap
|
||||
BBox3d b3Surf ;
|
||||
if ( ! pVZM->GetLocalBBox( b3Surf))
|
||||
return false ;
|
||||
// calcolo l'intersezione
|
||||
ILZIVECTOR vInfo ;
|
||||
if ( ! pVZM->GetLineIntersection( ptPL, vtDirL, vInfo))
|
||||
if ( ! IntersLineVolZmap( ptPL, vtDirL, *pVZM, vInfo))
|
||||
return false ;
|
||||
// ciclo sulle intersezioni
|
||||
for ( const auto& Info : vInfo) {
|
||||
// se intersezione puntuale
|
||||
if ( Info.nILTT == ILTT_VERT || Info.nILTT == ILTT_EDGE || Info.nILTT == ILTT_IN) {
|
||||
int nFlag = SLT_TOUCH ;
|
||||
if ( vtDirL * Info.trTria.GetN() > EPS_ZERO)
|
||||
nFlag = SLT_OUT ;
|
||||
else if ( vtDirL * Info.trTria.GetN() < -EPS_ZERO)
|
||||
nFlag = SLT_IN ;
|
||||
vInters.emplace_back( nFlag, Info.dU) ;
|
||||
}
|
||||
// se altrimenti intersezione con coincidenza
|
||||
else if ( Info.nILTT == ILTT_SEGM || Info.nILTT == ILTT_SEGM_ON_EDGE) {
|
||||
vInters.emplace_back( SLT_TG_INI, Info.dU) ;
|
||||
vInters.emplace_back( SLT_TG_FIN, Info.dU2) ;
|
||||
}
|
||||
}
|
||||
// elimino intersezioni ripetute
|
||||
for ( size_t j = 1 ; j < vInters.size() ; ) {
|
||||
// intersezione precedente
|
||||
size_t i = j - 1 ;
|
||||
// se hanno lo stesso parametro
|
||||
if ( abs( vInters[i].second - vInters[j].second) < EPS_SMALL) {
|
||||
// se sono entrambe entranti o uscenti, elimino la seconda
|
||||
if ( ( vInters[i].first == SLT_IN && vInters[j].first == SLT_IN) ||
|
||||
( vInters[i].first == SLT_OUT && vInters[j].first == SLT_OUT)) {
|
||||
vInters.erase( vInters.begin() + j) ;
|
||||
continue ;
|
||||
}
|
||||
// se una entrante e l'altra uscente, cambio in touch ed elimino la seconda
|
||||
else if ( ( vInters[i].first == SLT_IN && vInters[j].first == SLT_OUT) ||
|
||||
( vInters[i].first == SLT_OUT && vInters[j].first == SLT_IN)) {
|
||||
vInters[i].first = SLT_TOUCH ;
|
||||
vInters.erase( vInters.begin() + j) ;
|
||||
continue ;
|
||||
}
|
||||
// se una puntuale e l'altra inizio di coincidenza, elimino la prima
|
||||
else if ( ( vInters[i].first == SLT_IN || vInters[i].first == SLT_OUT || vInters[i].first == SLT_TOUCH) && vInters[j].first == SLT_TG_INI) {
|
||||
vInters.erase( vInters.begin() + i) ;
|
||||
continue ;
|
||||
}
|
||||
// se una fine di coincidenza e l'altra puntuale, elimino la seconda
|
||||
else if ( vInters[i].first == SLT_TG_FIN && ( vInters[j].first == SLT_IN || vInters[j].first == SLT_OUT || vInters[j].first == SLT_TOUCH)) {
|
||||
vInters.erase( vInters.begin() + j) ;
|
||||
continue ;
|
||||
}
|
||||
// se una fine di coincidenza e l'altra inizio di coincidenza, elimino entrambe
|
||||
else if ( i > 0 && vInters[i].first == SLT_TG_FIN && vInters[j].first == SLT_TG_INI) {
|
||||
vInters.erase( vInters.begin() + j) ;
|
||||
vInters.erase( vInters.begin() + i) ;
|
||||
-- j ;
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
// passo alla successiva
|
||||
++ j ;
|
||||
}
|
||||
|
||||
// filtro le intersezioni
|
||||
FilterLineVolZmapInters( vInfo, vInters) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLineVolZmapInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType, INTDBLVECTOR& vInters)
|
||||
ExeLineVolZmapInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
|
||||
INTDBLVECTOR& vInters)
|
||||
{
|
||||
// eseguo
|
||||
bool bOk = MyLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters) ;
|
||||
@@ -708,7 +491,7 @@ MyPlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, con
|
||||
EPS_SMALL, nPntCount, nCrvCount, nTmp) ;
|
||||
nCount = nPntCount + nCrvCount ;
|
||||
|
||||
// restituisco l'identificativo della prima entità creata
|
||||
// restituisco l'identificativo della prima entit� creata
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -737,7 +520,7 @@ ExePlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, co
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -908,7 +691,7 @@ MyPlaneBoxInters( const Point3d& ptOn, const Vector3d& vtN, const BBox3d& b3Box,
|
||||
nFirstId = nNewId ;
|
||||
++ nSrfCount ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -941,7 +724,7 @@ ExePlaneBoxInters( const Point3d& ptOn, const Vector3d& vtN, const BBox3d& b3Box
|
||||
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -980,7 +763,7 @@ MyPlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDes
|
||||
// inserisco il risultato dell'intersezione nel DB
|
||||
int nFirstId = MyAddPlaneIntersResultToGeomDB( pGeomDB, vPnt, vBpt, vTria, frSurf, frDest, nId, nDestGrpId, plPlane.GetVersN(), dToler,
|
||||
nPntCount, nCrvCount, nSrfCount) ;
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -1014,7 +797,7 @@ ExePlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
|
||||
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -1103,7 +886,7 @@ ExeParPlanesSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, const DBLVEC
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -1131,7 +914,7 @@ MyPlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
|
||||
// recupero lo Zmap e calcolo l'intersezione
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
ICURVEPOVECTOR vpLoop ;
|
||||
if ( pVZM == nullptr || ! pVZM->GetPlaneIntersection( plPlane, vpLoop))
|
||||
if ( pVZM == nullptr || ! IntersPlaneVolZmap( plPlane, *pVZM, vpLoop))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco le curve nel gruppo destinazione
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
@@ -1148,7 +931,7 @@ MyPlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
|
||||
nFirstId = nNewId ;
|
||||
++ nCount ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -1172,7 +955,7 @@ ExePlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nD
|
||||
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -1266,7 +1049,134 @@ ExeCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int*
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static string
|
||||
GetCurveSurfTmIntersType( int nFlag)
|
||||
{
|
||||
switch ( nFlag) {
|
||||
case CSIT_OUT_IN : return "OUT->IN" ;
|
||||
case CSIT_IN_OUT : return "IN->OUT" ;
|
||||
case CSIT_IN_IN : return "IN->IN" ;
|
||||
case CSIT_OUT_OUT : return "OUT->OUT" ;
|
||||
case CSIT_IN_ON : return "IN->ON" ;
|
||||
case CSIT_ON_IN : return "ON->IN" ;
|
||||
case CSIT_OUT_ON : return "OUT->ON" ;
|
||||
case CSIT_ON_OUT : return "ON->OUT" ;
|
||||
}
|
||||
return "NONE" ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
MyCurveSurfTmInters( const int nCrvId, const int nId2, const int nDestGrpId, int& nPntCount, int& nCrvCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
|
||||
// recupero il riferimento del gruppo di destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// recupero la curva e la superficie in locale al gruppo destinazione
|
||||
CurveLocal CrvLoc( pGeomDB, nCrvId, frDest) ;
|
||||
const ICurve* pCrv = GetCurve( CrvLoc) ;
|
||||
if ( pCrv == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
SurfLocal StmLoc( pGeomDB, nId2, frDest) ;
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( StmLoc) ;
|
||||
if ( pStm == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// intersezione filtrata tra la curva e la superficie locali
|
||||
INTDBLVECTOR vInters ;
|
||||
if ( ! IntersCurveSurfTmExt( *pCrv, *pStm, 10 * EPS_SMALL, vInters))
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// recupero i punti e le curve risultanti
|
||||
for ( int i = 0 ; i < int( vInters.size()) ; i++) {
|
||||
// verifico se punto
|
||||
if ( vInters[i].first == CSIT_OUT_IN || vInters[i].first == CSIT_IN_OUT ||
|
||||
vInters[i].first == CSIT_IN_IN || vInters[i].first == CSIT_OUT_OUT || vInters[i].first == CSIT_NONE) {
|
||||
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
|
||||
if ( IsNull( pGeoPnt))
|
||||
return GDB_ID_NULL ;
|
||||
Point3d ptP ;
|
||||
pCrv->GetPointD1D2( vInters[i].second, ICurve::FROM_MINUS, ptP) ;
|
||||
pGeoPnt->Set( ptP) ;
|
||||
// lo inserisco nel DB geometrico
|
||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoPnt)) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// aggiorno parametri
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nNewId ;
|
||||
++ nPntCount ;
|
||||
// assegno info di tipo
|
||||
pGeomDB->SetInfo( nNewId, "CSI", GetCurveSurfTmIntersType( vInters[i].first) +
|
||||
" (" + ToString( vInters[i].second) + ")") ;
|
||||
}
|
||||
// altrimenti dovrebbe essere sovrapposizione
|
||||
else {
|
||||
// indice di inizio
|
||||
int h = ( i > 0 ? i - 1 : int( vInters.size()) - 1) ;
|
||||
// verifico se sovrapposizione
|
||||
if ( ( vInters[h].first == CSIT_IN_ON || vInters[h].first == CSIT_OUT_ON) &&
|
||||
( vInters[i].first == CSIT_ON_IN || vInters[i].first == CSIT_ON_OUT)) {
|
||||
PtrOwner<ICurve> pCrvRes( pCrv->CopyParamRange( vInters[h].second, vInters[i].second)) ;
|
||||
if ( IsNull( pCrvRes))
|
||||
return GDB_ID_NULL ;
|
||||
// lo inserisco nel DB geometrico
|
||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrvRes)) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// aggiorno parametri
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nNewId ;
|
||||
++ nCrvCount ;
|
||||
// assegno info di tipo
|
||||
pGeomDB->SetInfo( nNewId, "CSI_INI", GetCurveSurfTmIntersType( vInters[h].first) +
|
||||
" (" + ToString( vInters[h].second) + ")") ;
|
||||
pGeomDB->SetInfo( nNewId, "CSI_FIN", GetCurveSurfTmIntersType( vInters[i].first) +
|
||||
" (" + ToString( vInters[i].second) + ")") ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCurveSurfTmInters( const int nCrvId, const int nStmId, const int nDestGrpId, int* pnPntCount, int* pnCrvCount)
|
||||
{
|
||||
// eseguo
|
||||
int nPntCount{ 0}, nCrvCount{ 0} ;
|
||||
int nFirstId = MyCurveSurfTmInters( nCrvId, nStmId, nDestGrpId, nPntCount, nCrvCount) ;
|
||||
// aggiorno contatori
|
||||
if ( nFirstId != GDB_ID_NULL) {
|
||||
if ( pnPntCount != nullptr)
|
||||
*pnPntCount = nPntCount ;
|
||||
if ( pnCrvCount != nullptr)
|
||||
*pnCrvCount = nCrvCount ;
|
||||
ExeSetModified() ;
|
||||
}
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtCurveSurfTmInters(" + ToString( nCrvId) + "," +
|
||||
ToString( nStmId) + "," +
|
||||
ToString( nDestGrpId) + ")" +
|
||||
" -- Id=" + ToString( nFirstId) + ", nPntCnt=" + ToString( nPntCount) + ", nCrvCnt=" + ToString( nCrvCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -1399,7 +1309,7 @@ MySurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
|
||||
const ISurfTriMesh* pStm2L = GetSurfTriMesh( Surf2Loc) ;
|
||||
if ( pStm2L == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// eseguo l'intersezione (già espressa nel riferimento destinazione)
|
||||
// eseguo l'intersezione (gi� espressa nel riferimento destinazione)
|
||||
PNTVECTOR vPnt ;
|
||||
BIPNTVECTOR vBpt ;
|
||||
TRIA3DVECTOR vTria ;
|
||||
@@ -1455,7 +1365,7 @@ MySurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
|
||||
nFirstId = nNewId ;
|
||||
++ nSrfCount ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -1487,6 +1397,6 @@ ExeSurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
|
||||
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della prima nuova entità
|
||||
// restituisco l'identificativo della prima nuova entit�
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
@@ -1613,6 +1613,50 @@ ExeCalcFlatPartUpRegion( int nPartId, bool bCalc)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
IgnoreOutlineFillet( IGeomDB* pGeomDB, int nCrvId, int nLayId)
|
||||
{
|
||||
// verifico se la curva nCrvId è un raccordo che deve essere ignorato, ovvero se si tratta di un arco non inclinato, in tangenza
|
||||
// e consecutivo ad almeno un lato inclinato
|
||||
|
||||
// verifico se arco
|
||||
if ( pGeomDB->GetGeoType( nCrvId) == CRV_ARC) {
|
||||
// verifico se non inclinato
|
||||
double dSideAng = 0, dSideAng2 = 0 ;
|
||||
pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) ;
|
||||
pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) ;
|
||||
if ( abs( dSideAng) < EPS_ANG_SMALL && abs( dSideAng2) < EPS_ANG_SMALL) {
|
||||
// verifico se in tangenza con curve consecutive
|
||||
double dPrevAng = ANG_RIGHT, dNextAng = ANG_RIGHT ;
|
||||
pGeomDB->GetInfo( nCrvId, MCH_KEY_PREVANG, dPrevAng) ;
|
||||
pGeomDB->GetInfo( nCrvId, MCH_KEY_NEXTANG, dNextAng) ;
|
||||
if ( abs( dPrevAng) < EPS_ANG_SMALL && abs( dNextAng) < EPS_ANG_SMALL) {
|
||||
// verifico se è inclinata almeno una tra la curva precedente e quella successiva
|
||||
int nPrevId = pGeomDB->GetPrev( nCrvId) ;
|
||||
if ( nPrevId == GDB_ID_NULL)
|
||||
nPrevId = pGeomDB->GetLastInGroup( nLayId) ;
|
||||
if ( nPrevId == GDB_ID_NULL)
|
||||
return false ;
|
||||
double dSideAng, dSideAng2 ;
|
||||
if ( ( pGeomDB->GetInfo( nPrevId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) ||
|
||||
( pGeomDB->GetInfo( nPrevId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL))
|
||||
return true ;
|
||||
|
||||
int nNextId = pGeomDB->GetNext( nCrvId) ;
|
||||
if ( nNextId == GDB_ID_NULL)
|
||||
nNextId = pGeomDB->GetFirstInGroup( nLayId) ;
|
||||
if ( nNextId == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ( pGeomDB->GetInfo( nNextId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) ||
|
||||
( pGeomDB->GetInfo( nNextId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOrig, int nLayReg, double dH)
|
||||
@@ -1683,7 +1727,8 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
||||
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
pCrv->SimpleOffset( dCalcOffset) ;
|
||||
if ( ! pCrv->SimpleOffset( dCalcOffset))
|
||||
pGeomDB->Erase( nNewId) ;
|
||||
}
|
||||
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
|
||||
double dOffset2 = 0 ;
|
||||
@@ -1696,8 +1741,12 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
||||
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
pCrv->SimpleOffset( dCalcOffset) ;
|
||||
if ( ! pCrv->SimpleOffset( dCalcOffset))
|
||||
pGeomDB->Erase( nNewId) ;
|
||||
}
|
||||
// verifico se raccordo da ignorare per poter calcolare la regione
|
||||
else if ( IgnoreOutlineFillet( pGeomDB, nCrvId, nLayId))
|
||||
pGeomDB->Erase( nNewId) ;
|
||||
}
|
||||
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
|
||||
if ( ! AdjustLayerCurves( pGeomDB, nTmpLayId))
|
||||
@@ -1720,7 +1769,7 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// determino ed eseguo offset
|
||||
double dSideAng ;
|
||||
double dSideAng, dSideAng2 ;
|
||||
if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) {
|
||||
double dOffset = 0 ;
|
||||
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET, dOffset) ;
|
||||
@@ -1728,8 +1777,22 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
||||
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
pCrv->SimpleOffset( dCalcOffset) ;
|
||||
if ( ! pCrv->SimpleOffset( dCalcOffset))
|
||||
pGeomDB->Erase( nNewId) ;
|
||||
}
|
||||
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
|
||||
double dOffset2 = 0 ;
|
||||
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET2, dOffset2) ;
|
||||
double dCalcOffset = dOffset2 ;
|
||||
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
if ( ! pCrv->SimpleOffset( dCalcOffset))
|
||||
pGeomDB->Erase( nNewId) ;
|
||||
}
|
||||
// verifico se raccordo da ignorare per poter calcolare la regione
|
||||
else if ( IgnoreOutlineFillet( pGeomDB, nCrvId, nLayId))
|
||||
pGeomDB->Erase( nNewId) ;
|
||||
}
|
||||
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
|
||||
if ( ! AdjustLayerCurves( pGeomDB, nTmpLay2Id))
|
||||
@@ -1769,10 +1832,13 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
||||
//if ( dStartProD > EPS_SMALL)
|
||||
// pCrv->ExtendStartByLen( dStartProD) ;
|
||||
double dStartProMin = min( dStartProD, dStartProU) ;
|
||||
if ( dStartProMin < - EPS_SMALL)
|
||||
if ( dStartProMin < - EPS_SMALL) {
|
||||
pCrv->TrimStartAtLen( - dStartProMin) ;
|
||||
if ( abs( dStartProD - dStartProU) > EPS_SMALL)
|
||||
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ;
|
||||
if ( abs( dStartProD - dStartProU) > EPS_SMALL)
|
||||
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ;
|
||||
}
|
||||
else
|
||||
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, max( dStartProD, dStartProU)) ;
|
||||
}
|
||||
else {
|
||||
if ( dStartProD < - EPS_SMALL)
|
||||
@@ -1799,9 +1865,11 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
|
||||
double dLen ;
|
||||
pCrv->GetLength( dLen) ;
|
||||
pCrv->TrimEndAtLen( dLen + dEndProMin) ;
|
||||
if ( abs( dEndProD - dEndProU) > EPS_SMALL)
|
||||
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ;
|
||||
}
|
||||
if ( abs( dEndProD - dEndProU) > EPS_SMALL)
|
||||
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ;
|
||||
else
|
||||
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, max( dEndProD, dEndProU)) ;
|
||||
}
|
||||
else {
|
||||
if ( dEndProD < - EPS_SMALL) {
|
||||
|
||||
@@ -640,6 +640,15 @@ ExeZoomWin( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetViewOrizzOffsStep( int nDirOffsStep)
|
||||
{
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, false)
|
||||
return pScene->SetCameraDirOrizzOffset( nDirOffsStep) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetView( int nDir, bool bRedraw)
|
||||
@@ -709,6 +718,19 @@ ExeRotateView( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetViewOrizzOffsStep( int* pnDirOffsStep)
|
||||
{
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, false)
|
||||
// recupero offset direzione di vista
|
||||
if ( pnDirOffsStep == nullptr)
|
||||
return false ;
|
||||
*pnDirOffsStep = pScene->GetCameraDirOrizzOffset() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetView( int* pnDir)
|
||||
|
||||
Binary file not shown.
@@ -376,6 +376,32 @@ LuaCurveCurveInters( lua_State* L)
|
||||
return 3 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveSurfTmInters( lua_State* L)
|
||||
{
|
||||
// 3 parametri : nCrvId, nStmId, nDestGrpId
|
||||
int nCrvId ;
|
||||
LuaCheckParam( L, 1, nCrvId)
|
||||
int nStmId ;
|
||||
LuaCheckParam( L, 2, nStmId)
|
||||
int nDestGrpId ;
|
||||
LuaCheckParam( L, 3, nDestGrpId) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo l'intersezione
|
||||
int nPntCount = 0 ;
|
||||
int nCrvCount = 0 ;
|
||||
int nNewId = ExeCurveSurfTmInters( nCrvId, nStmId, nDestGrpId, &nPntCount, &nCrvCount) ;
|
||||
// restituisco il risultato
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nNewId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L, nPntCount) ;
|
||||
LuaSetParam( L, nCrvCount) ;
|
||||
return 3 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmSurfTmInters( lua_State* L)
|
||||
@@ -422,6 +448,7 @@ LuaInstallGeoInters( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSurfTmInters", LuaCurveSurfTmInters) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -175,6 +175,21 @@ LuaZoomObject( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetViewOrizzOffsStep( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nDirOffsStep
|
||||
int nDirOffsStep ;
|
||||
LuaCheckParam( L, 1, nDirOffsStep)
|
||||
LuaClearStack( L) ;
|
||||
// imposto offset angolare orizzontale a step di 90° per direzione di vista
|
||||
bool bOk = ExeSetViewOrizzOffsStep( nDirOffsStep) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetView( lua_State* L)
|
||||
@@ -228,6 +243,60 @@ LuaSetViewCenter( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetViewOrizzOffsStep( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero offset angolare orizzontale a step di 90° per direzione di vista
|
||||
int nDirOffsStep ;
|
||||
bool bOk = ExeGetViewOrizzOffsStep( &nDirOffsStep) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetParam( L, nDirOffsStep) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetView( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero direzione di vista
|
||||
int nViewDir ;
|
||||
bool bOk = ExeGetView( &nViewDir) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetParam( L, nViewDir) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetGenericView( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero angoli della direzione di vista
|
||||
double dAngVertDeg ;
|
||||
double dAngHorizDeg ;
|
||||
bool bOk = ExeGetGenericView( &dAngVertDeg, &dAngHorizDeg) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, dAngVertDeg) ;
|
||||
LuaSetParam( L, dAngHorizDeg) ;
|
||||
}
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetImage( lua_State* L)
|
||||
@@ -267,9 +336,13 @@ LuaInstallScene( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomRadius", LuaZoomRadius) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtZoom", LuaZoom) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomObject", LuaZoomObject) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewOrizzOffsStep", LuaSetViewOrizzOffsStep) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetView", LuaSetView) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetGenericView", LuaSetGenericView) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewCenter", LuaSetViewCenter) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetViewOrizzOffsStep", LuaGetViewOrizzOffsStep) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetView", LuaGetView) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGenericView", LuaGetGenericView) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user