EgtGeomKernel 3.1f3 :
- migliorie nella creazione di solidi swept con sezione rettangolare smussata - correzioni errori e aggiunte funzioni per calcolo bisettori di Voronoi - aggiunto parametro a GetChainedCurves per fermare su biforcazione - piccola miglioria a AssociatePolyLinesMinDistPoints.
This commit is contained in:
+2
-2
@@ -2652,7 +2652,7 @@ ResetCurveVoronoi( const ICurve& crvC)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GetChainedCurves( ICRVCOMPOPOVECTOR& vCrv, double dChainTol, bool bAllowInvert)
|
||||
GetChainedCurves( ICRVCOMPOPOVECTOR& vCrv, double dChainTol, bool bAllowInvert, bool bHaltOnFork)
|
||||
{
|
||||
if ( ssize( vCrv) == 1)
|
||||
return true ;
|
||||
@@ -2670,7 +2670,7 @@ GetChainedCurves( ICRVCOMPOPOVECTOR& vCrv, double dChainTol, bool bAllowInvert)
|
||||
}
|
||||
INTVECTOR vIds ;
|
||||
Point3d ptStart = ORIG ;
|
||||
while ( chainCrv.GetChainFromNear( ptStart, false, vIds)) {
|
||||
while ( chainCrv.GetChainFromNear( ptStart, bHaltOnFork, vIds)) {
|
||||
int nFirst = vIds[0] ;
|
||||
bool bInvert = false ;
|
||||
if ( nFirst < 0)
|
||||
|
||||
+1
-2
@@ -34,5 +34,4 @@ bool CurveDump( const ICurve& crvC, std::string& sOut, bool bMM, const char* szN
|
||||
bool CopyExtrusion( const ICurve* pSouCrv, ICurve* pDestCrv) ;
|
||||
bool CopyThickness( const ICurve* pSouCrv, ICurve* pDestCrv) ;
|
||||
ICurveBezier* ApproxCurveBezierWithSingleCubic( const ICurve* pCrv) ;
|
||||
Voronoi* GetCurveVoronoi( const ICurve& crvC) ;
|
||||
bool GetChainedCurves( ICRVCOMPOPOVECTOR& vCrv, double dChainTol, bool bAllowInvert) ;
|
||||
Voronoi* GetCurveVoronoi( const ICurve& crvC) ;
|
||||
Binary file not shown.
@@ -1618,6 +1618,9 @@ AssociatePolyLinesMinDistPoints( const PolyLine& PL1, const PolyLine& PL2, PNTIV
|
||||
int nPnt2 = PL2.GetPointNbr() ;
|
||||
if ( nPnt1 == 0 || nPnt2 == 0)
|
||||
return false ;
|
||||
|
||||
bool bClosed1 = PL1.IsClosed() ;
|
||||
bool bClosed2 = PL2.IsClosed() ;
|
||||
|
||||
// indica la presenza di punti interni in comune tra le due polylines
|
||||
bCommonInternalPoints = false ;
|
||||
@@ -1663,6 +1666,10 @@ AssociatePolyLinesMinDistPoints( const PolyLine& PL1, const PolyLine& PL2, PNTIV
|
||||
if ( nMinJ < nLastJ)
|
||||
nMinJ = nLastJ ;
|
||||
|
||||
// se la curva è chiusa il primo e l'ultimo punto coincidono, verifico quale conviene considerare
|
||||
if ( bClosed2 && nMinJ == nTotP2 - 1 && nLastJ == 0)
|
||||
nMinJ = 0 ;
|
||||
|
||||
// verifica se è un punto interno in comune con l'altra polyline
|
||||
if ( i < nTotP1 - 1 && dDist < EPS_SMALL && abs( dMinDistPar - floor( dMinDistPar + 0.5)) < EPS_SMALL)
|
||||
bCommonInternalPoints = true ;
|
||||
@@ -1693,6 +1700,9 @@ AssociatePolyLinesMinDistPoints( const PolyLine& PL1, const PolyLine& PL2, PNTIV
|
||||
|
||||
if ( nMinI < nLastI)
|
||||
nMinI = nLastI ;
|
||||
|
||||
if ( bClosed1 && nMinI == nTotP1 - 1 && nLastI == 0)
|
||||
nMinI = 0 ;
|
||||
|
||||
if ( j < nTotP2 - 1 && dDist < EPS_SMALL && abs( dMinDistPar - floor( dMinDistPar + 0.5)) < EPS_SMALL)
|
||||
bCommonInternalPoints = true ;
|
||||
|
||||
+725
-625
File diff suppressed because it is too large
Load Diff
+70
-3
@@ -434,6 +434,7 @@ Voronoi::GetBisectorCurve( int i)
|
||||
pLine->Set( ptS, ptE) ;
|
||||
pLine->SetTempParam( dParS, 0) ;
|
||||
pLine->SetTempParam( dParE, 1) ;
|
||||
pLine->SetTempProp( i) ;
|
||||
pLine->ToGlob( m_Frame) ;
|
||||
return pLine ;
|
||||
}
|
||||
@@ -454,6 +455,7 @@ Voronoi::GetBisectorCurve( int i)
|
||||
pArc->SetC2P( ptC, ptS, ptE) ;
|
||||
pArc->SetTempParam( dParS, 0) ;
|
||||
pArc->SetTempParam( dParS, 1) ; // dParE = dParS
|
||||
pArc->SetTempProp( i) ;
|
||||
pArc->ToGlob( m_Frame) ;
|
||||
return pArc ;
|
||||
}
|
||||
@@ -473,7 +475,7 @@ Voronoi::GetBisectorCurve( int i)
|
||||
bool bInvert = false ;
|
||||
double dPar1, dPar2 ;
|
||||
m_vroni->GetApproxedBisectorParams( i, dPar1, dPar2) ;
|
||||
if ( dPar1 > dPar2 + EPS_SMALL)
|
||||
if ( dPar1 > dPar2)
|
||||
bInvert = true ;
|
||||
|
||||
// punto iniziale
|
||||
@@ -496,6 +498,11 @@ Voronoi::GetBisectorCurve( int i)
|
||||
dParPrev = dPar ;
|
||||
nCrvCount ++ ;
|
||||
}
|
||||
else if ( ( bInvert && j == 0) || ( ! bInvert && j == nPoints - 1)) {
|
||||
// se estremo devo forzarlo
|
||||
pCompo->ModifyEnd( pt) ;
|
||||
dParPrev = dPar ;
|
||||
}
|
||||
// aggiorno per punto successivo
|
||||
if ( bInvert)
|
||||
j -- ;
|
||||
@@ -506,6 +513,7 @@ Voronoi::GetBisectorCurve( int i)
|
||||
// setto parametri sulla curva
|
||||
pCompo->SetTempParam( dParS, 0) ;
|
||||
pCompo->SetTempParam( dParPrev, 1) ;
|
||||
pCompo->SetTempProp( i) ;
|
||||
|
||||
pCompo->ToGlob( m_Frame) ;
|
||||
return pCompo ;
|
||||
@@ -700,8 +708,8 @@ Voronoi::CalcSingleCurvesOffset( ICURVEPOVECTOR& vOffs, double dOffs)
|
||||
// se necessario verifico se dal lato corretto rispetto ai siti di riferimento
|
||||
if ( bLeft && bRight) {
|
||||
// recupero i siti di riferimento
|
||||
int nOrigCrv1, nOrigSubCrv1, nOrigCrv2, nOrigSubCrv2 ;
|
||||
m_vroni->GetBisectorSites( i, nOrigCrv1, nOrigSubCrv1, nOrigCrv2, nOrigSubCrv2) ;
|
||||
int nOrigCrv1, nOrigSubCrv1, nOrigSubPnt1, nOrigCrv2, nOrigSubCrv2, nOrigSubPnt2 ;
|
||||
m_vroni->GetBisectorSites( i, nOrigCrv1, nOrigSubCrv1, nOrigSubPnt1, nOrigCrv2, nOrigSubCrv2, nOrigSubPnt2) ;
|
||||
if ( nOrigCrv1 != -1) {
|
||||
// verifico il lato rispetto al primo sito
|
||||
pCrv->SetTempProp( nOrigSubCrv1 + 1, 0) ;
|
||||
@@ -1261,3 +1269,62 @@ Voronoi::CalcLimitOffset( int nCrv, bool bLeft, double& dOffs)
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
bool
|
||||
Voronoi::GetBisectorPointAtParam( int nCrv, double dPar, Point3d& ptP)
|
||||
{
|
||||
if ( ! IsValid())
|
||||
return false ;
|
||||
|
||||
try {
|
||||
if ( ! m_bVDComputed)
|
||||
CalcVoronoi() ;
|
||||
|
||||
// verifico se il bisettore e il parametri richiesto sono sensati
|
||||
if ( nCrv >= m_vroni->GetNumberOfEdges())
|
||||
return false ;
|
||||
double dParS, dParE ;
|
||||
m_vroni->GetBisectorParams( nCrv, dParS, dParE) ;
|
||||
if ( dParS > dParE)
|
||||
swap( dParS, dParE) ;
|
||||
if ( dPar < dParS || dPar > dParE)
|
||||
return false ;
|
||||
|
||||
// calcolo il punto sul bisettore in corrispondenza dell'offset
|
||||
m_vroni->GetBisectorPointAtParam( nCrv, dPar, ptP.v) ;
|
||||
ptP.ToGlob( m_Frame) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
catch (...) {
|
||||
LOG_ERROR( GetEGkLogger(), m_vroni->GetExceptionMessage()) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
bool
|
||||
Voronoi::GetBisectorSites( int nCrv, int& nCrv1, int& nSubCrv1, int& nSubPnt1, int& nCrv2, int& nSubCrv2, int& nSubPnt2)
|
||||
{
|
||||
if ( ! IsValid())
|
||||
return false ;
|
||||
|
||||
try {
|
||||
if ( ! m_bVDComputed)
|
||||
CalcVoronoi() ;
|
||||
|
||||
// verifico se il bisettore è valido
|
||||
if ( nCrv >= m_vroni->GetNumberOfEdges())
|
||||
return false ;
|
||||
|
||||
// calcolo il punto sul bisettore in corrispondenza dell'offset
|
||||
m_vroni->GetBisectorSites( nCrv, nCrv1, nSubCrv1, nSubPnt1, nCrv2, nSubCrv2, nSubPnt2) ;
|
||||
return true ;
|
||||
}
|
||||
catch (...) {
|
||||
LOG_ERROR( GetEGkLogger(), m_vroni->GetExceptionMessage()) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,8 @@ class Voronoi
|
||||
bool CalcFatCurve( ICURVEPOVECTOR& vOffs, double dOffs, bool bSquareEnds, bool bSquareMids, bool bMergeOnlySameProps = true) ;
|
||||
bool CalcMedialAxis( ICURVEPOVECTOR& vCrvs, int nSide) ;
|
||||
bool CalcLimitOffset( int nCrv, bool bLeft, double& dOffs) ;
|
||||
bool GetBisectorPointAtParam( int nCrv, double dPar, Point3d& ptP) ;
|
||||
bool GetBisectorSites( int nCrv, int& nCrv1, int& nSubCrv1, int& nSubPnt1, int& nCrv2, int& nSubCrv2, int& nSubPnt2) ;
|
||||
|
||||
bool Translate( const Vector3d& vtMove) ;
|
||||
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg) ;
|
||||
|
||||
Reference in New Issue
Block a user