Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a3b7e311c | |||
| 991586a880 | |||
| de4165889a | |||
| 42c5ffb014 | |||
| e394615f84 | |||
| 1008ba4229 | |||
| f4328430b9 | |||
| 1d6bc847da | |||
| d76beb09ee | |||
| 026436b914 | |||
| ebc5fd7ee7 | |||
| 82a211753e | |||
| a258e9cb31 | |||
| 157885f71a | |||
| f227a9cba7 |
@@ -45,7 +45,8 @@ static const NamedColor StdColor[] = {
|
||||
{ "FUCHSIA", FUCHSIA},
|
||||
{ "PURPLE", PURPLE},
|
||||
{ "ORANGE", ORANGE},
|
||||
{ "BROWN", BROWN}
|
||||
{ "BROWN", BROWN},
|
||||
{ "INVISIBLE", INVISIBLE}
|
||||
} ;
|
||||
static const int NUM_STDCOLOR = ( sizeof(StdColor) / sizeof(StdColor[0]) ) ;
|
||||
|
||||
|
||||
+12
-3
@@ -2656,12 +2656,21 @@ GetChainedCurves( ICRVCOMPOPOVECTOR& vCrv, double dChainTol, bool bAllowInvert)
|
||||
INTVECTOR vIds ;
|
||||
Point3d ptStart = ORIG ;
|
||||
while ( chainCrv.GetChainFromNear( ptStart, false, vIds)) {
|
||||
ICurveComposite* pFirstCrv = vCrv[abs(vIds[0]) - 1] ;
|
||||
int nFirst = vIds[0] ;
|
||||
bool bInvert = false ;
|
||||
if ( nFirst < 0)
|
||||
bInvert = true ;
|
||||
nFirst = abs( nFirst) - 1 ;
|
||||
if ( bInvert)
|
||||
vCrv[nFirst]->Invert() ;
|
||||
ICurveComposite* pFirstCrv = vCrv[nFirst] ;
|
||||
for ( int nId : vIds) {
|
||||
bool bInvert = false ;
|
||||
bInvert = false ;
|
||||
if ( nId < 0)
|
||||
bInvert = true ;
|
||||
nId = abs( nId) - 1 ;
|
||||
if ( nId == nFirst)
|
||||
continue ;
|
||||
if ( bInvert)
|
||||
vCrv[nId]->Invert() ;
|
||||
if ( ! pFirstCrv->AddCurve( Release( vCrv[nId]), true, dChainTol))
|
||||
@@ -2670,7 +2679,7 @@ GetChainedCurves( ICRVCOMPOPOVECTOR& vCrv, double dChainTol, bool bAllowInvert)
|
||||
pFirstCrv->GetEndPoint( ptStart) ;
|
||||
}
|
||||
// elimino gli elementi del vettore che non contengono più curve
|
||||
int c = ssize( vCrv) ;
|
||||
int c = ssize( vCrv) - 1 ;
|
||||
while ( c > -1) {
|
||||
if ( IsNull( vCrv[c]))
|
||||
vCrv.erase( vCrv.begin() + c) ;
|
||||
|
||||
+5
-5
@@ -211,13 +211,13 @@ DistPointCurve::GetParamAtMinDistPoint( double dNearParam, double& dParam, int&
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide) const
|
||||
DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide, double dTol) const
|
||||
{
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
|
||||
// se distanza nulla, il punto giace sulla curva
|
||||
if ( m_dDist <= EPS_SMALL) {
|
||||
if ( m_dDist <= dTol) {
|
||||
nSide = MDS_ON ;
|
||||
return true ;
|
||||
}
|
||||
@@ -259,7 +259,7 @@ DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide
|
||||
|
||||
// determino il lato di giacitura del punto
|
||||
double dSide = vtRef * ( m_ptP - ptQ) ;
|
||||
if ( abs( dSide) < EPS_SMALL)
|
||||
if ( abs( dSide) < dTol)
|
||||
nSide = MDS_ON ;
|
||||
else if ( dSide > 0)
|
||||
nSide = MDS_LEFT ;
|
||||
@@ -270,7 +270,7 @@ DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetSideAtMinDistPoint( double dNearParam, const Vector3d& vtN, int& nSide) const
|
||||
DistPointCurve::GetSideAtMinDistPoint( double dNearParam, const Vector3d& vtN, int& nSide, double dTol) const
|
||||
{
|
||||
if ( m_dDist < 0 || m_Info.empty())
|
||||
return false ;
|
||||
@@ -286,7 +286,7 @@ DistPointCurve::GetSideAtMinDistPoint( double dNearParam, const Vector3d& vtN, i
|
||||
}
|
||||
}
|
||||
// mi sono ricondotto al caso precedente
|
||||
return GetSideAtMinDistPoint( nInd, vtN, nSide) ;
|
||||
return GetSideAtMinDistPoint( nInd, vtN, nSide, dTol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Binary file not shown.
+255
-63
@@ -19,14 +19,15 @@
|
||||
#include "/EgtDev/Include/EGkAngle.h"
|
||||
#include "/EgtDev/Include/EGkHashGrids2d.h"
|
||||
#include <algorithm>
|
||||
#include <ranges>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//--------------------------- Local functions --------------------------------
|
||||
static bool CompatibleParamA( const IntCrvCrvInfo& Icci1, const IntCrvCrvInfo& Icci2,
|
||||
bool bCrvAClosed, double dCrvASpan) ;
|
||||
bool bCrvAClosed, double dCrvASpan, bool bOrderedOnB = false) ;
|
||||
static bool CompatibleParamB( const IntCrvCrvInfo& Icci1, const IntCrvCrvInfo& Icci2,
|
||||
bool bCrvBClosed, double dCrvBSpan) ;
|
||||
bool bCrvBClosed, double dCrvBSpan, bool bOrderedOnB = false) ;
|
||||
static void MediaParamPoints( IntCrvInfo& Ici1, IntCrvInfo& Ici2, const ICurveComposite& crvCompo) ;
|
||||
static int GetCrvBDirAPrev( IntCrvCrvInfo& Icci) ;
|
||||
static int GetCrvBDirANext( IntCrvCrvInfo& Icci) ;
|
||||
@@ -34,7 +35,6 @@ static bool CalcATypeFromDisk( const ICurve& CurveA, double dUA, ICurve::Side nS
|
||||
const ICurve& CurveB, double dUB, int& nType) ;
|
||||
static bool CalcATypeFromDisk2( const ICurve& CurveA, double dUA, ICurve::Side nSideA,
|
||||
const ICurve& CurveB, double dUB1, double dUB2, int& nType) ;
|
||||
static bool CalcSide( const IntCrvCrvInfo& Icci1, const IntCrvCrvInfo& Icci2, const ICurve* pThisCrv, const ICurve* pOtherCrv, bool bCrvAOrB, int& nType) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
@@ -262,8 +262,7 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
abs( m_Info[i].IciA[0].dU - m_Info[j].IciA[0].dU) < EPS_PARAM &&
|
||||
abs( m_Info[i].IciA[1].dU - m_Info[j].IciA[1].dU) < EPS_PARAM) {
|
||||
// cancello entrambe
|
||||
EraseOtherInfo( i, j) ;
|
||||
EraseCurrentInfo( i, j) ;
|
||||
EraseBothInfo( i, j) ;
|
||||
}
|
||||
// caso DET-(NULL) -> (NULL)-DET per prima curva
|
||||
else if ( m_Info[j].IciA[kj].nPrevTy != ICCT_NULL && m_Info[j].IciA[kj].nNextTy == ICCT_NULL &&
|
||||
@@ -383,8 +382,7 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
m_Info[j].IciB[kj].nPrevTy == ICCT_NULL && m_Info[j].IciB[kj].nNextTy == ICCT_NULL &&
|
||||
m_Info[i].IciB[ki].nPrevTy == ICCT_NULL && m_Info[i].IciB[ki].nNextTy == ICCT_NULL) {
|
||||
// cancello entrambe
|
||||
EraseOtherInfo( i, j) ;
|
||||
EraseCurrentInfo( i, j) ;
|
||||
EraseBothInfo( i, j) ;
|
||||
}
|
||||
// caso NULL-DET -> NULL-DET per prima curva con NULL-NULL -> NULL-NULL su seconda curva
|
||||
else if ( m_Info[j].IciA[kj].nPrevTy == ICCT_NULL && m_Info[j].IciA[kj].nNextTy != ICCT_NULL &&
|
||||
@@ -392,8 +390,7 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
m_Info[j].IciB[kj].nPrevTy == ICCT_NULL && m_Info[j].IciB[kj].nNextTy == ICCT_NULL &&
|
||||
m_Info[i].IciB[ki].nPrevTy == ICCT_NULL && m_Info[i].IciB[ki].nNextTy == ICCT_NULL) {
|
||||
// cancello entrambe
|
||||
EraseOtherInfo( i, j) ;
|
||||
EraseCurrentInfo( i, j) ;
|
||||
EraseBothInfo( i, j) ;
|
||||
}
|
||||
// caso NULL-NULL per corrente di prima curva
|
||||
else if ( m_Info[i].IciA[ki].nPrevTy == ICCT_NULL && m_Info[i].IciA[ki].nNextTy == ICCT_NULL) {
|
||||
@@ -430,20 +427,19 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
continue ;
|
||||
}
|
||||
// calcolo sottoindici
|
||||
int ki = 0 ; // del successivo si prende sempre il primo
|
||||
int kj = ( m_Info[j].bOverlap ? 1 : 0) ; // del precedente si prende il secondo se overlap
|
||||
int ki = ( m_Info[i].bOverlap && ! m_Info[i].bCBOverEq ? 1 : 0) ;
|
||||
int kj = ( m_Info[j].bOverlap && m_Info[j].bCBOverEq ? 1 : 0) ;
|
||||
// verifico se precedente e corrente si riferiscono alla stessa intersezione (10 * EPS_SMALL)
|
||||
if ( AreSamePointXYEpsilon( m_Info[j].IciA[kj].ptI, m_Info[i].IciA[ki].ptI, 10 * EPS_SMALL) &&
|
||||
AreSamePointXYEpsilon( m_Info[j].IciB[kj].ptI, m_Info[i].IciB[ki].ptI, 10 * EPS_SMALL) &&
|
||||
CompatibleParamA( m_Info[j], m_Info[i], bCrvAClosed, dCrvASpan) &&
|
||||
CompatibleParamB( m_Info[j], m_Info[i], bCrvBClosed, dCrvBSpan)) {
|
||||
CompatibleParamA( m_Info[j], m_Info[i], bCrvAClosed, dCrvASpan, true) &&
|
||||
CompatibleParamB( m_Info[j], m_Info[i], bCrvBClosed, dCrvBSpan, true)) {
|
||||
// caso entrambi Overlap ma di tipo opposto e sullo stesso tratto
|
||||
if ( m_Info[i].bOverlap && m_Info[j].bOverlap && m_Info[i].bCBOverEq != m_Info[j].bCBOverEq &&
|
||||
abs( m_Info[i].IciB[0].dU - m_Info[j].IciB[0].dU) < EPS_PARAM &&
|
||||
abs( m_Info[i].IciB[1].dU - m_Info[j].IciB[1].dU) < EPS_PARAM) {
|
||||
// cancello entrambe
|
||||
EraseOtherInfo( i, j) ;
|
||||
EraseCurrentInfo( i, j) ;
|
||||
EraseBothInfo( i, j) ;
|
||||
}
|
||||
// caso DET-(NULL) -> (NULL)-DET per seconda curva
|
||||
else if ( m_Info[j].IciB[kj].nPrevTy != ICCT_NULL && m_Info[j].IciB[kj].nNextTy == ICCT_NULL &&
|
||||
@@ -463,6 +459,12 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
m_Info[i].IciA[ki].nPrevTy = m_Info[i].IciB[ki].nNextTy ;
|
||||
m_Info[i].IciA[ki].nNextTy = m_Info[i].IciB[ki].nPrevTy ;
|
||||
}
|
||||
else {
|
||||
if ( m_Info[i].IciA[ki].nPrevTy == ICCT_NULL)
|
||||
m_Info[i].IciA[ki].nPrevTy = m_Info[j].IciA[kj].nPrevTy ;
|
||||
if ( m_Info[i].IciA[ki].nNextTy == ICCT_NULL)
|
||||
m_Info[i].IciA[ki].nNextTy = m_Info[j].IciA[kj].nNextTy ;
|
||||
}
|
||||
// se overlap equiverso
|
||||
if ( m_Info[j].bOverlap && m_Info[j].bCBOverEq) {
|
||||
// per la prima curva ogni sottotipo è il duale di quello della seconda
|
||||
@@ -475,6 +477,12 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
m_Info[j].IciA[kj].nPrevTy = m_Info[i].IciB[ki].nNextTy ;
|
||||
m_Info[j].IciA[kj].nNextTy = m_Info[i].IciB[ki].nPrevTy ;
|
||||
}
|
||||
else {
|
||||
if ( m_Info[j].IciA[kj].nPrevTy == ICCT_NULL)
|
||||
m_Info[j].IciA[kj].nPrevTy = m_Info[i].IciA[ki].nPrevTy ;
|
||||
if ( m_Info[j].IciA[kj].nNextTy == ICCT_NULL)
|
||||
m_Info[j].IciA[kj].nNextTy = m_Info[i].IciA[ki].nNextTy ;
|
||||
}
|
||||
// medio parametri e punti separatamente per le due curve
|
||||
MediaParamPoints( m_Info[i].IciA[ki], m_Info[j].IciA[kj], CCompoA) ;
|
||||
MediaParamPoints( m_Info[i].IciB[ki], m_Info[j].IciB[kj], CCompoB) ;
|
||||
@@ -507,6 +515,12 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
m_Info[i].IciA[ki].nPrevTy = m_Info[i].IciB[ki].nNextTy ;
|
||||
m_Info[i].IciA[ki].nNextTy = m_Info[i].IciB[ki].nPrevTy ;
|
||||
}
|
||||
else {
|
||||
if ( m_Info[i].IciA[ki].nPrevTy == ICCT_NULL)
|
||||
m_Info[i].IciA[ki].nPrevTy = m_Info[j].IciA[kj].nPrevTy ;
|
||||
if ( m_Info[i].IciA[ki].nNextTy == ICCT_NULL)
|
||||
m_Info[i].IciA[ki].nNextTy = m_Info[j].IciA[kj].nNextTy ;
|
||||
}
|
||||
// se overlap equiverso
|
||||
if ( m_Info[j].bOverlap && m_Info[j].bCBOverEq) {
|
||||
// per la prima curva ogni sottotipo è il duale di quello della seconda
|
||||
@@ -519,6 +533,12 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
m_Info[j].IciA[kj].nPrevTy = m_Info[i].IciB[ki].nNextTy ;
|
||||
m_Info[j].IciA[kj].nNextTy = m_Info[i].IciB[ki].nPrevTy ;
|
||||
}
|
||||
else {
|
||||
if ( m_Info[j].IciA[kj].nPrevTy == ICCT_NULL)
|
||||
m_Info[j].IciA[kj].nPrevTy = m_Info[i].IciA[ki].nPrevTy ;
|
||||
if ( m_Info[j].IciA[kj].nNextTy == ICCT_NULL)
|
||||
m_Info[j].IciA[kj].nNextTy = m_Info[i].IciA[ki].nNextTy ;
|
||||
}
|
||||
// medio parametri e punti separatamente per le due curve
|
||||
MediaParamPoints( m_Info[i].IciA[ki], m_Info[j].IciA[kj], CCompoA) ;
|
||||
MediaParamPoints( m_Info[i].IciB[ki], m_Info[j].IciB[kj], CCompoB) ;
|
||||
@@ -539,8 +559,7 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
m_Info[j].IciA[kj].nPrevTy == ICCT_NULL && m_Info[j].IciA[kj].nNextTy == ICCT_NULL &&
|
||||
m_Info[i].IciA[ki].nPrevTy == ICCT_NULL && m_Info[i].IciA[ki].nNextTy == ICCT_NULL) {
|
||||
// cancello entrambe
|
||||
EraseOtherInfo( i, j) ;
|
||||
EraseCurrentInfo( i, j) ;
|
||||
EraseBothInfo( i, j) ;
|
||||
}
|
||||
// caso NULL-DET -> NULL-DET per seconda curva con NULL-NULL -> NULL-NULL su prima curva
|
||||
else if ( m_Info[j].IciB[kj].nPrevTy == ICCT_NULL && m_Info[j].IciB[kj].nNextTy != ICCT_NULL &&
|
||||
@@ -548,8 +567,7 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
m_Info[j].IciA[kj].nPrevTy == ICCT_NULL && m_Info[j].IciA[kj].nNextTy == ICCT_NULL &&
|
||||
m_Info[i].IciA[ki].nPrevTy == ICCT_NULL && m_Info[i].IciA[ki].nNextTy == ICCT_NULL) {
|
||||
// cancello entrambe
|
||||
EraseOtherInfo( i, j) ;
|
||||
EraseCurrentInfo( i, j) ;
|
||||
EraseBothInfo( i, j) ;
|
||||
}
|
||||
// caso NULL-NULL per corrente di seconda curva
|
||||
else if ( m_Info[i].IciB[ki].nPrevTy == ICCT_NULL && m_Info[i].IciB[ki].nNextTy == ICCT_NULL) {
|
||||
@@ -599,18 +617,19 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
stable_sort( m_Info.begin(), m_Info.end(), SortGreaterB) ;
|
||||
for ( int i = 0 ; i < m_nNumInters ; ++ i) {
|
||||
// se il tipo di accostamento per la curva B non è definito
|
||||
if ( m_Info[i].IciB[0].nPrevTy == ICCT_NULL) {
|
||||
int ki = ( m_Info[i].bOverlap && ! m_Info[i].bCBOverEq ? 1 : 0) ;
|
||||
if ( m_Info[i].IciB[ki].nPrevTy == ICCT_NULL) {
|
||||
if ( i > 0 || ( bCrvBClosed && ! bAutoInters)) {
|
||||
int j = ( i > 0 ? i - 1 : m_nNumInters - 1) ;
|
||||
m_Info[i].IciB[0].nPrevTy = ( m_Info[j].bOverlap ? m_Info[j].IciB[1].nNextTy : m_Info[j].IciB[0].nNextTy) ;
|
||||
m_Info[i].IciB[ki].nPrevTy = ( m_Info[j].bOverlap && m_Info[j].bCBOverEq ? m_Info[j].IciB[1].nNextTy : m_Info[j].IciB[0].nNextTy) ;
|
||||
}
|
||||
}
|
||||
// se il tipo di allontanamento per la curva B non è definito
|
||||
int ki = ( m_Info[i].bOverlap ? 1 : 0) ;
|
||||
ki = ( m_Info[i].bOverlap && m_Info[i].bCBOverEq ? 1 : 0) ;
|
||||
if ( m_Info[i].IciB[ki].nNextTy == ICCT_NULL) {
|
||||
if ( i < m_nNumInters - 1 || ( bCrvBClosed && ! bAutoInters)) {
|
||||
int j = ( i < m_nNumInters - 1 ? i + 1 : 0) ;
|
||||
m_Info[i].IciB[ki].nNextTy = m_Info[j].IciB[0].nPrevTy ;
|
||||
m_Info[i].IciB[ki].nNextTy = ( m_Info[j].bOverlap && ! m_Info[j].bCBOverEq ? m_Info[j].IciB[1].nPrevTy : m_Info[j].IciB[0].nPrevTy) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -781,15 +800,16 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
}
|
||||
|
||||
// verifico se una curva ha tutte le info e queste info sono coerenti
|
||||
if ( m_nNumInters > 1) {
|
||||
if ( m_nNumInters > 1 && ! bAutoInters) {
|
||||
bool bCoherent = true ;
|
||||
INTVECTOR vIncoherenceWithPrev ;
|
||||
INTVECTOR vNewOverlap ;
|
||||
// salvo eventuali incoerenze col precedente
|
||||
for ( int i = bCrvAClosed ? 0 : 1 ; i < m_nNumInters ; ++i) {
|
||||
int j = i == 0 ? m_nNumInters - 1 : i - 1 ;
|
||||
int kj = m_Info[j].bOverlap ? 1 : 0 ;
|
||||
if ( m_Info[j].IciA[kj].nNextTy != m_Info[i].IciA[0].nPrevTy &&
|
||||
m_Info[j].IciA[kj].nNextTy != ICCT_SPK && m_Info[i].IciA[0].nPrevTy != ICCT_SPK) {
|
||||
if ( (m_Info[j].IciA[kj].nNextTy == ICCT_NULL || m_Info[i].IciA[0].nPrevTy == ICCT_NULL || m_Info[j].IciA[kj].nNextTy != m_Info[i].IciA[0].nPrevTy) &&
|
||||
m_Info[j].IciA[kj].nNextTy != ICCT_SPK && m_Info[i].IciA[0].nPrevTy != ICCT_SPK) {
|
||||
vIncoherenceWithPrev.push_back( i) ;
|
||||
bCoherent = false ;
|
||||
}
|
||||
@@ -800,25 +820,31 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
int j = i == 0 ? m_nNumInters - 1 : i - 1 ;
|
||||
int kj = m_Info[j].bOverlap ? 1 : 0 ;
|
||||
int nType = 0 ;
|
||||
CalcSide( m_Info[j], m_Info[i], &CCompoA, &CCompoB, true, nType) ;
|
||||
if ( nType == MDS_LEFT)
|
||||
nType = ICCT_IN ;
|
||||
else if ( nType == MDS_RIGHT)
|
||||
nType = ICCT_OUT ;
|
||||
m_Info[i].IciA[0].nPrevTy = nType ;
|
||||
m_Info[j].IciA[kj].nNextTy = nType ;
|
||||
CalcSide( j, i, &CCompoA, &CCompoB, true, nType) ;
|
||||
if ( nType != ICCT_ON) {
|
||||
m_Info[i].IciA[0].nPrevTy = nType ;
|
||||
m_Info[j].IciA[kj].nNextTy = nType ;
|
||||
}
|
||||
else
|
||||
vNewOverlap.push_back( i) ;
|
||||
}
|
||||
}
|
||||
|
||||
// faccio il merge se ho trasformato delle intersezioni in overlap
|
||||
for ( int i : views::reverse( vNewOverlap))
|
||||
MergeNewOverlap( i, true) ;
|
||||
|
||||
vNewOverlap.clear() ;
|
||||
stable_sort( m_Info.begin(), m_Info.end(), SortGreaterB) ;
|
||||
bCoherent = true ;
|
||||
vIncoherenceWithPrev.clear() ;
|
||||
// salvo eventuali incoerenze col precedente
|
||||
for ( int i = bCrvBClosed ? 0 : 1 ; i < m_nNumInters ; ++i) {
|
||||
int j = i == 0 ? m_nNumInters - 1 : i - 1 ;
|
||||
int kj = m_Info[j].bOverlap ? 1 : 0 ;
|
||||
if ( m_Info[j].IciB[kj].nNextTy != m_Info[i].IciB[0].nPrevTy &&
|
||||
m_Info[j].IciB[kj].nNextTy != ICCT_SPK && m_Info[i].IciB[0].nPrevTy != ICCT_SPK) {
|
||||
int ki = m_Info[i].bOverlap && ! m_Info[i].bCBOverEq ? 1 : 0 ;
|
||||
int kj = m_Info[j].bOverlap && m_Info[j].bCBOverEq ? 1 : 0 ;
|
||||
if ( ( m_Info[j].IciB[kj].nNextTy == ICCT_NULL || m_Info[i].IciB[ki].nPrevTy == ICCT_NULL || m_Info[j].IciB[kj].nNextTy != m_Info[i].IciB[ki].nPrevTy) &&
|
||||
m_Info[j].IciB[kj].nNextTy != ICCT_SPK && m_Info[i].IciB[ki].nPrevTy != ICCT_SPK) {
|
||||
vIncoherenceWithPrev.push_back( i) ;
|
||||
bCoherent = false ;
|
||||
}
|
||||
@@ -827,17 +853,22 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
if ( ! bCoherent) {
|
||||
for ( int i : vIncoherenceWithPrev) {
|
||||
int j = i == 0 ? m_nNumInters - 1 : i - 1 ;
|
||||
int kj = m_Info[j].bOverlap ? 1 : 0 ;
|
||||
int ki = m_Info[i].bOverlap && ! m_Info[i].bCBOverEq ? 1 : 0 ;
|
||||
int kj = m_Info[j].bOverlap && m_Info[j].bCBOverEq ? 1 : 0 ;
|
||||
int nType = 0 ;
|
||||
CalcSide( m_Info[j], m_Info[i], &CCompoB, &CCompoA, false, nType) ;
|
||||
if ( nType == MDS_LEFT)
|
||||
nType = ICCT_IN ;
|
||||
else if ( nType == MDS_RIGHT)
|
||||
nType = ICCT_OUT ;
|
||||
m_Info[i].IciB[0].nPrevTy = nType ;
|
||||
m_Info[j].IciB[kj].nNextTy = nType ;
|
||||
CalcSide( j, i, &CCompoB, &CCompoA, false, nType) ;
|
||||
if ( nType != ICCT_ON) {
|
||||
m_Info[i].IciB[ki].nPrevTy = nType ;
|
||||
m_Info[j].IciB[kj].nNextTy = nType ;
|
||||
}
|
||||
else
|
||||
vNewOverlap.push_back( i) ;
|
||||
}
|
||||
}
|
||||
|
||||
// faccio il merge se ho trasformato delle intersezioni in overlap
|
||||
for ( int i : views::reverse( vNewOverlap))
|
||||
MergeNewOverlap( i, false) ;
|
||||
}
|
||||
else {
|
||||
// posso completare A guardando B e viceversa
|
||||
@@ -849,34 +880,162 @@ IntersCrvCompoCrvCompo::IntersCrvCompoCrvCompo( const ICurveComposite& CCompoA,
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
CalcSide( const IntCrvCrvInfo& Icci1, const IntCrvCrvInfo& Icci2,const ICurve* pThisCrv, const ICurve* pOtherCrv, bool bCrvAOrB, int& nType)
|
||||
bool
|
||||
IntersCrvCompoCrvCompo::CalcSide( int j, int i,const ICurve* pThisCrv, const ICurve* pOtherCrv, bool bCrvAOrB, int& nType)
|
||||
{
|
||||
const IntCrvCrvInfo& Icci1 = m_Info[j] ;
|
||||
const IntCrvCrvInfo& Icci2 = m_Info[i] ;
|
||||
// calcolo tra l'intersezione 1 e 2 se la curva sta dentro o fuori
|
||||
int kj = Icci1.bOverlap ? 1 : 0 ;
|
||||
double dU = 0 ;
|
||||
bool bPrevIsBefore = true ;
|
||||
if ( bCrvAOrB) {
|
||||
// se precedente minore del successivo faccio la media
|
||||
if ( Icci1.IciA[kj].dU < Icci2.IciA[0].dU)
|
||||
dU = (Icci2.IciA[0].dU + Icci1.IciA[kj].dU) / 2 ;
|
||||
dU = ( Icci2.IciA[0].dU + Icci1.IciA[kj].dU) / 2 ;
|
||||
// altrimenti guardo tra lo start e il successivo
|
||||
else
|
||||
dU = (Icci2.IciA[0].dU + 0.) / 2 ;
|
||||
else {
|
||||
bPrevIsBefore = false ;
|
||||
dU = ( Icci2.IciA[0].dU + 0.) / 2 ;
|
||||
if ( dU < EPS_SMALL) {
|
||||
double dStart, dEnd ;
|
||||
pThisCrv->GetDomain( dStart, dEnd) ;
|
||||
double dUNew = dEnd - Icci1.IciA[kj].dU / 2 ;
|
||||
if ( dUNew > dU)
|
||||
dU = dUNew ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// se precedente minore del successivo faccio la media
|
||||
if ( Icci1.IciB[kj].dU < Icci2.IciB[0].dU)
|
||||
dU = (Icci2.IciB[0].dU + Icci1.IciB[kj].dU) / 2 ;
|
||||
dU = ( Icci2.IciB[0].dU + Icci1.IciB[kj].dU) / 2 ;
|
||||
// altrimenti guardi tra lo start e il successivo
|
||||
else
|
||||
dU = (Icci2.IciB[0].dU + 0.) / 2 ;
|
||||
else {
|
||||
bPrevIsBefore = false ;
|
||||
dU = ( Icci2.IciB[0].dU + 0.) / 2 ;
|
||||
if ( dU < EPS_SMALL) {
|
||||
double dStart, dEnd ;
|
||||
pThisCrv->GetDomain( dStart, dEnd) ;
|
||||
double dUNew = dEnd - Icci1.IciB[kj].dU / 2 ;
|
||||
if ( dUNew > dU)
|
||||
dU = dUNew ;
|
||||
}
|
||||
}
|
||||
}
|
||||
Point3d ptTest ; pThisCrv->GetPointD1D2( dU, ICurve::FROM_MINUS, ptTest) ;
|
||||
DistPointCurve dpc( ptTest, *pOtherCrv) ;
|
||||
dpc.GetSideAtMinDistPoint( 0, Z_AX, nType) ;
|
||||
dpc.GetSideAtMinDistPoint( 0, Z_AX, nType, EPS_ZERO) ;
|
||||
if ( nType == MDS_LEFT)
|
||||
nType = ICCT_IN ;
|
||||
else if ( nType == MDS_RIGHT)
|
||||
nType = ICCT_OUT ;
|
||||
// se lo trovo sulla curva controllo se posso definire un tratto overlap
|
||||
if ( nType == MDS_ON) {
|
||||
double dFactor = 1./3. ;
|
||||
DBLVECTOR vdU(2) ;
|
||||
bool bIsOn = false ;
|
||||
if ( bCrvAOrB) {
|
||||
if ( bPrevIsBefore) {
|
||||
vdU[0] = ( 1 - dFactor) * Icci2.IciA[0].dU + dFactor * Icci1.IciA[kj].dU ;
|
||||
vdU[1] = ( 1 - 2 * dFactor) * Icci2.IciA[0].dU + 2 * dFactor * Icci1.IciA[kj].dU ;
|
||||
}
|
||||
else if ( Icci2.IciA[0].dU > 2 * EPS_SMALL){
|
||||
vdU[0] = ( Icci2.IciA[0].dU + 0.) * dFactor ;
|
||||
vdU[1] = ( Icci2.IciA[0].dU + 0.) * 2 * dFactor ;
|
||||
}
|
||||
else
|
||||
bIsOn = true ;
|
||||
}
|
||||
else {
|
||||
if ( bPrevIsBefore) {
|
||||
vdU[0] = ( 1 - dFactor) * Icci2.IciB[0].dU + dFactor * Icci1.IciB[kj].dU ;
|
||||
vdU[1] = ( 1 - 2 * dFactor) * Icci2.IciB[0].dU + 2 * dFactor * Icci1.IciB[kj].dU ;
|
||||
}
|
||||
else if ( Icci2.IciB[0].dU > 2 * EPS_SMALL) {
|
||||
vdU[0] = ( Icci2.IciB[0].dU + 0.) * dFactor ;
|
||||
vdU[1] = ( Icci2.IciB[0].dU + 0.) * 2 * dFactor ;
|
||||
}
|
||||
else
|
||||
bIsOn = true ;
|
||||
}
|
||||
if ( ! bIsOn) {
|
||||
bIsOn = true ;
|
||||
for ( int k = 0 ; k < ssize(vdU) && bIsOn ; ++k) {
|
||||
Point3d ptTest2 ; pThisCrv->GetPointD1D2( vdU[k], ICurve::FROM_MINUS, ptTest2) ;
|
||||
DistPointCurve dpc2( ptTest2, *pOtherCrv) ;
|
||||
dpc2.GetSideAtMinDistPoint( 0, Z_AX, nType, EPS_ZERO) ;
|
||||
if ( nType != MDS_ON)
|
||||
bIsOn = false ;
|
||||
}
|
||||
}
|
||||
if ( bIsOn) {
|
||||
m_Info[i].bOverlap = true ;
|
||||
Vector3d vtDirThis, vtDirOther ;
|
||||
Point3d ptCommon ;
|
||||
double dUThis = 0 ;
|
||||
if ( bCrvAOrB)
|
||||
dUThis = m_Info[i].IciA[0].dU ;
|
||||
else
|
||||
dUThis = m_Info[i].IciB[0].dU ;
|
||||
pThisCrv->GetPointD1D2( dUThis, ICurve::Side::FROM_MINUS, ptCommon, &vtDirThis) ;
|
||||
double dUOther = 0 ; pOtherCrv->GetParamAtPoint( ptCommon, dUOther) ;
|
||||
pOtherCrv->GetPointD1D2( dUOther, ICurve::Side::FROM_MINUS, ptCommon, &vtDirOther) ;
|
||||
m_Info[i].bCBOverEq = vtDirThis * vtDirOther > 0 ;
|
||||
if ( m_Info[i].bCBOverEq) {
|
||||
m_Info[i].IciA[1] = m_Info[i].IciA[0] ;
|
||||
m_Info[i].IciB[1] = m_Info[i].IciB[0] ;
|
||||
m_Info[i].IciA[0] = m_Info[j].IciA[kj] ;
|
||||
m_Info[i].IciB[0] = m_Info[j].IciB[kj] ;
|
||||
m_Info[i].IciA[1].nPrevTy = ICCT_ON ;
|
||||
m_Info[i].IciB[1].nPrevTy = ICCT_ON ;
|
||||
m_Info[i].IciA[0].nNextTy = ICCT_ON ;
|
||||
m_Info[i].IciB[0].nNextTy = ICCT_ON ;
|
||||
}
|
||||
else {
|
||||
if ( bCrvAOrB) {
|
||||
m_Info[i].IciA[1] = m_Info[i].IciA[0] ;
|
||||
m_Info[i].IciA[0] = m_Info[j].IciA[kj] ;
|
||||
m_Info[i].IciA[1].nPrevTy = ICCT_ON ;
|
||||
m_Info[i].IciA[0].nNextTy = ICCT_ON ;
|
||||
m_Info[i].IciB[1] = m_Info[j].IciB[kj] ;
|
||||
m_Info[i].IciB[0].nPrevTy = ICCT_ON ;
|
||||
m_Info[i].IciB[1].nNextTy = ICCT_ON ;
|
||||
}
|
||||
else {
|
||||
m_Info[i].IciB[1] = m_Info[i].IciB[0] ;
|
||||
m_Info[i].IciB[0] = m_Info[j].IciB[kj] ;
|
||||
m_Info[i].IciB[1].nPrevTy = ICCT_ON ;
|
||||
m_Info[i].IciB[0].nNextTy = ICCT_ON ;
|
||||
m_Info[i].IciA[1] = m_Info[j].IciA[kj] ;
|
||||
m_Info[i].IciA[0].nPrevTy = ICCT_ON ;
|
||||
m_Info[i].IciA[1].nNextTy = ICCT_ON ;
|
||||
}
|
||||
}
|
||||
nType = ICCT_ON ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
IntersCrvCompoCrvCompo::MergeNewOverlap( int i, bool bCrvAOrB)
|
||||
{
|
||||
// faccio il merge col precedente
|
||||
int j = i == 0 ? m_nNumInters - 1 : i - 1 ;
|
||||
if ( m_Info[j].bOverlap) {
|
||||
m_Info[i].IciA[0] = m_Info[j].IciA[0] ;
|
||||
m_Info[i].IciB[0] = m_Info[j].IciB[0] ;
|
||||
}
|
||||
m_Info.erase( m_Info.begin() + j) ;
|
||||
-- j ;
|
||||
-- m_nNumInters ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
IntersCrvCompoCrvCompo::IntersSimpleCurves( const ICurve& CurveA, int nA, const ICurve& CurveB, int nB,
|
||||
@@ -941,13 +1100,27 @@ bool
|
||||
IntersCrvCompoCrvCompo::EraseOtherInfo( int& nIndCurr, int& nIndOther)
|
||||
{
|
||||
m_Info.erase( m_Info.begin() + nIndOther) ;
|
||||
if ( nIndOther < nIndCurr)
|
||||
-- nIndCurr ;
|
||||
-- nIndCurr ;
|
||||
-- nIndOther ;
|
||||
-- m_nNumInters ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
IntersCrvCompoCrvCompo::EraseBothInfo( int& nIndCurr, int& nIndOther)
|
||||
{
|
||||
m_Info.erase( m_Info.begin() + nIndOther) ;
|
||||
-- nIndCurr ;
|
||||
-- nIndOther ;
|
||||
-- m_nNumInters ;
|
||||
m_Info.erase( m_Info.begin() + nIndCurr) ;
|
||||
if ( nIndCurr != -1)
|
||||
-- nIndCurr ;
|
||||
-- m_nNumInters ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Global functions
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1095,11 +1268,20 @@ OrderNonManifoldInters( ICCIVECTOR& Info, const ICurve& CurveA, const ICurve& Cu
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
CompatibleParamA( const IntCrvCrvInfo& Icci1, const IntCrvCrvInfo& Icci2,
|
||||
bool bCrvAClosed, double dCrvASpan)
|
||||
bool bCrvAClosed, double dCrvASpan, bool bOrderedOnB)
|
||||
{
|
||||
int k = ( Icci1.bOverlap ? 1 : 0) ; // del precedente si prende il secondo se overlap
|
||||
if ( abs( Icci1.IciA[k].dU - Icci2.IciA[0].dU) > 0.1 * SPAN_PARAM &&
|
||||
( ! bCrvAClosed || abs( abs( Icci1.IciA[k].dU - Icci2.IciA[0].dU) - dCrvASpan) > 0.1 * SPAN_PARAM))
|
||||
int ki = 0 ;
|
||||
int kj = 0 ;
|
||||
if ( ! bOrderedOnB) {
|
||||
ki = 0 ;
|
||||
kj = Icci1.bOverlap ? 1 : 0 ;
|
||||
}
|
||||
else {
|
||||
ki = Icci2.bOverlap && ! Icci2.bCBOverEq ? 1 : 0 ;
|
||||
kj = Icci1.bOverlap && Icci1.bCBOverEq ? 1 : 0 ;
|
||||
}
|
||||
if ( abs( Icci1.IciA[kj].dU - Icci2.IciA[ki].dU) > 0.1 * SPAN_PARAM &&
|
||||
( ! bCrvAClosed || abs( abs( Icci1.IciA[kj].dU - Icci2.IciA[ki].dU) - dCrvASpan) > 0.1 * SPAN_PARAM))
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
@@ -1107,11 +1289,21 @@ CompatibleParamA( const IntCrvCrvInfo& Icci1, const IntCrvCrvInfo& Icci2,
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
CompatibleParamB( const IntCrvCrvInfo& Icci1, const IntCrvCrvInfo& Icci2,
|
||||
bool bCrvBClosed, double dCrvBSpan)
|
||||
bool bCrvBClosed, double dCrvBSpan, bool bOrderedOnB)
|
||||
{
|
||||
int k = ( Icci1.bOverlap ? 1 : 0) ; // del precedente si prende il secondo se overlap
|
||||
if ( abs( Icci1.IciB[k].dU - Icci2.IciB[0].dU) > 0.1 * SPAN_PARAM &&
|
||||
( ! bCrvBClosed || abs( abs( Icci1.IciB[k].dU - Icci2.IciB[0].dU) - dCrvBSpan) > 0.1 * SPAN_PARAM))
|
||||
int ki = 0 ;
|
||||
int kj = 0 ;
|
||||
if ( ! bOrderedOnB) {
|
||||
ki = 0 ;
|
||||
kj = Icci1.bOverlap ? 1 : 0 ;
|
||||
}
|
||||
else {
|
||||
ki = Icci2.bOverlap && ! Icci2.bCBOverEq ? 1 : 0 ;
|
||||
kj = Icci1.bOverlap && Icci1.bCBOverEq ? 1 : 0 ;
|
||||
}
|
||||
|
||||
if ( abs( Icci1.IciB[kj].dU - Icci2.IciB[ki].dU) > 0.1 * SPAN_PARAM &&
|
||||
( ! bCrvBClosed || abs( abs( Icci1.IciB[kj].dU - Icci2.IciB[ki].dU) - dCrvBSpan) > 0.1 * SPAN_PARAM))
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,9 @@ class IntersCrvCompoCrvCompo
|
||||
bool bAutoInters, bool bClosed, int nCurvesNbr) ;
|
||||
bool EraseCurrentInfo( int& nIndCurr, int& nIndOther) ;
|
||||
bool EraseOtherInfo( int& nIndCurr, int& nIndOther) ;
|
||||
bool EraseBothInfo( int& nIndCurr, int& nIndOther) ;
|
||||
bool CalcSide( int j, int i,const ICurve* pThisCrv, const ICurve* pOtherCrv, bool bCrvAOrB, int& nType) ;
|
||||
bool MergeNewOverlap( int i, bool bCrvAOrB) ;
|
||||
|
||||
private :
|
||||
bool m_bOverlaps ;
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ Polygon3d::FromPlaneTrimmedWithBox( const Point3d& ptOn, const Vector3d& vtN,
|
||||
{
|
||||
Plane3d plPlane ;
|
||||
plPlane.Set( ptOn, vtN) ;
|
||||
return FromPlaneTrimmedWithBox( plPlane, ptMin, ptMax, bOnEq, bOnCt) ;
|
||||
return FromPlaneTrimmedWithBox( plPlane, ptMin, ptMax, bOnEq, bOnCt, dToler) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+1
-1
@@ -1124,7 +1124,7 @@ bool
|
||||
SurfBezier::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
{
|
||||
// basta approssimato
|
||||
if ( ( nFlag & BBF_EXACT) == 0) {
|
||||
if ( ( nFlag & BBF_EXACT) == 0 && ! m_bTrimmed) {
|
||||
for ( int i = 0 ; i < GetDim() ; ++ i) {
|
||||
Point3d ptTemp = m_vPtCtrl[i] ;
|
||||
ptTemp.ToGlob( frRef) ;
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
#include "/EgtDev/Include/EGkIntervals.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
#define SAVECLASSCRV 0
|
||||
#if SAVECLASSCRV
|
||||
#include "/EgtDev/Include/EGkGeoObjSave.h"
|
||||
#endif
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1374,6 +1379,15 @@ SurfFlatRegion::MyGetCurveClassification( const ICurve& Crv, double dLenMin, CRV
|
||||
for ( int nLoop = 0 ; nLoop < GetLoopCount( nChunk) ; ++ nLoop) {
|
||||
const ICurve* pLoop = GetMyLoop( nChunk, nLoop) ;
|
||||
// intersezione
|
||||
|
||||
#if SAVECLASSCRV
|
||||
//debug
|
||||
vector<IGeoObj*> vGeo ;
|
||||
vGeo.push_back( Crv.Clone()) ;
|
||||
vGeo.push_back( pLoop->Clone()) ;
|
||||
SaveGeoObj( vGeo, "D:\\Temp\\inters\\CrvCrvInters\\crv_and_loop.nge") ;
|
||||
#endif
|
||||
|
||||
IntersCurveCurve ccInt( Crv, *pLoop) ;
|
||||
// classificazione
|
||||
CRVCVECTOR ccPart ;
|
||||
|
||||
+45
-49
@@ -1694,16 +1694,15 @@ VolZmap::MakeUniform( double dToler, bool bIsExtensionFirst, int nToolNum)
|
||||
if ( ! IsValid())
|
||||
return false ;
|
||||
|
||||
// creo lo ZMap per i riferimenti degli intervalli sulle griglie
|
||||
// Creo lo ZMap per i riferimenti degli intervalli sulle griglie
|
||||
PtrOwner<VolZmap> pZMapCopy( CloneBasicVolZmap( this)) ;
|
||||
if ( IsNull( pZMapCopy) || ! pZMapCopy->IsValid())
|
||||
return false ;
|
||||
|
||||
// creo uno ZMap per gli intervalli da aggiungere o da rimuovere
|
||||
// Creo uno ZMap per gli intervalli da aggiungere o da rimuovere
|
||||
PtrOwner<VolZmap> pZMapExtra( CreateBasicVolZmap()) ;
|
||||
if ( IsNull( pZMapExtra) ||
|
||||
! pZMapExtra->CreateEmpty( m_MapFrame.Orig(), m_dMaxZ[1] - m_dMinZ[1],
|
||||
m_dMaxZ[2] - m_dMinZ[2], m_dMaxZ[0] - m_dMinZ[0],
|
||||
! pZMapExtra->CreateEmpty( m_MapFrame.Orig(), m_dMaxZ[1] - m_dMinZ[1], m_dMaxZ[2] - m_dMinZ[2], m_dMaxZ[0] - m_dMinZ[0],
|
||||
m_dStep, IsTriDexel()))
|
||||
return false ;
|
||||
|
||||
@@ -1719,7 +1718,7 @@ VolZmap::MakeUniform( double dToler, bool bIsExtensionFirst, int nToolNum)
|
||||
// Ciclo sulle griglie
|
||||
for ( int nGrid = 0 ; nGrid < pZMapCopy->m_nMapNum ; ++ nGrid) {
|
||||
// Ciclo sul numero di dexel presenti nella Copia
|
||||
for ( int nDex = 0 ; nDex < int( pZMapCopy->m_Values[nGrid].size()) ; ++ nDex) {
|
||||
for ( int nDex = 0 ; nDex < ssize( pZMapCopy->m_Values[nGrid]) ; ++ nDex) {
|
||||
// Se il dexel corrente non ha sotto-intervalli passo al successivo
|
||||
if ( pZMapCopy->m_Values[nGrid][nDex].empty())
|
||||
continue ;
|
||||
@@ -1727,9 +1726,9 @@ VolZmap::MakeUniform( double dToler, bool bIsExtensionFirst, int nToolNum)
|
||||
int nI = nDex % m_nNx[nGrid] ;
|
||||
int nJ = nDex / m_nNx[nGrid] ;
|
||||
// Recupero il numero di intervalli presenti nel Dexel corrente
|
||||
int nIntervals = int( pZMapCopy->m_Values[nGrid][nDex].size()) ;
|
||||
int nIntervals = ssize( pZMapCopy->m_Values[nGrid][nDex]) ;
|
||||
// Scorro gli intervalli presenti
|
||||
for ( int nInfo = 0 ; nInfo < int( pZMapCopy->m_Values[nGrid][nDex].size()) ; ++ nInfo) {
|
||||
for ( int nInfo = 0 ; nInfo < ssize( pZMapCopy->m_Values[nGrid][nDex]) ; ++ nInfo) {
|
||||
// Recupero l'intervallo corrente
|
||||
Data& Interval = pZMapCopy->m_Values[nGrid][nDex][nInfo] ;
|
||||
// --- Se richiesta prima estensione
|
||||
@@ -1739,57 +1738,54 @@ VolZmap::MakeUniform( double dToler, bool bIsExtensionFirst, int nToolNum)
|
||||
AddIntervals( nGrid, nI, nJ, Interval.dMin - dToler, Interval.dMin + dToler,
|
||||
Interval.vtMinN, Interval.vtMinN, nToolNum, true) ;
|
||||
// Se si sono uniti degli intervalli, potrei dover aggiungere degli spilloni nelle altre due direzioni
|
||||
if ( IsTriDexel() && nIntervals != int( m_Values[nGrid][nDex].size())) {
|
||||
if ( IsTriDexel() && nIntervals != ssize( m_Values[nGrid][nDex])) {
|
||||
// Aggiorno gli intervalli correnti ( dato che il corrente si è unito al precedente)
|
||||
// ( lascio invariato lo ZMapCopy)
|
||||
nIntervals = int( m_Values[nGrid][nDex].size()) ;
|
||||
nIntervals = ssize( m_Values[nGrid][nDex]) ;
|
||||
pZMapExtra->UniformIntervalsInVoxel( nGrid, nI, nJ,
|
||||
pZMapCopy->m_Values[nGrid][nDex][nInfo-1].dMax,
|
||||
Interval.dMin, dToler, true,
|
||||
nToolNum, V_INVALID, V_INVALID) ;
|
||||
pZMapCopy->m_Values[nGrid][nDex][nInfo-1].dMax, Interval.dMin,
|
||||
dToler, true, nToolNum, V_INVALID, V_INVALID) ;
|
||||
}
|
||||
// *** Estremo superiore -> Intervallo : [ dMax - dToler, dMax + dToler ]
|
||||
// Aggiungo l'intervallo nello Zmap corrente ( lascio invariato lo ZMapCopy)
|
||||
AddIntervals( nGrid, nI, nJ, Interval.dMax - dToler, Interval.dMax + dToler,
|
||||
Interval.vtMaxN, Interval.vtMaxN, nToolNum, true) ;
|
||||
// Se si sono uniti degli intervalli, potrei dover aggiungere degli spilloni nelle altre due direzioni
|
||||
if ( IsTriDexel() && nIntervals != int( m_Values[nGrid][nDex].size())) {
|
||||
if ( IsTriDexel() && nIntervals != ssize( m_Values[nGrid][nDex])) {
|
||||
// Aggiorno gli intervalli correnti ( dato che il corrente si è unito al successivo)
|
||||
// ( lascio invariato lo ZMapCopy)
|
||||
nIntervals = int( m_Values[nGrid][nDex].size()) ;
|
||||
nIntervals = ssize( m_Values[nGrid][nDex]) ;
|
||||
pZMapExtra->UniformIntervalsInVoxel( nGrid, nI, nJ,
|
||||
Interval.dMax,
|
||||
pZMapCopy->m_Values[nGrid][nDex][nInfo+1].dMin, dToler, true,
|
||||
nToolNum, V_INVALID, V_INVALID) ;
|
||||
Interval.dMax, pZMapCopy->m_Values[nGrid][nDex][nInfo+1].dMin,
|
||||
dToler, true, nToolNum, V_INVALID, V_INVALID) ;
|
||||
}
|
||||
}
|
||||
// --- Se richiesta prima restrizione
|
||||
else {
|
||||
// *** Estremo inferiore -> Intervallo : [ dMin - dToler, dMin + dToler ]
|
||||
// Sottraggo l'intervallo nello Zmap corrente ( lascio invariato lo ZMapCopy)
|
||||
SubtractIntervals( nGrid, nI, nJ, Interval.dMin - dToler, Interval.dMin + dToler,
|
||||
Interval.vtMinN, Interval.vtMinN, nToolNum, true) ;
|
||||
// Se l'intervallo si è annullato, potrei dover sottrarre degli spilloni nelle altre due direzioni
|
||||
if ( IsTriDexel() && nIntervals != int( m_Values[nGrid][nDex].size())) {
|
||||
// Aggiorno gli intervalli correnti ( lascio invariato lo ZMapCopy)
|
||||
nIntervals = int( m_Values[nGrid][nDex].size()) ;
|
||||
pZMapExtra->UniformIntervalsInVoxel( nGrid, nI, nJ,
|
||||
Interval.dMin,
|
||||
Interval.dMax, dToler, true,
|
||||
Tool::UNDEF, V_INVALID, V_INVALID) ;
|
||||
// Se la lunghezza dell'intervallo non è almeno il doppio della tolleranza
|
||||
double dLen = Interval.dMax - Interval.dMin ;
|
||||
if ( dLen < 2. * ( dToler + EPS_SMALL)) {
|
||||
// L'intervallo sparisce completamente
|
||||
SubtractIntervals( nGrid, nI, nJ, Interval.dMin - EPS_SMALL, Interval.dMax + EPS_SMALL,
|
||||
Interval.vtMinN, Interval.vtMaxN, nToolNum, true) ;
|
||||
// Rimuovo le parti di spillone nelle altre dimensioni
|
||||
if ( IsTriDexel()) {
|
||||
-- nIntervals ;
|
||||
pZMapExtra->UniformIntervalsInVoxel( nGrid, nI, nJ,
|
||||
Interval.dMin, Interval.dMax,
|
||||
dToler, true, Tool::UNDEF, V_INVALID, V_INVALID) ;
|
||||
}
|
||||
}
|
||||
// *** Estremo superiore -> Intervallo : [ dMax - dToler, dMax + dToler ]
|
||||
// Sottraggo l'intervallo nello Zmap corrente ( lascio invariato lo ZMapCopy)
|
||||
SubtractIntervals( nGrid, nI, nJ, Interval.dMax - dToler, Interval.dMax + dToler,
|
||||
Interval.vtMaxN, Interval.vtMaxN, nToolNum, true) ;
|
||||
// Se l'intervallo si è annullato, potrei dover sottrarre degli spilloni nelle altre due direzioni
|
||||
if ( IsTriDexel() && nIntervals != int( m_Values[nGrid][nDex].size())) {
|
||||
// Aggiorno gli intervalli correnti ( lascio invariato lo ZMapCopy)
|
||||
nIntervals = int( m_Values[nGrid][nDex].size()) ;
|
||||
pZMapExtra->UniformIntervalsInVoxel( nGrid, nI, nJ,
|
||||
Interval.dMin,
|
||||
Interval.dMax, dToler, true,
|
||||
Tool::UNDEF, V_INVALID, V_INVALID) ;
|
||||
// Se sufficientemente lungo, allora
|
||||
else {
|
||||
// *** Estremo inferiore -> Intervallo : [ dMin, dMin + dToler ]
|
||||
// Sottraggo l'intervallo nello Zmap corrente ( lascio invariato lo ZMapCopy)
|
||||
SubtractIntervals( nGrid, nI, nJ, Interval.dMin - EPS_SMALL, Interval.dMin + dToler,
|
||||
Interval.vtMinN, Interval.vtMinN, nToolNum, true) ;
|
||||
// *** Estremo superiore -> Intervallo : [ dMax - dToler, dMax ]
|
||||
// Sottraggo l'intervallo nello Zmap corrente ( lascio invariato lo ZMapCopy)
|
||||
SubtractIntervals( nGrid, nI, nJ, Interval.dMax - dToler, Interval.dMax + EPS_SMALL,
|
||||
Interval.vtMaxN, Interval.vtMaxN, nToolNum, true) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1799,12 +1795,12 @@ VolZmap::MakeUniform( double dToler, bool bIsExtensionFirst, int nToolNum)
|
||||
// Ciclo sulle griglie ( uso lo Zmap Corrente, lascio invariato pZMapCopy)
|
||||
for ( int nGrid = 0 ; nGrid < m_nMapNum ; ++ nGrid) {
|
||||
// Ciclo sul numero di dexel presenti
|
||||
for ( int nDex = 0 ; nDex < int( m_Values[nGrid].size()) ; ++ nDex) {
|
||||
for ( int nDex = 0 ; nDex < ssize( m_Values[nGrid]) ; ++ nDex) {
|
||||
// Se l'intervallo è vuoto, non faccio nulla
|
||||
if ( m_Values[nGrid][nDex].empty())
|
||||
continue ;
|
||||
// Per ogni intervallo ricavato fino ad ora, restringo della tolleranza
|
||||
for ( int nInfo = 0 ; nInfo < int( m_Values[nGrid][nDex].size()) ; ++ nInfo) {
|
||||
for ( int nInfo = 0 ; nInfo < ssize( m_Values[nGrid][nDex]) ; ++ nInfo) {
|
||||
// --- Se richiesta prima estensione
|
||||
if ( bIsExtensionFirst) {
|
||||
m_Values[nGrid][nDex][nInfo].dMin += dToler ;
|
||||
@@ -1816,7 +1812,7 @@ VolZmap::MakeUniform( double dToler, bool bIsExtensionFirst, int nToolNum)
|
||||
m_Values[nGrid][nDex][nInfo].dMax += dToler ;
|
||||
}
|
||||
// Definisco il colore
|
||||
for ( int nOrigInfo = 0 ; nOrigInfo < int( pZMapCopy->m_Values[nGrid][nDex].size()) ; ++ nOrigInfo) {
|
||||
for ( int nOrigInfo = 0 ; nOrigInfo < ssize( pZMapCopy->m_Values[nGrid][nDex]) ; ++ nOrigInfo) {
|
||||
if ( pZMapCopy->m_Values[nGrid][nDex][nOrigInfo].dMin - m_Values[nGrid][nDex][nInfo].dMin < EPS_SMALL)
|
||||
m_Values[nGrid][nDex][nInfo].nToolMin = pZMapCopy->m_Values[nGrid][nDex][nOrigInfo].nToolMin ;
|
||||
if ( pZMapCopy->m_Values[nGrid][nDex][nOrigInfo].dMax - m_Values[nGrid][nDex][nInfo].dMax < EPS_SMALL)
|
||||
@@ -1830,7 +1826,7 @@ VolZmap::MakeUniform( double dToler, bool bIsExtensionFirst, int nToolNum)
|
||||
// Ciclo sulle griglie ( uso lo ZmapExtra, lascio invariato pZMapCopy)
|
||||
for ( int nGrid = 0 ; nGrid < pZMapExtra->m_nMapNum ; ++ nGrid) {
|
||||
// Ciclo sul numero di dexel presenti
|
||||
for ( int nDex = 0 ; nDex < int( pZMapExtra->m_Values[nGrid].size()) ; ++ nDex) {
|
||||
for ( int nDex = 0 ; nDex < ssize( pZMapExtra->m_Values[nGrid]) ; ++ nDex) {
|
||||
// Se l'intervallo è vuoto, non faccio nulla
|
||||
if ( pZMapExtra->m_Values[nGrid][nDex].empty())
|
||||
continue ;
|
||||
@@ -1838,19 +1834,19 @@ VolZmap::MakeUniform( double dToler, bool bIsExtensionFirst, int nToolNum)
|
||||
int nI = nDex % m_nNx[nGrid] ;
|
||||
int nJ = nDex / m_nNx[nGrid] ;
|
||||
// Per ogni intervallo ricavato fino ad ora...
|
||||
for ( int nInfo = 0 ; nInfo < int( pZMapExtra->m_Values[nGrid][nDex].size()) ; ++ nInfo) {
|
||||
for ( int nInfo = 0 ; nInfo < ssize( pZMapExtra->m_Values[nGrid][nDex]) ; ++ nInfo) {
|
||||
double dMin = pZMapExtra->m_Values[nGrid][nDex][nInfo].dMin ;
|
||||
double dMax = pZMapExtra->m_Values[nGrid][nDex][nInfo].dMax ;
|
||||
Vector3d vtNMin = pZMapExtra->m_Values[nGrid][nDex][nInfo].vtMinN ;
|
||||
Vector3d vtNMax = pZMapExtra->m_Values[nGrid][nDex][nInfo].vtMaxN ;
|
||||
// --- Se richiesta prima estensione
|
||||
if ( bIsExtensionFirst) {
|
||||
// ... aggiungo i contributi
|
||||
AddIntervals( nGrid, nI, nJ, dMin, dMax, vtNMin, vtNMax, nToolNum, true) ;
|
||||
// Aggiungo i contributi
|
||||
AddIntervals( nGrid, nI, nJ, dMin, dMax, vtNMin, vtNMax, nToolNum, true) ;
|
||||
}
|
||||
// --- Se richiesta prima restrizione
|
||||
else {
|
||||
// ... sottraggo i contributi
|
||||
// Sottraggo i contributi
|
||||
SubtractIntervals( nGrid, nI, nJ, dMin, dMax, vtNMin, vtNMax, nToolNum, true) ;
|
||||
}
|
||||
}
|
||||
|
||||
+203
-80
@@ -31,6 +31,13 @@
|
||||
#include <future>
|
||||
#include <numeric>
|
||||
|
||||
#define SAVETRIMMINGTOOL 0
|
||||
|
||||
#if SAVETRIMMINGTOOL
|
||||
std::vector<IGeoObj*> vGeo ;
|
||||
#include "/EgtDev/Include/EGkGeoObjSave.h"
|
||||
#endif
|
||||
|
||||
using namespace std ;
|
||||
|
||||
// ------------------------- OPERAZIONI SU INTERVALLI --------------------------------------------------------------------------------------
|
||||
@@ -1569,10 +1576,6 @@ VolZmap::Comp_5AxisMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, c
|
||||
else if ( n5AxisType == Move5Axis::ACROSS)
|
||||
nTotSurf = 2 + nSub * 4 + nSub * 2 + 16 ; // come sopra
|
||||
|
||||
int nSurfInd = 0 ;
|
||||
vector<SurfBezForInters> vSurfBez( nTotSurf) ;
|
||||
double dSide = 0 ;
|
||||
|
||||
// punti di riferimento sul tool
|
||||
// tip del tool
|
||||
Point3d ptP1T ;
|
||||
@@ -1585,6 +1588,14 @@ VolZmap::Comp_5AxisMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, c
|
||||
Vector3d vtDirTip = ptP2T - ptP1T ;
|
||||
bool bTopIsPivot = vtDirTop.IsSmall() ;
|
||||
bool bTipIsPivot = vtDirTip.IsSmall() ;
|
||||
bool bInverse = ! (bTopIsPivot || bTipIsPivot) && vtDirTop * vtDirTip < 0 ;
|
||||
|
||||
if ( bInverse)
|
||||
nTotSurf += 4 ;
|
||||
|
||||
int nSurfInd = 0 ;
|
||||
vector<SurfBezForInters> vSurfBez( nTotSurf) ;
|
||||
double dSide = 0 ;
|
||||
|
||||
// box dell'intero volume spazzato, nel riferimento object oriented
|
||||
BBox3d bbVol ;
|
||||
@@ -1617,10 +1628,10 @@ VolZmap::Comp_5AxisMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, c
|
||||
dSide = ( ptRefEnd - ptRefStart) * vtLs ;
|
||||
|
||||
// calcolo anche i vettori per le basi inferiori
|
||||
Vector3d vtTipBaseStart = -( vtLs ^ vtDirTip) ;
|
||||
Vector3d vtTipBaseStart = bInverse ? ( vtLs ^ vtDirTip) : -( vtLs ^ vtDirTip) ;
|
||||
vtTipBaseStart.Normalize() ;
|
||||
vtTipBaseStart *= dMinRad ;
|
||||
Vector3d vtTipBaseEnd = -( vtLe ^ vtDirTip) ;
|
||||
Vector3d vtTipBaseEnd = bInverse ? ( vtLe ^ vtDirTip) : -( vtLe ^ vtDirTip) ;
|
||||
vtTipBaseEnd.Normalize() ;
|
||||
vtTipBaseEnd *= dMinRad ;
|
||||
// aggiungo il primo punto per ognuno dei gruppi
|
||||
@@ -1670,20 +1681,24 @@ VolZmap::Comp_5AxisMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, c
|
||||
|
||||
vector<PNTVECTOR> vvPtCtrl ;
|
||||
// superficie laterale sinistra
|
||||
CurveLine cLineLeftStart ; cLineLeftStart.Set( vPntTipStartFront.back(), vPntTopStartFront.back()) ;
|
||||
PtrOwner<CurveBezier> cBezLeftStart( GetBasicCurveBezier( LineToBezierCurve( &cLineLeftStart, nDegU, bRat))) ;
|
||||
CurveLine cLineLeftEnd ; cLineLeftEnd.Set( vPntTipEndFront.back(), vPntTopEndFront.back()) ;
|
||||
PtrOwner<CurveBezier> cBezLeftEnd( GetBasicCurveBezier( LineToBezierCurve( &cLineLeftEnd, nDegU, bRat))) ;
|
||||
vvPtCtrl.emplace_back( cBezLeftStart->GetAllControlPoints()) ;
|
||||
PNTVECTOR vPntLeft = cBezLeftEnd->GetAllControlPoints() ;
|
||||
CurveLine cLineLeftBottom ; cLineLeftBottom.Set( vPntTipEndFront.back(), vPntTipStartFront.back()) ;
|
||||
if ( bInverse)
|
||||
cLineLeftBottom.Invert() ;
|
||||
PtrOwner<CurveBezier> cBezLeftBottom( GetBasicCurveBezier( LineToBezierCurve( &cLineLeftBottom, nDegU, bRat))) ;
|
||||
CurveLine cLineLeftTop ; cLineLeftTop.Set( vPntTopEndFront.back(), vPntTopStartFront.back()) ;
|
||||
PtrOwner<CurveBezier> cBezLeftTop( GetBasicCurveBezier( LineToBezierCurve( &cLineLeftTop, nDegU, bRat))) ;
|
||||
vvPtCtrl.emplace_back( cBezLeftBottom->GetAllControlPoints()) ;
|
||||
PNTVECTOR vPntLeft = cBezLeftTop->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntLeft.begin(), vPntLeft.end()) ;
|
||||
// superficie laterale destra
|
||||
CurveLine cLineRightStart ; cLineRightStart.Set( vPntTopStartFront.front(), vPntTipStartFront.front()) ;
|
||||
PtrOwner<CurveBezier> cBezRightStart( GetBasicCurveBezier( LineToBezierCurve( &cLineRightStart, nDegU, bRat))) ;
|
||||
CurveLine cLineRightEnd ; cLineRightEnd.Set( vPntTopEndFront.front(), vPntTipEndFront.front()) ;
|
||||
PtrOwner<CurveBezier> cBezRightEnd( GetBasicCurveBezier( LineToBezierCurve( &cLineRightEnd, nDegU, bRat))) ;
|
||||
vvPtCtrl.emplace_back( cBezRightStart->GetAllControlPoints()) ;
|
||||
PNTVECTOR vPntRight = cBezRightEnd->GetAllControlPoints() ;
|
||||
CurveLine cLineRightBottom ; cLineRightBottom.Set( vPntTipStartFront.front(), vPntTipEndFront.front()) ;
|
||||
if ( bInverse)
|
||||
cLineRightBottom.Invert() ;
|
||||
PtrOwner<CurveBezier> cBezRightBottom( GetBasicCurveBezier( LineToBezierCurve( &cLineRightBottom, nDegU, bRat))) ;
|
||||
CurveLine cLineRightTop ; cLineRightTop.Set( vPntTopStartFront.front(), vPntTopEndFront.front()) ;
|
||||
PtrOwner<CurveBezier> cBezRightTop( GetBasicCurveBezier( LineToBezierCurve( &cLineRightTop, nDegU, bRat))) ;
|
||||
vvPtCtrl.emplace_back( cBezRightBottom->GetAllControlPoints()) ;
|
||||
PNTVECTOR vPntRight = cBezRightTop->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntRight.begin(), vPntRight.end()) ;
|
||||
if ( nSub == 1) {
|
||||
// superficie inferiore
|
||||
@@ -1748,43 +1763,83 @@ VolZmap::Comp_5AxisMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, c
|
||||
if ( ! bTipIsPivot) {
|
||||
// inferiori
|
||||
if ( dSide > 0) {
|
||||
vvPtCtrl.emplace_back(cBezTipStartF1->GetAllControlPoints());
|
||||
PNTVECTOR vPntTipEnd1 = cBezTipEndF1->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTipEnd1.begin(), vPntTipEnd1.end());
|
||||
vvPtCtrl.emplace_back(cBezTipStartF2->GetAllControlPoints());
|
||||
PNTVECTOR vPntTipEnd2 = cBezTipEndF2->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTipEnd2.begin(), vPntTipEnd2.end());
|
||||
PNTVECTOR vPntTipEnd01 = cBezTipStartF1->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.emplace_back( vPntTipEnd01.begin(), vPntTipEnd01.end()) ;
|
||||
else
|
||||
vvPtCtrl.emplace_back( vPntTipEnd01.rbegin(), vPntTipEnd01.rend()) ;
|
||||
PNTVECTOR vPntTipEnd1 = cBezTipEndF1->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTipEnd1.begin(), vPntTipEnd1.end()) ;
|
||||
else
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTipEnd1.rbegin(), vPntTipEnd1.rend()) ;
|
||||
PNTVECTOR vPntTipEnd02 = cBezTipStartF2->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.emplace_back( vPntTipEnd02.begin(), vPntTipEnd02.end()) ;
|
||||
else
|
||||
vvPtCtrl.emplace_back( vPntTipEnd02.rbegin(), vPntTipEnd02.rend()) ;
|
||||
PNTVECTOR vPntTipEnd2 = cBezTipEndF2->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTipEnd2.begin(), vPntTipEnd2.end()) ;
|
||||
else
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTipEnd2.rbegin(), vPntTipEnd2.rend()) ;
|
||||
}
|
||||
else {
|
||||
PNTVECTOR vPntTipEnd01 = cBezTipStartB1->GetAllControlPoints();
|
||||
vvPtCtrl.emplace_back(vPntTipEnd01.rbegin(), vPntTipEnd01.rend());
|
||||
PNTVECTOR vPntTipEnd1 = cBezTipEndB1->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTipEnd1.rbegin(), vPntTipEnd1.rend());
|
||||
PNTVECTOR vPntTipEnd02 = cBezTipStartB2->GetAllControlPoints();
|
||||
vvPtCtrl.emplace_back(vPntTipEnd02.rbegin(), vPntTipEnd02.rend());
|
||||
PNTVECTOR vPntTipEnd2 = cBezTipEndB2->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTipEnd2.rbegin(), vPntTipEnd2.rend());
|
||||
PNTVECTOR vPntTipEnd01 = cBezTipStartB1->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.emplace_back( vPntTipEnd01.rbegin(), vPntTipEnd01.rend()) ;
|
||||
else
|
||||
vvPtCtrl.emplace_back( vPntTipEnd01.begin(), vPntTipEnd01.end()) ;
|
||||
PNTVECTOR vPntTipEnd1 = cBezTipEndB1->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTipEnd1.rbegin(), vPntTipEnd1.rend()) ;
|
||||
else
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTipEnd1.begin(), vPntTipEnd1.end()) ;
|
||||
PNTVECTOR vPntTipEnd02 = cBezTipStartB2->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.emplace_back( vPntTipEnd02.rbegin(), vPntTipEnd02.rend()) ;
|
||||
else
|
||||
vvPtCtrl.emplace_back( vPntTipEnd02.begin(), vPntTipEnd02.end()) ;
|
||||
PNTVECTOR vPntTipEnd2 = cBezTipEndB2->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTipEnd2.rbegin(), vPntTipEnd2.rend()) ;
|
||||
else
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTipEnd2.begin(), vPntTipEnd2.end()) ;
|
||||
}
|
||||
}
|
||||
if ( ! bTopIsPivot) {
|
||||
// superiori
|
||||
if ( dSide > 0) {
|
||||
vvPtCtrl.emplace_back(cBezTopStartB1->GetAllControlPoints());
|
||||
PNTVECTOR vPntTopEnd1 = cBezTopEndB1->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTopEnd1.begin(), vPntTopEnd1.end());
|
||||
vvPtCtrl.emplace_back(cBezTopStartB2->GetAllControlPoints());
|
||||
PNTVECTOR vPntTopEnd2 = cBezTopEndB2->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTopEnd2.begin(), vPntTopEnd2.end());
|
||||
PNTVECTOR vPntTopEnd01 = cBezTopStartB1->GetAllControlPoints() ;
|
||||
vvPtCtrl.emplace_back( vPntTopEnd01.begin(), vPntTopEnd01.end()) ;
|
||||
PNTVECTOR vPntTopEnd1 = cBezTopEndB1->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTopEnd1.begin(), vPntTopEnd1.end()) ;
|
||||
PNTVECTOR vPntTopEnd02 = cBezTopStartB2->GetAllControlPoints() ;
|
||||
vvPtCtrl.emplace_back( vPntTopEnd02.begin(), vPntTopEnd02.end()) ;
|
||||
PNTVECTOR vPntTopEnd2 = cBezTopEndB2->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTopEnd2.begin(), vPntTopEnd2.end()) ;
|
||||
}
|
||||
else {
|
||||
PNTVECTOR vPntTopEnd01 = cBezTopStartF1->GetAllControlPoints();
|
||||
vvPtCtrl.emplace_back(vPntTopEnd01.rbegin(), vPntTopEnd01.rend());
|
||||
PNTVECTOR vPntTopEnd1 = cBezTopEndF1->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTopEnd1.rbegin(), vPntTopEnd1.rend());
|
||||
PNTVECTOR vPntTopEnd02 = cBezTopStartF2->GetAllControlPoints();
|
||||
vvPtCtrl.emplace_back(vPntTopEnd02.rbegin(), vPntTopEnd02.rend());
|
||||
PNTVECTOR vPntTopEnd2 = cBezTopEndF2->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTopEnd2.rbegin(), vPntTopEnd2.rend());
|
||||
PNTVECTOR vPntTopEnd01 = cBezTopStartF1->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.emplace_back( vPntTopEnd01.rbegin(), vPntTopEnd01.rend()) ;
|
||||
else
|
||||
vvPtCtrl.emplace_back( vPntTopEnd01.begin(), vPntTopEnd01.end()) ;
|
||||
PNTVECTOR vPntTopEnd1 = cBezTopEndF1->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTopEnd1.rbegin(), vPntTopEnd1.rend()) ;
|
||||
else
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTopEnd1.begin(), vPntTopEnd1.end()) ;
|
||||
PNTVECTOR vPntTopEnd02 = cBezTopStartF2->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.emplace_back( vPntTopEnd02.rbegin(), vPntTopEnd02.rend()) ;
|
||||
else
|
||||
vvPtCtrl.emplace_back( vPntTopEnd02.begin(), vPntTopEnd02.end()) ;
|
||||
PNTVECTOR vPntTopEnd2 = cBezTopEndF2->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTopEnd2.rbegin(), vPntTopEnd2.rend()) ;
|
||||
else
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTopEnd2.begin(), vPntTopEnd2.end()) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1793,36 +1848,74 @@ VolZmap::Comp_5AxisMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, c
|
||||
if ( ! bTipIsPivot) {
|
||||
// inferiori
|
||||
if ( dSide > 0) {
|
||||
PNTVECTOR vPntTip01 = cBezTipStartB1->GetAllControlPoints();
|
||||
vvPtCtrl.emplace_back(vPntTip01.rbegin(), vPntTip01.rend());
|
||||
PNTVECTOR vPntTip1 = cBezTipEndB1->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTip1.rbegin(), vPntTip1.rend());
|
||||
PNTVECTOR vPntTip02 = cBezTipStartB2->GetAllControlPoints();
|
||||
vvPtCtrl.emplace_back(vPntTip02.rbegin(), vPntTip02.rend());
|
||||
PNTVECTOR vPntTip2 = cBezTipEndB2->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTip2.rbegin(), vPntTip2.rend());
|
||||
PNTVECTOR vPntTip01 = cBezTipStartB1->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.emplace_back( vPntTip01.rbegin(), vPntTip01.rend()) ;
|
||||
else
|
||||
vvPtCtrl.emplace_back( vPntTip01.begin(), vPntTip01.end()) ;
|
||||
PNTVECTOR vPntTip1 = cBezTipEndB1->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTip1.rbegin(), vPntTip1.rend()) ;
|
||||
else
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTip1.begin(), vPntTip1.end()) ;
|
||||
PNTVECTOR vPntTip02 = cBezTipStartB2->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.emplace_back( vPntTip02.rbegin(), vPntTip02.rend()) ;
|
||||
else
|
||||
vvPtCtrl.emplace_back( vPntTip02.begin(), vPntTip02.end()) ;
|
||||
PNTVECTOR vPntTip2 = cBezTipEndB2->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTip2.rbegin(), vPntTip2.rend()) ;
|
||||
else
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTip2.begin(), vPntTip2.end()) ;
|
||||
}
|
||||
else {
|
||||
vvPtCtrl.emplace_back(cBezTipStartF1->GetAllControlPoints());
|
||||
PNTVECTOR vPntTip1 = cBezTipEndF1->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTip1.begin(), vPntTip1.end());
|
||||
vvPtCtrl.emplace_back(cBezTipStartF2->GetAllControlPoints());
|
||||
PNTVECTOR vPntTip2 = cBezTipEndF2->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTip2.begin(), vPntTip2.end());
|
||||
PNTVECTOR vPntTip01 = cBezTipStartF1->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.emplace_back( vPntTip01.begin(), vPntTip01.end()) ;
|
||||
else
|
||||
vvPtCtrl.emplace_back( vPntTip01.rbegin(), vPntTip01.rend()) ;
|
||||
PNTVECTOR vPntTip1 = cBezTipEndF1->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTip1.begin(), vPntTip1.end()) ;
|
||||
else
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTip1.rbegin(), vPntTip1.rend()) ;
|
||||
PNTVECTOR vPntTip02 = cBezTipStartF2->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.emplace_back( vPntTip02.begin(), vPntTip02.end()) ;
|
||||
else
|
||||
vvPtCtrl.emplace_back( vPntTip02.rbegin(), vPntTip02.rend()) ;
|
||||
PNTVECTOR vPntTip2 = cBezTipEndF2->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTip2.begin(), vPntTip2.end()) ;
|
||||
else
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTip2.rbegin(), vPntTip2.rend()) ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! bTopIsPivot) {
|
||||
// superiori
|
||||
if ( dSide > 0) {
|
||||
PNTVECTOR vPntTop01 = cBezTopStartF1->GetAllControlPoints();
|
||||
vvPtCtrl.emplace_back(vPntTop01.rbegin(), vPntTop01.rend());
|
||||
PNTVECTOR vPntTop1 = cBezTopEndF1->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTop1.rbegin(), vPntTop1.rend());
|
||||
PNTVECTOR vPntTop02 = cBezTopStartF2->GetAllControlPoints();
|
||||
vvPtCtrl.emplace_back(vPntTop02.rbegin(), vPntTop02.rend());
|
||||
PNTVECTOR vPntTop2 = cBezTopEndF2->GetAllControlPoints();
|
||||
vvPtCtrl.back().insert(vvPtCtrl.back().end(), vPntTop2.rbegin(), vPntTop2.rend());
|
||||
PNTVECTOR vPntTop01 = cBezTopStartF1->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.emplace_back( vPntTop01.rbegin(), vPntTop01.rend()) ;
|
||||
else
|
||||
vvPtCtrl.emplace_back( vPntTop01.begin(), vPntTop01.end()) ;
|
||||
PNTVECTOR vPntTop1 = cBezTopEndF1->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTop1.rbegin(), vPntTop1.rend()) ;
|
||||
else
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTop1.begin(), vPntTop1.end()) ;
|
||||
PNTVECTOR vPntTop02 = cBezTopStartF2->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.emplace_back( vPntTop02.rbegin(), vPntTop02.rend()) ;
|
||||
else
|
||||
vvPtCtrl.emplace_back( vPntTop02.begin(), vPntTop02.end()) ;
|
||||
PNTVECTOR vPntTop2 = cBezTopEndF2->GetAllControlPoints() ;
|
||||
if ( ! bInverse)
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTop2.rbegin(), vPntTop2.rend()) ;
|
||||
else
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntTop2.begin(), vPntTop2.end()) ;
|
||||
}
|
||||
else {
|
||||
vvPtCtrl.emplace_back(cBezTopStartB1->GetAllControlPoints());
|
||||
@@ -1838,23 +1931,43 @@ VolZmap::Comp_5AxisMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, c
|
||||
|
||||
// chiudo il volume con le superfici verticali e le basi dei tool
|
||||
|
||||
// chiudo il volume con le superici verticali end 1
|
||||
// chiudo il volume con le superici verticali end front 1
|
||||
vvPtCtrl.emplace_back( cBezTipEndF1->GetAllControlPoints()) ;
|
||||
PNTVECTOR vPntEnd1 = cBezTopEndF1->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntEnd1.begin(), vPntEnd1.end()) ;
|
||||
// chiudo il volume con le superici verticali end 2
|
||||
PNTVECTOR vPntEndF1 = cBezTopEndF1->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntEndF1.begin(), vPntEndF1.end()) ;
|
||||
// chiudo il volume con le superici verticali end front 2
|
||||
vvPtCtrl.emplace_back( cBezTipEndF2->GetAllControlPoints()) ;
|
||||
PNTVECTOR vPntEnd2 = cBezTopEndF2->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntEnd2.begin(), vPntEnd2.end()) ;
|
||||
PNTVECTOR vPntEndF2 = cBezTopEndF2->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntEndF2.begin(), vPntEndF2.end()) ;
|
||||
if ( bInverse) {
|
||||
// chiudo il volume con le superici verticali end back 1
|
||||
vvPtCtrl.emplace_back( cBezTipEndB1->GetAllControlPoints()) ;
|
||||
PNTVECTOR vPntEndB1 = cBezTopEndB1->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntEndB1.begin(), vPntEndB1.end()) ;
|
||||
// chiudo il volume con le superici verticali end back 2
|
||||
vvPtCtrl.emplace_back( cBezTipEndB2->GetAllControlPoints()) ;
|
||||
PNTVECTOR vPntEndB2 = cBezTopEndB2->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntEndB2.begin(), vPntEndB2.end()) ;
|
||||
}
|
||||
|
||||
// chiudo il volume con le superici verticali start 1
|
||||
// chiudo il volume con le superici verticali start back 1
|
||||
vvPtCtrl.emplace_back( cBezTipStartB1->GetAllControlPoints()) ;
|
||||
PNTVECTOR vPntStart1 = cBezTopStartB1->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntStart1.begin(), vPntStart1.end()) ;
|
||||
// chiudo il volume con le superfici verticali start 2
|
||||
PNTVECTOR vPntStartB1 = cBezTopStartB1->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntStartB1.begin(), vPntStartB1.end()) ;
|
||||
// chiudo il volume con le superfici verticali start back 2
|
||||
vvPtCtrl.emplace_back( cBezTipStartB2->GetAllControlPoints()) ;
|
||||
PNTVECTOR vPntStart2 = cBezTopStartB2->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntStart2.begin(), vPntStart2.end()) ;
|
||||
PNTVECTOR vPntStartB2 = cBezTopStartB2->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntStartB2.begin(), vPntStartB2.end()) ;
|
||||
if ( bInverse) {
|
||||
// chiudo il volume con le superici verticali start front 1
|
||||
vvPtCtrl.emplace_back( cBezTipStartF1->GetAllControlPoints()) ;
|
||||
PNTVECTOR vPntStartF1 = cBezTopStartF1->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntStartF1.begin(), vPntStartF1.end()) ;
|
||||
// chiudo il volume con le superfici verticali start front 2
|
||||
vvPtCtrl.emplace_back( cBezTipStartF2->GetAllControlPoints()) ;
|
||||
PNTVECTOR vPntStartF2 = cBezTopStartF2->GetAllControlPoints() ;
|
||||
vvPtCtrl.back().insert( vvPtCtrl.back().end(), vPntStartF2.begin(), vPntStartF2.end()) ;
|
||||
}
|
||||
|
||||
// superfici di base dei tool
|
||||
if ( ! ( n5AxisType == Move5Axis::NO_BASE_INTERS && dSide < 0)) {
|
||||
@@ -1936,6 +2049,11 @@ VolZmap::Comp_5AxisMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, c
|
||||
vSurfBez[nSurfInd].sBez.SetControlPoint( 6, vvPtCtrl[z][6]) ;
|
||||
vSurfBez[nSurfInd].sBez.SetControlPoint( 7, vvPtCtrl[z][7]) ;
|
||||
|
||||
#if SAVETRIMMINGTOOL
|
||||
if ( nGrid == 0)
|
||||
vGeo.push_back( vSurfBez[nSurfInd].sBez.Clone()) ;
|
||||
#endif
|
||||
|
||||
Vector3d A = vvPtCtrl[z][4] - vvPtCtrl[z][0] ;
|
||||
Vector3d B = vvPtCtrl[z][5] - vvPtCtrl[z][1] ;
|
||||
Vector3d C = vvPtCtrl[z][6] - vvPtCtrl[z][2] ;
|
||||
@@ -1984,6 +2102,11 @@ VolZmap::Comp_5AxisMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, c
|
||||
++ nSurfInd ;
|
||||
}
|
||||
|
||||
#if SAVETRIMMINGTOOL
|
||||
if ( nGrid == 0)
|
||||
SaveGeoObj( vGeo, "D:\\Temp\\VirtualMilling\\5axisAdvanced\\marmo sottosquadra\\volume.nge") ;
|
||||
#endif
|
||||
|
||||
// scorro tutti gli spilloni interessati
|
||||
int j = 0 ;
|
||||
int nLastForwardJ = -1 ;
|
||||
|
||||
+1
-1
@@ -1155,7 +1155,7 @@ Voronoi::AdjustOffsetStart( ICurveComposite* pCrv) const
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
bool
|
||||
Voronoi::Translate( const Vector3d & vtMove)
|
||||
Voronoi::Translate( const Vector3d& vtMove)
|
||||
{
|
||||
if ( ! IsValid())
|
||||
return false ;
|
||||
|
||||
Reference in New Issue
Block a user