Merge commit '3f6c439983dee4957cb04a9b69dd01492ef38954'
This commit is contained in:
+9
-2
@@ -63,7 +63,6 @@ GetSurfBezierByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol)
|
||||
if ( &vpCurve == nullptr || vpCurve.empty())
|
||||
return nullptr ;
|
||||
// calcolo le polilinee che approssimano le curve della regione
|
||||
POLYLINEVECTOR vPLOrd ;
|
||||
POLYLINEVECTOR vPL ;
|
||||
vPL.resize( vpCurve.size()) ;
|
||||
for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) {
|
||||
@@ -73,8 +72,16 @@ GetSurfBezierByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol)
|
||||
Vector3d vtN ;
|
||||
INTMATRIX vnPLIndMat ;
|
||||
BOOLVECTOR vbInvert ;
|
||||
if ( ! CalcRegionPolyLines( vPL, vPLOrd, vtN, vnPLIndMat,vbInvert))
|
||||
if ( ! CalcRegionPolyLines( vPL, vtN, vnPLIndMat,vbInvert))
|
||||
return nullptr ;
|
||||
POLYLINEVECTOR vPLOrd ;
|
||||
for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) {
|
||||
for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j){
|
||||
vPLOrd.push_back(vPL[vnPLIndMat[i][j]]) ;
|
||||
if( vbInvert[vnPLIndMat[i][j]])
|
||||
vPLOrd.back().Invert() ;
|
||||
}
|
||||
}
|
||||
// creo e setto la superficie di bezier
|
||||
PtrOwner<SurfBezier> pSbz( CreateBasicSurfBezier()) ;
|
||||
if ( IsNull( pSbz) || ! pSbz->CreateByRegion( vPLOrd))
|
||||
|
||||
+3
-19
@@ -575,11 +575,12 @@ SurfFlatRegionByContours::GetUnusedCurveTempProps( INTVECTOR& vId)
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
CalcRegionPolyLines( const POLYLINEVECTOR& vPL, POLYLINEVECTOR& vPLOrd, Vector3d& vtN, INTMATRIX& vnPLIndMat, BOOLVECTOR& vbInvert)
|
||||
CalcRegionPolyLines( const POLYLINEVECTOR& vPL, Vector3d& vtN, INTMATRIX& vnPLIndMat, BOOLVECTOR& vbInvert)
|
||||
{
|
||||
// matrice di interi : ogni riga corrisponde ad un chunk, dove in posizione 0 c'è il loop esterno e nelle
|
||||
// successive i loop interni
|
||||
//INTMATRIX vnPLIndMat ;
|
||||
// vettore di bool : riferito al vettore originale delle polyline, riporta true se la polyline è stata invertita
|
||||
|
||||
// ricavo versore normale
|
||||
Plane3d plPlane ; double dArea ;
|
||||
@@ -634,7 +635,6 @@ CalcRegionPolyLines( const POLYLINEVECTOR& vPL, POLYLINEVECTOR& vPLOrd, Vector3d
|
||||
vPL_IndOrder[i] = m_vArea[i].first ;
|
||||
|
||||
// aggiungo le diverse curve
|
||||
vPLOrd = vPL ;
|
||||
bool bFirstCrv ;
|
||||
Plane3d plExtLoop ;
|
||||
double dAreaExtLoop = 0. ;
|
||||
@@ -654,7 +654,6 @@ CalcRegionPolyLines( const POLYLINEVECTOR& vPL, POLYLINEVECTOR& vPLOrd, Vector3d
|
||||
dAreaExtLoop = m_vArea[i].second ;
|
||||
// inverto se necessario
|
||||
if ( m_vArea[i].second < EPS_SMALL) {
|
||||
vPLOrd[j].Invert() ;
|
||||
vCrvCompo[j]->Invert() ;
|
||||
dAreaExtLoop *= -1 ;
|
||||
vbInvert[j] = true ;
|
||||
@@ -690,7 +689,6 @@ CalcRegionPolyLines( const POLYLINEVECTOR& vPL, POLYLINEVECTOR& vPLOrd, Vector3d
|
||||
m_vArea[i].first = -1 ;
|
||||
// inverto se necessario
|
||||
if ( m_vArea[i].second * dAreaExtLoop > 0.) {
|
||||
vPLOrd[j].Invert() ;
|
||||
vCrvCompo[j]->Invert() ;
|
||||
vbInvert[j] = true ;
|
||||
}
|
||||
@@ -700,23 +698,9 @@ CalcRegionPolyLines( const POLYLINEVECTOR& vPL, POLYLINEVECTOR& vPLOrd, Vector3d
|
||||
} while ( ! bFirstCrv) ;
|
||||
|
||||
if ( bInvertAll) {
|
||||
for ( int i = 0 ; i < int( vPLOrd.size()) ; ++i) {
|
||||
vPLOrd[i].Invert() ;
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++i)
|
||||
vbInvert[i] = ! vbInvert[i] ;
|
||||
}
|
||||
}
|
||||
|
||||
//// ordino le PolyLine per area
|
||||
// POLYLINEVECTOR vPL_tmp ;
|
||||
// for ( int i = 0 ; i < int( vPL_IndOrder.size()) ; ++ i)
|
||||
// vPL_tmp.push_back( vPLOrd[ vPL_IndOrder[i]]) ;
|
||||
|
||||
//for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) {
|
||||
// for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j ) {
|
||||
// vPL_tmp.push_back( vPLOrd[vnPLIndMat[i][j]]) ;
|
||||
// }
|
||||
//}
|
||||
//swap( vPLOrd, vPL_tmp) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
+16
-7
@@ -60,7 +60,6 @@ GetSurfTriMeshByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol)
|
||||
if ( &vpCurve == nullptr || vpCurve.empty())
|
||||
return nullptr ;
|
||||
// calcolo le polilinee che approssimano le curve della regione
|
||||
POLYLINEVECTOR vPLOrd ;
|
||||
POLYLINEVECTOR vPL ;
|
||||
vPL.resize( vpCurve.size()) ;
|
||||
for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) {
|
||||
@@ -70,11 +69,17 @@ GetSurfTriMeshByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol)
|
||||
Vector3d vtN ;
|
||||
INTMATRIX vnPLIndMat ;
|
||||
BOOLVECTOR vbInvert ;
|
||||
if ( ! CalcRegionPolyLines( vPL, vPLOrd, vtN, vnPLIndMat, vbInvert))
|
||||
if ( ! CalcRegionPolyLines( vPL, vtN, vnPLIndMat, vbInvert))
|
||||
return nullptr ;
|
||||
for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) {
|
||||
for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j){
|
||||
if( vbInvert[vnPLIndMat[i][j]])
|
||||
vPL[vnPLIndMat[i][j]].Invert() ;
|
||||
}
|
||||
}
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<SurfTriMesh> pSTM( CreateBasicSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPLOrd, vnPLIndMat))
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPL, vnPLIndMat))
|
||||
return nullptr ;
|
||||
// salvo tolleranza lineare usata
|
||||
pSTM->SetLinearTolerance( dLinTol) ;
|
||||
@@ -149,7 +154,6 @@ GetSurfTriMeshByRegionExtrusion( const CICURVEPVECTOR& vpCurve, const Vector3d&
|
||||
return GetSurfTriMeshByExtrusion( vpCurve[0], vtExtr, true, dLinTol) ;
|
||||
// calcolo le polilinee che approssimano le curve della regione
|
||||
POLYLINEVECTOR vPL ;
|
||||
POLYLINEVECTOR vPLOrd ;
|
||||
vPL.resize( vpCurve.size()) ;
|
||||
for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) {
|
||||
if ( ! vpCurve[i]->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, ICurve::APL_SPECIAL, vPL[i]))
|
||||
@@ -158,8 +162,12 @@ GetSurfTriMeshByRegionExtrusion( const CICURVEPVECTOR& vpCurve, const Vector3d&
|
||||
Vector3d vtN ;
|
||||
INTMATRIX vnPLIndMat ;
|
||||
BOOLVECTOR vbInvert ;
|
||||
if ( ! CalcRegionPolyLines( vPL, vPLOrd, vtN, vnPLIndMat, vbInvert))
|
||||
if ( ! CalcRegionPolyLines( vPL, vtN, vnPLIndMat, vbInvert))
|
||||
return nullptr ;
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++i) {
|
||||
if( vbInvert[i])
|
||||
vPL[i].Invert() ;
|
||||
}
|
||||
// verifico la direzione di estrusione
|
||||
double dOrthoExtr = vtN * vtExtr ;
|
||||
if ( ( abs( dOrthoExtr) < EPS_SMALL))
|
||||
@@ -171,7 +179,8 @@ GetSurfTriMeshByRegionExtrusion( const CICURVEPVECTOR& vpCurve, const Vector3d&
|
||||
}
|
||||
// creo la prima superficie di estremità
|
||||
PtrOwner<SurfTriMesh> pSTM( CreateBasicSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPLOrd, vnPLIndMat))
|
||||
// alla funzione CreateByRegion passo anche la matrice che contiene la struttura dei chunk. Le polyline hanno già il verso giusto
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPL, vnPLIndMat))
|
||||
return nullptr ;
|
||||
// creo la seconda superficie e la unisco alla prima
|
||||
{ // copio la prima superficie
|
||||
@@ -188,7 +197,7 @@ GetSurfTriMeshByRegionExtrusion( const CICURVEPVECTOR& vpCurve, const Vector3d&
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
|
||||
// estrusione
|
||||
SurfTriMesh STM2 ;
|
||||
if ( ! STM2.CreateByExtrusion( vPLOrd[i], vtExtr))
|
||||
if ( ! STM2.CreateByExtrusion( vPL[i], vtExtr))
|
||||
return nullptr ;
|
||||
// la unisco alla superficie principale
|
||||
if ( ! pSTM->DoSewing( STM2))
|
||||
|
||||
+6
-3
@@ -3782,7 +3782,7 @@ SurfBezier::CreateByScrewing( const ICurve* pCurve, const Point3d& ptAx, const V
|
||||
|
||||
// se sto facendo una rivoluzione e la curva è piana faccio un controllo
|
||||
// se la curva attraversa l'asse allora mi fermo
|
||||
if ( dMove < EPS_SMALL ) {
|
||||
if ( abs( dMove) < EPS_SMALL ) {
|
||||
Plane3d plPlane ;
|
||||
if ( pCurve->IsFlat(plPlane, false, EPS_SMALL) ) {
|
||||
PtrOwner<ICurveLine> pAx( CreateCurveLine()) ;
|
||||
@@ -3827,7 +3827,7 @@ SurfBezier::CreateByScrewing( const ICurve* pCurve, const Point3d& ptAx, const V
|
||||
const ICurveBezier* pSubCrvBezU = GetCurveBezier( pCrvU->GetCurve( j)) ;
|
||||
for ( int i = 0 ; i < nDegU + 1 && ! bFound ; ++i) {
|
||||
Point3d ptCtrlU = pSubCrvBezU->GetControlPoint( i) ;
|
||||
DistPointLine dpl( ptCtrlU, ptAx, vtAx, 0, false) ;
|
||||
DistPointLine dpl( ptCtrlU, ptAx, vtAx, 1, false) ;
|
||||
if ( ! dpl.IsSmall()) {
|
||||
PtrOwner<ICurveArc> pSpiral( CreateCurveArc()) ;
|
||||
pSpiral->SetCPAN( ptAx, ptCtrlU, dAngRotDeg, dMove, vtAx) ;
|
||||
@@ -3914,7 +3914,7 @@ SurfBezier::CreateByScrewing( const ICurve* pCurve, const Point3d& ptAx, const V
|
||||
ICurve* pSpiralBezier( ArcToBezierCurve( pSpiral)) ; // converto in curva bezier di grado 3 perché l'arco è una spirale
|
||||
pCrvV->AddCurve( pSpiralBezier) ;
|
||||
}
|
||||
else if ( dMove > EPS_SMALL){
|
||||
else if ( abs( dMove) > EPS_SMALL){
|
||||
// creo un segmento in forma bezier con il giusto numero di span
|
||||
PtrOwner<ICurveLine> pCL( CreateBasicCurveLine()) ;
|
||||
pCL->Set( ptCtrlU, ptCtrlU + vtAx * dMove) ;
|
||||
@@ -3939,6 +3939,9 @@ SurfBezier::CreateByScrewing( const ICurve* pCurve, const Point3d& ptAx, const V
|
||||
for ( int j = 0 ; j < nSpanV ; ++j)
|
||||
pCrvV->AddCurve( pCrvBezier->Clone()) ;
|
||||
}
|
||||
|
||||
if( ! pCrvV->IsValid())
|
||||
return false ;
|
||||
|
||||
// aggiungo i punti di controllo
|
||||
// scorro le sottocurve della spirale
|
||||
|
||||
+10
-10
@@ -245,19 +245,19 @@ Triangulate::MakeAdvanced( const POLYLINEVECTOR& vPLORIG, PNTVECTOR& vPt, INTVEC
|
||||
INTMATRIX vnPLIndMat ;
|
||||
BOOLVECTOR vbInvert ;
|
||||
if( vnPLIndMatPre.size() == 0){
|
||||
if ( ! CalcRegionPolyLines( vPLORIG, vPL, vtN, vnPLIndMat, vbInvert))
|
||||
if ( ! CalcRegionPolyLines( vPLORIG, vtN, vnPLIndMat, vbInvert))
|
||||
return false ;
|
||||
vPL = vPLORIG ;
|
||||
for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) {
|
||||
for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j){
|
||||
if( vbInvert[vnPLIndMat[i][j]])
|
||||
vPL.back().Invert() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) {
|
||||
// for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j ) {
|
||||
// vPL.push_back( vPLORIG[vnPLIndMat[i][j]]) ;
|
||||
// if( vbInvert[vnPLIndMat[i][j]])
|
||||
// vPL.back().Invert() ;
|
||||
// }
|
||||
//}
|
||||
|
||||
// ho gi� calcolato e riordinato tutto, devo solo fare una copia delle polyline
|
||||
// ho già calcolato e riordinato tutto, devo solo fare una copia delle polyline
|
||||
// non serve fare le eventuali inversioni delle polyline, perché se è già stata calcolata la matrice dei chunck allora sono GIà state invertire
|
||||
vPL = vPLORIG ;
|
||||
vnPLIndMat = vnPLIndMatPre ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user