diff --git a/CalcPocketing.cpp b/CalcPocketing.cpp index 39bbf3e..c5c7fee 100644 --- a/CalcPocketing.cpp +++ b/CalcPocketing.cpp @@ -2691,14 +2691,27 @@ IsForcedStepTrapezoid( const ICurveComposite* pCrvTrap, const PocketParams& Pock break ; // se ho tre lati chiusi case 3 : { - // diventa forzato se il lato aperto non รจ grande + // diventa forzato se il lato aperto non ha una componente perpendicolare grande rispetto al chiuso precedente e successivo double dLenOpen = 0. ; for ( int i = 0 ; i < 4 ; ++ i) { if ( vnProps[i] == TEMP_PROP_OPEN_EDGE) { const ICurve* pCrvOpen = pCrvTrap->GetCurve( i) ; if ( pCrvOpen == nullptr || ! pCrvOpen->IsValid()) return false ; + // essendo nei casi a trapezio, ho solo segmenti pCrvOpen->GetLength( dLenOpen) ; + Vector3d vtDir ; pCrvOpen->GetStartDir( vtDir) ; + vtDir *= dLenOpen ; + const ICurve* pCrvClosePrev = pCrvTrap->GetCurve( ( i == 0 ? 3 : i - 1)) ; + if ( pCrvClosePrev == nullptr || ! pCrvClosePrev->IsValid()) + return false ; + const ICurve* pCrvCloseAft = pCrvTrap->GetCurve( ( i == 3 ? 0 : i + 1)) ; + if ( pCrvCloseAft == nullptr || ! pCrvCloseAft->IsValid()) + return false ; + // essendo un trapezio queste due direzioni me le apsetto parallele tra loro + Vector3d vtDirPrev ; pCrvClosePrev->GetEndDir( vtDirPrev) ; + Vector3d vtDirAft ; pCrvCloseAft->GetStartDir( vtDirAft) ; + dLenOpen = min( { OrthoCompo( vtDir, vtDirPrev).Len(), OrthoCompo( vtDir, vtDirAft).Len(), dLenOpen}) ; break ; } }