Merge remote-tracking branch 'origin/master' into ExtDimension_angular
This commit is contained in:
+2
-2
@@ -278,7 +278,7 @@ MyAdjustLoops( ICurve* pCurve, ICURVEPLIST& CrvLst)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
AdjustLoops( ICurve* pCurve, ICURVEPLIST& CrvLst)
|
||||
AdjustLoops( ICurve* pCurve, ICURVEPLIST& CrvLst, bool bNeedSameProp)
|
||||
{
|
||||
// elimino eventuali sovrapposizioni e accostamenti
|
||||
if ( ! MyAdjustLoops( pCurve, CrvLst))
|
||||
@@ -291,7 +291,7 @@ AdjustLoops( ICurve* pCurve, ICURVEPLIST& CrvLst)
|
||||
// elimino eventuali Spikes e Small Z
|
||||
pCrvCo->RemoveSmallDefects( 2 * LIN_TOL_MIN, ANG_TOL_STD_DEG, true) ;
|
||||
// unisco eventuali tratti allineati
|
||||
pCrvCo->MergeCurves( LIN_TOL_MIN, ANG_TOL_STD_DEG) ;
|
||||
pCrvCo->MergeCurves( LIN_TOL_MIN, ANG_TOL_STD_DEG, true, bNeedSameProp) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -17,4 +17,4 @@
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool AdjustLoops( ICurve* pCurve, ICURVEPLIST& CrvLst) ;
|
||||
bool AdjustLoops( ICurve* pCurve, ICURVEPLIST& CrvLst, bool bNeedSameProp) ;
|
||||
|
||||
@@ -168,7 +168,7 @@ CurveArc* GetArcCenTgCompoPnt( const Point3d& ptCen, const CurveComposite& crvCo
|
||||
double dSqDist = SqDist( ptNearStart, ptTg) ;
|
||||
if ( dSqDist < dMinSqDist) {
|
||||
dMinSqDist = dSqDist ;
|
||||
pCrvArc.Set( Release( pCrvAtmp)) ;
|
||||
pCrvArc.Set( pCrvAtmp) ;
|
||||
if ( pPtTg != nullptr)
|
||||
*pPtTg = ptTg ;
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ GetArcPntDirTgCompo( const Point3d& ptP, const Vector3d& vtDir, const CurveCompo
|
||||
double dSqDist = SqDist( ptNear, ptTg) ;
|
||||
if ( dSqDist < dMinSqDist) {
|
||||
dMinSqDist = dSqDist ;
|
||||
pCrvNew.Set( Release( pCrvTmp)) ;
|
||||
pCrvNew.Set( pCrvTmp) ;
|
||||
if ( pPtTg != nullptr)
|
||||
*pPtTg = ptTg ;
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ GetCircleCenTgCompo( const Point3d& ptCen, const Vector3d& vtN, const CurveCompo
|
||||
double dSqDist = SqDist( ptNear, ptTg) ;
|
||||
if ( dSqDist < dMinSqDist) {
|
||||
dMinSqDist = dSqDist ;
|
||||
pCrvArc.Set( Release( pCrvAtmp)) ;
|
||||
pCrvArc.Set( pCrvAtmp) ;
|
||||
if ( pPtTg != nullptr)
|
||||
*pPtTg = ptTg ;
|
||||
}
|
||||
|
||||
+84
-33
@@ -25,6 +25,7 @@
|
||||
#include "/EgtDev/Include/EGkAngle.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||
#include "/EgtDev/Include/ENkPolynomialRoots.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <new>
|
||||
|
||||
@@ -699,29 +700,8 @@ CurveArc::Load( NgeReader& ngeIn)
|
||||
bool
|
||||
CurveArc::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
|
||||
{
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// assegno il box in locale
|
||||
b3Loc.Reset() ;
|
||||
double dLinTol = LIN_TOL_APPROX ;
|
||||
double dAngTolDeg = ANG_TOL_APPROX_DEG ;
|
||||
if ( ( nFlag & BBF_EXACT) != 0)
|
||||
dLinTol = LIN_TOL_MIN ;
|
||||
ArcApproxer aAppr( dLinTol, dAngTolDeg, false, *this) ;
|
||||
double dU ;
|
||||
Point3d ptPos ;
|
||||
while ( aAppr.GetPoint( dU, ptPos))
|
||||
b3Loc.Add( ptPos) ;
|
||||
// se c'è estrusione, devo tenerne conto
|
||||
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
|
||||
Point3d ptMinExtr = b3Loc.GetMin() + m_VtExtr * m_dThick ;
|
||||
Point3d ptMaxExtr = b3Loc.GetMax() + m_VtExtr * m_dThick ;
|
||||
b3Loc.Add( ptMinExtr) ;
|
||||
b3Loc.Add( ptMaxExtr) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
// richiamo della funzione generale
|
||||
return GetBBox( GLOB_FRM, b3Loc, nFlag) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -736,17 +716,88 @@ CurveArc::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
return false ;
|
||||
// assegno il box nel riferimento
|
||||
b3Ref.Reset() ;
|
||||
double dLinTol = LIN_TOL_APPROX ;
|
||||
double dAngTolDeg = ANG_TOL_APPROX_DEG ;
|
||||
if ( ( nFlag & BBF_EXACT) != 0)
|
||||
dLinTol = LIN_TOL_MIN ;
|
||||
ArcApproxer aAppr( dLinTol, dAngTolDeg, false, *this) ;
|
||||
double dU ;
|
||||
Point3d ptPos ;
|
||||
while ( aAppr.GetPoint( dU, ptPos)) {
|
||||
ptPos.ToGlob( frRef) ;
|
||||
b3Ref.Add( ptPos) ;
|
||||
|
||||
// ricavo il riferimento intrinseco dell'arco
|
||||
Frame3d frArc;
|
||||
frArc.Set( m_PtCen, ( m_dAngCenDeg > 0 ? m_VtN : -m_VtN), m_VtS) ;
|
||||
|
||||
// pendenza intrinseca
|
||||
double dPitch = m_dDeltaN * ( m_dAngCenDeg > 0 ? 1 : -1) / abs( m_dAngCenDeg * DEGTORAD) ;
|
||||
|
||||
// cordinate nel frRef dei versori del sistema di riferimento dell'arco
|
||||
Vector3d vtXRef = frArc.VersX() ;
|
||||
vtXRef.ToGlob( frRef) ;
|
||||
Vector3d vtYRef = frArc.VersY() ;
|
||||
vtYRef.ToGlob( frRef) ;
|
||||
Vector3d vtZRef = frArc.VersZ() ;
|
||||
vtZRef.ToGlob( frRef) ;
|
||||
|
||||
// il punto iniziale e finale sono punti candidati per estremanti
|
||||
Point3d ptS, ptE ;
|
||||
GetStartPoint( ptS) ;
|
||||
ptS.ToGlob( frRef) ;
|
||||
b3Ref.Add( ptS) ;
|
||||
GetEndPoint( ptE) ;
|
||||
ptE.ToGlob( frRef) ;
|
||||
b3Ref.Add( ptE) ;
|
||||
|
||||
// vettore degli angoli dei punti candidati estremi
|
||||
DBLVECTOR vdTheta ;
|
||||
|
||||
// arco piatto
|
||||
if ( abs( dPitch) < EPS_SMALL) {
|
||||
double dAngXDeg = atan2( vtYRef.x, vtXRef.x) * RADTODEG ;
|
||||
bool bAngXSmall = (abs( dAngXDeg) <= EPS_ANG_ZERO) ;
|
||||
if ( ! bAngXSmall) {
|
||||
vdTheta.push_back( dAngXDeg) ;
|
||||
vdTheta.push_back( dAngXDeg + ANG_STRAIGHT) ;
|
||||
}
|
||||
double dAngYDeg = atan2( vtYRef.y, vtXRef.y) * RADTODEG ;
|
||||
bool bAngYSmall = (abs( dAngYDeg) <= EPS_ANG_ZERO) ;
|
||||
if ( ! bAngYSmall) {
|
||||
vdTheta.push_back( dAngYDeg) ;
|
||||
vdTheta.push_back( dAngYDeg + ANG_STRAIGHT) ;
|
||||
}
|
||||
double dAngZDeg = atan2( vtYRef.z, vtXRef.z) * RADTODEG ;
|
||||
bool bAngZSmall = (abs( dAngZDeg) <= EPS_ANG_ZERO) ;
|
||||
if ( ! bAngZSmall) {
|
||||
vdTheta.push_back( dAngZDeg) ;
|
||||
vdTheta.push_back( dAngZDeg + ANG_STRAIGHT) ;
|
||||
}
|
||||
if ( bAngXSmall || bAngYSmall || bAngZSmall)
|
||||
vdTheta.push_back( ANG_STRAIGHT) ;
|
||||
}
|
||||
// altrimenti arco di elica
|
||||
else {
|
||||
for ( int i = 0 ; i < 3 ; ++ i) {
|
||||
DBLVECTOR vdPoly{ m_dRad * vtYRef.v[i] + dPitch * vtZRef.v[i],
|
||||
- 2 * m_dRad * vtXRef.v[i],
|
||||
- m_dRad * vtYRef.v[i] + dPitch * vtZRef.v[i]} ;
|
||||
DBLVECTOR vdRoot ;
|
||||
int nRoot = PolynomialRoots( 2, vdPoly, vdRoot) ;
|
||||
for ( int i = 0 ; i < nRoot ; ++ i) {
|
||||
double dAngDeg = atan2( 2 * vdRoot[i], (1 - vdRoot[i] * vdRoot[i])) * RADTODEG ;
|
||||
if ( abs( dAngDeg) > EPS_ANG_ZERO) {
|
||||
vdTheta.push_back( dAngDeg) ;
|
||||
vdTheta.push_back( dAngDeg + ANG_STRAIGHT) ;
|
||||
}
|
||||
else
|
||||
vdTheta.push_back( ANG_STRAIGHT) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// verifica degli angoli sull'arco ed eventuale considerazione dei punti
|
||||
for ( int i = 0 ; i < int( vdTheta.size()) ; ++ i) {
|
||||
double dTheta = ( vdTheta[i] > 0 ? vdTheta[i] : vdTheta[i] + ANG_FULL) ;
|
||||
if ( dTheta < abs( m_dAngCenDeg)) {
|
||||
Point3d ptP ;
|
||||
GetPointD1D2( dTheta / ( abs( m_dAngCenDeg)), FROM_MINUS, ptP) ;
|
||||
ptP.ToGlob( frRef) ;
|
||||
b3Ref.Add( ptP) ;
|
||||
}
|
||||
}
|
||||
|
||||
// se c'è estrusione, devo tenerne conto
|
||||
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
|
||||
Vector3d vtFrExtr = m_VtExtr ;
|
||||
|
||||
+2
-3
@@ -30,9 +30,8 @@ using namespace std ;
|
||||
bool
|
||||
IsClosed( const ICurve& crvC)
|
||||
{
|
||||
Point3d ptStart ;
|
||||
Point3d ptEnd ;
|
||||
return ( crvC.GetStartPoint( ptStart) && crvC.GetEndPoint( ptEnd) && AreSamePointApprox( ptStart, ptEnd)) ;
|
||||
Point3d ptStart, ptEnd ;
|
||||
return ( crvC.GetStartPoint( ptStart) && crvC.GetEndPoint( ptEnd) && AreSamePointApprox( ptStart, ptEnd)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+1
-1
@@ -1478,7 +1478,7 @@ CurveBezier::BiArcOrSplit( int nLev, PolyLine& PL, double dLinTol, double dAngTo
|
||||
return false ;
|
||||
if ( ! pCC->FromPolyLine( PL))
|
||||
return false ;
|
||||
pCrv.Set( Release( pCC)) ;
|
||||
pCrv.Set( pCC) ;
|
||||
dMaxDist = 0 ;
|
||||
}
|
||||
// se la polilinea ha un solo punto, esco
|
||||
|
||||
+1
-1
@@ -460,7 +460,7 @@ CurveByApprox::BiArcOrSplit( int nLev, PolyLine& PL, double dLinTol, double dAng
|
||||
return false ;
|
||||
if ( ! pCC->FromPolyLine( PL))
|
||||
return false ;
|
||||
pCrv.Set( Release( pCC)) ;
|
||||
pCrv.Set( pCC) ;
|
||||
dMaxDist = 0 ;
|
||||
}
|
||||
// se la polilinea ha un solo punto, esco
|
||||
|
||||
+2
-4
@@ -136,11 +136,9 @@ CurveComposite::AddCurve( ICurve* pCrv, bool bEndOrStart, double dLinTol)
|
||||
// altrimenti curva composita, devo aggiungere le singole curve semplici
|
||||
else {
|
||||
// riloco le curve dalla composita sorgente alla corrente
|
||||
CurveComposite* pCrvCompo = dynamic_cast<CurveComposite*>( pCrv) ;
|
||||
if ( ! AddCurveByRelocate( *pCrvCompo, bEndOrStart, dLinTol))
|
||||
PtrOwner<CurveComposite> pCrvCompo( GetBasicCurveComposite( pCrv)) ;
|
||||
if ( IsNull( pCrvCompo) || ! AddCurveByRelocate( *pCrvCompo, bEndOrStart, dLinTol))
|
||||
return false ;
|
||||
// cancello la curva composita originaria
|
||||
delete pCrvCompo ;
|
||||
}
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
|
||||
Binary file not shown.
@@ -22,7 +22,7 @@
|
||||
<ProjectGuid>{9A98A202-2853-454A-84CA-DCD1714176C9}</ProjectGuid>
|
||||
<RootNamespace>EgtGeomKernel</RootNamespace>
|
||||
<Keyword>MFCDLLProj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
|
||||
@@ -162,7 +162,7 @@ GetLinePointPerpCompo( const Point3d& ptP, const CurveComposite& crvCompo, const
|
||||
double dSqDist = SqDist( ptNear, pCrvLtmp->GetEnd()) ;
|
||||
if ( dSqDist < dMinSqDist) {
|
||||
dMinSqDist = dSqDist ;
|
||||
pCrvLine.Set( Release( pCrvLtmp)) ;
|
||||
pCrvLine.Set( pCrvLtmp) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ GetLinePointTgCompo( const Point3d& ptP, const CurveComposite& crvCompo, const P
|
||||
double dSqDist = SqDist( ptNear, pCrvLtmp->GetEnd()) ;
|
||||
if ( dSqDist < dMinSqDist) {
|
||||
dMinSqDist = dSqDist ;
|
||||
pCrvLine.Set( Release( pCrvLtmp)) ;
|
||||
pCrvLine.Set( pCrvLtmp) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -257,7 +257,7 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
}
|
||||
// aggiorno curva precedente
|
||||
++ nInd1 ;
|
||||
pCrv1.Set( Release( pCrv2)) ;
|
||||
pCrv1.Set( pCrv2) ;
|
||||
// passo alla curva successiva
|
||||
pCrv2.Set( ccCopy2.RemoveFirstOrLastCurve( false)) ;
|
||||
}
|
||||
|
||||
+1
-1
@@ -436,7 +436,7 @@ SurfFlatRegionByContours::AddCurve( ICurve* pCrv)
|
||||
pMyCrv->SetThickness( 0) ;
|
||||
// rimuovo eventuali sovrapposizioni (calcolate nel suo piano)
|
||||
ICURVEPLIST CrvLst ;
|
||||
if ( ! AdjustLoops( Release( pMyCrv), CrvLst))
|
||||
if ( ! AdjustLoops( Release( pMyCrv), CrvLst, true))
|
||||
return false ;
|
||||
// la/le inserisco nel vettore delle curve
|
||||
for ( auto& pSingCrv : CrvLst)
|
||||
|
||||
+18
-21
@@ -17,6 +17,7 @@
|
||||
#include "CurveLine.h"
|
||||
#include "CurveArc.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "SurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
@@ -40,7 +41,7 @@ GetSurfTriMeshByFlatContour( const ICurve* pCurve, double dLinTol)
|
||||
if ( ! pCurve->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, ICurve::APL_SPECIAL, PL))
|
||||
return nullptr ;
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
PtrOwner<SurfTriMesh> pSTM( CreateBasicSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByFlatContour( PL))
|
||||
return nullptr ;
|
||||
// salvo tolleranza lineare usata
|
||||
@@ -62,7 +63,7 @@ GetSurfTriMeshByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol)
|
||||
if ( ! CalcRegionPolyLines( vpCurve, dLinTol, vPL, vtN))
|
||||
return nullptr ;
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
PtrOwner<SurfTriMesh> pSTM( CreateBasicSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPL))
|
||||
return nullptr ;
|
||||
// salvo tolleranza lineare usata
|
||||
@@ -101,25 +102,23 @@ GetSurfTriMeshByExtrusion( const ICurve* pCurve, const Vector3d& vtExtr,
|
||||
}
|
||||
}
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
PtrOwner<SurfTriMesh> pSTM( CreateBasicSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByExtrusion( PL, vtExtr))
|
||||
return nullptr ;
|
||||
// se da fare, metto i tappi sulle estremità
|
||||
if ( bDoCapEnds) {
|
||||
// creo la prima superficie di estremità
|
||||
PtrOwner<ISurfTriMesh> pSTM1( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM1) || ! pSTM1->CreateByFlatContour( PL))
|
||||
SurfTriMesh STM1 ;
|
||||
if ( ! STM1.CreateByFlatContour( PL))
|
||||
return nullptr ;
|
||||
// la copio
|
||||
PtrOwner<ISurfTriMesh> pSTM2( pSTM1->Clone()) ;
|
||||
if ( IsNull( pSTM2))
|
||||
return nullptr ;
|
||||
SurfTriMesh STM2 = STM1 ;
|
||||
// inverto la prima superficie
|
||||
pSTM1->Invert() ;
|
||||
STM1.Invert() ;
|
||||
// traslo la seconda
|
||||
pSTM2->Translate( vtExtr) ;
|
||||
STM2.Translate( vtExtr) ;
|
||||
// le unisco alla superficie del fianco
|
||||
if ( ! pSTM->DoSewing( *pSTM1) || ! pSTM->DoSewing( *pSTM2))
|
||||
if ( ! pSTM->DoSewing( STM1) || ! pSTM->DoSewing( STM2))
|
||||
return nullptr ;
|
||||
}
|
||||
// salvo tolleranza lineare usata
|
||||
@@ -153,30 +152,28 @@ GetSurfTriMeshByRegionExtrusion( const CICURVEPVECTOR& vpCurve, const Vector3d&
|
||||
vPL[i].Invert() ;
|
||||
}
|
||||
// creo la prima superficie di estremità
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
PtrOwner<SurfTriMesh> pSTM( CreateBasicSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPL))
|
||||
return nullptr ;
|
||||
// creo la seconda superficie e la unisco alla prima
|
||||
{ // copio la prima superficie
|
||||
PtrOwner<ISurfTriMesh> pSTM2( pSTM->Clone()) ;
|
||||
if ( IsNull( pSTM2))
|
||||
return nullptr ;
|
||||
SurfTriMesh STM2 = *pSTM ;
|
||||
// inverto la prima superficie
|
||||
pSTM->Invert() ;
|
||||
// traslo la seconda
|
||||
pSTM2->Translate( vtExtr) ;
|
||||
STM2.Translate( vtExtr) ;
|
||||
// la unisco alla prima
|
||||
if ( ! pSTM->DoSewing( *pSTM2))
|
||||
if ( ! pSTM->DoSewing( STM2))
|
||||
return nullptr ;
|
||||
}
|
||||
// creo e unisco le diverse superfici di estrusione
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
|
||||
// estrusione
|
||||
PtrOwner<ISurfTriMesh> pSTM2( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM2) || ! pSTM2->CreateByExtrusion( vPL[i], vtExtr))
|
||||
SurfTriMesh STM2 ;
|
||||
if ( ! STM2.CreateByExtrusion( vPL[i], vtExtr))
|
||||
return nullptr ;
|
||||
// la unisco alla superficie principale
|
||||
if ( ! pSTM->DoSewing( *pSTM2))
|
||||
if ( ! pSTM->DoSewing( STM2))
|
||||
return nullptr ;
|
||||
}
|
||||
// compatto la superficie
|
||||
@@ -685,7 +682,7 @@ GetSurfTriMeshSwept( const ICurve* pSect, const ICurve* pGuide, bool bCapEnds, d
|
||||
pSTM->DoSewing( *pSr) ;
|
||||
}
|
||||
// salvo la curva come prossima precedente
|
||||
pPrevCrv.Set( Release( pCurrCrv)) ;
|
||||
pPrevCrv.Set( pCurrCrv) ;
|
||||
// prossimo punto
|
||||
bPoint = PL.GetNextPoint( ptP) ;
|
||||
}
|
||||
|
||||
+32
-35
@@ -14,6 +14,7 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "CurveArc.h"
|
||||
#include "SurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EGkPolygon3d.h"
|
||||
@@ -22,7 +23,7 @@
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static ISurfTriMesh*
|
||||
static SurfTriMesh*
|
||||
GetStandardSurfTriMeshBox( double dDimX, double dDimY, double dHeight)
|
||||
{
|
||||
// creo la polilinea del contorno della base
|
||||
@@ -38,29 +39,27 @@ GetStandardSurfTriMeshBox( double dDimX, double dDimY, double dHeight)
|
||||
// vettore altezza (estrusione)
|
||||
Vector3d vtExtr( 0, 0, dHeight) ;
|
||||
// creo e setto la superficie trimesh laterale
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
PtrOwner<SurfTriMesh> pSTM( CreateBasicSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByExtrusion( PL, vtExtr))
|
||||
return nullptr ;
|
||||
// creo la prima superficie di estremità
|
||||
PtrOwner<ISurfTriMesh> pSTM1( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM1) || ! pSTM1->CreateByFlatContour( PL))
|
||||
SurfTriMesh STM1 ;
|
||||
if ( ! STM1.CreateByFlatContour( PL))
|
||||
return nullptr ;
|
||||
// la copio
|
||||
PtrOwner<ISurfTriMesh> pSTM2( pSTM1->Clone()) ;
|
||||
if ( IsNull( pSTM2))
|
||||
return nullptr ;
|
||||
SurfTriMesh STM2 = STM1 ;
|
||||
// inverto la prima superficie
|
||||
pSTM1->Invert() ;
|
||||
STM1.Invert() ;
|
||||
// traslo la seconda
|
||||
pSTM2->Translate( Vector3d( 0, 0, dHeight)) ;
|
||||
STM2.Translate( Vector3d( 0, 0, dHeight)) ;
|
||||
// le unisco alla superficie del fianco
|
||||
if ( ! pSTM->DoSewing( *pSTM1) || ! pSTM->DoSewing( *pSTM2))
|
||||
if ( ! pSTM->DoSewing( STM1) || ! pSTM->DoSewing( STM2))
|
||||
return nullptr ;
|
||||
// restituisco la superficie
|
||||
return Release( pSTM) ;
|
||||
}
|
||||
//-------------------------------------------------------------------------------
|
||||
static ISurfTriMesh*
|
||||
static SurfTriMesh*
|
||||
GetRegularSurfTriMeshBox( double dDimX, double dDimY, double dHeight)
|
||||
{
|
||||
// i triangoli devono essere quasi equilateri pertanto calcolo come dividere le varie parti
|
||||
@@ -92,15 +91,15 @@ GetRegularSurfTriMeshBox( double dDimX, double dDimY, double dHeight)
|
||||
// vettore altezza (estrusione)
|
||||
Vector3d vtExtr1( 0, 0, dStepZ) ;
|
||||
// creo e unisco le superfici trimesh laterali
|
||||
PtrOwner<ISurfTriMesh> pSTM1 ;
|
||||
PtrOwner<SurfTriMesh> pSTM1 ;
|
||||
for ( int k = 0 ; k < nStepZ ; ++ k) {
|
||||
PtrOwner<ISurfTriMesh> pSTMz( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTMz) || ! pSTMz->CreateByExtrusion( PL1, vtExtr1))
|
||||
SurfTriMesh STMz ;
|
||||
if ( ! STMz.CreateByExtrusion( PL1, vtExtr1))
|
||||
return nullptr ;
|
||||
pSTMz->Translate( Vector3d( 0, 0, k * dStepZ)) ;
|
||||
STMz.Translate( Vector3d( 0, 0, k * dStepZ)) ;
|
||||
if ( IsNull( pSTM1))
|
||||
pSTM1.Set( Release( pSTMz)) ;
|
||||
else if ( ! pSTM1->DoSewing( *pSTMz))
|
||||
pSTM1.Set( STMz.Clone()) ;
|
||||
else if ( ! pSTM1->DoSewing( STMz))
|
||||
return nullptr ;
|
||||
}
|
||||
// creo la polilinea del lato sinistro della superficie inferiore
|
||||
@@ -112,26 +111,24 @@ GetRegularSurfTriMeshBox( double dDimX, double dDimY, double dHeight)
|
||||
// vettore estrusione
|
||||
Vector3d vtExtr2( dStepX, 0, 0) ;
|
||||
// creo e unisco le superfici trimesh inferiori
|
||||
PtrOwner<ISurfTriMesh> pSTM2 ;
|
||||
SurfTriMesh STM2 ;
|
||||
for ( int i = 0 ; i < nStepX ; ++ i) {
|
||||
PtrOwner<ISurfTriMesh> pSTMx( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTMx) || ! pSTMx->CreateByExtrusion( PL2, vtExtr2))
|
||||
SurfTriMesh STMx ;
|
||||
if ( ! STMx.CreateByExtrusion( PL2, vtExtr2))
|
||||
return nullptr ;
|
||||
pSTMx->Translate( Vector3d( i * dStepX, 0, 0)) ;
|
||||
if ( IsNull( pSTM2))
|
||||
pSTM2.Set( Release( pSTMx)) ;
|
||||
else if ( ! pSTM2->DoSewing( *pSTMx))
|
||||
STMx.Translate( Vector3d( i * dStepX, 0, 0)) ;
|
||||
if ( STM2.IsEmpty())
|
||||
STM2 = STMx ;
|
||||
else if ( ! STM2.DoSewing( STMx))
|
||||
return nullptr ;
|
||||
}
|
||||
// la copio
|
||||
PtrOwner<ISurfTriMesh> pSTM3( pSTM2->Clone()) ;
|
||||
if ( IsNull( pSTM3))
|
||||
return nullptr ;
|
||||
SurfTriMesh STM3 = STM2 ;
|
||||
// inverto e traslo la superficie superiore
|
||||
pSTM3->Invert() ;
|
||||
pSTM3->Translate( Vector3d( 0, 0, dHeight)) ;
|
||||
STM3.Invert() ;
|
||||
STM3.Translate( Vector3d( 0, 0, dHeight)) ;
|
||||
// le unisco alla superficie del fianco
|
||||
if ( ! pSTM1->DoSewing( *pSTM2) || ! pSTM1->DoSewing( *pSTM3))
|
||||
if ( ! pSTM1->DoSewing( STM2) || ! pSTM1->DoSewing( STM3))
|
||||
return nullptr ;
|
||||
// restituisco la superficie
|
||||
return Release( pSTM1) ;
|
||||
@@ -171,16 +168,16 @@ GetSurfTriMeshPyramid( double dDimX, double dDimY, double dHeight)
|
||||
// punto di vertice
|
||||
Point3d ptTip( 0.5 * dDimX, 0.5 * dDimY, dHeight) ;
|
||||
// creo e setto la superficie trimesh laterale
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
PtrOwner<SurfTriMesh> pSTM( CreateBasicSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByPointCurve( ptTip, PL))
|
||||
return nullptr ;
|
||||
// creo la superficie di base e ne inverto la normale
|
||||
PtrOwner<ISurfTriMesh> pSTM1( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM1) || ! pSTM1->CreateByFlatContour( PL))
|
||||
SurfTriMesh STM1 ;
|
||||
if ( ! STM1.CreateByFlatContour( PL))
|
||||
return nullptr ;
|
||||
pSTM1->Invert() ;
|
||||
STM1.Invert() ;
|
||||
// la unisco alla superficie del fianco
|
||||
if ( ! pSTM->DoSewing( *pSTM1))
|
||||
if ( ! pSTM->DoSewing( STM1))
|
||||
return nullptr ;
|
||||
// restituisco la superficie
|
||||
return Release( pSTM) ;
|
||||
|
||||
+2
-2
@@ -103,7 +103,7 @@ SurfFlatRegion::AddExtLoop( ICurve* pCrv)
|
||||
pMyCrv->SetThickness( 0) ;
|
||||
// rimuovo eventuali sovrapposizioni (calcolate nel suo piano)
|
||||
ICURVEPLIST CrvLst ;
|
||||
if ( ! AdjustLoops( Release( pMyCrv), CrvLst))
|
||||
if ( ! AdjustLoops( Release( pMyCrv), CrvLst, true))
|
||||
return false ;
|
||||
// aggiungo le singole curve
|
||||
bool bOk = true ;
|
||||
@@ -247,7 +247,7 @@ SurfFlatRegion::AddIntLoop( ICurve* pCrv)
|
||||
pMyCrv->SetThickness( 0) ;
|
||||
// rimuovo eventuali sovrapposizioni (calcolate nel suo piano)
|
||||
ICURVEPLIST CrvLst ;
|
||||
if ( ! AdjustLoops( Release( pMyCrv), CrvLst))
|
||||
if ( ! AdjustLoops( Release( pMyCrv), CrvLst, true))
|
||||
return false ;
|
||||
// aggiungo le singole curve
|
||||
bool bOk = true ;
|
||||
|
||||
@@ -55,6 +55,15 @@ SurfFlatRegion::Offset( double dDist, int nType)
|
||||
// recupero le curve di offset
|
||||
PtrOwner<ICurve> pOffs( OffsCrv.GetLongerCurve()) ;
|
||||
while ( bOk && ! IsNull( pOffs)) {
|
||||
if( pOffs->GetType() == CRV_COMPO) {
|
||||
PtrOwner<ICurveComposite> pOffsCompo( CloneCurveComposite( pOffs)) ;
|
||||
pOffsCompo->SetTempProp( j, 1) ;
|
||||
for( int k = 0 ; k < pOffsCompo->GetCurveCount() ; ++k)
|
||||
pOffsCompo->SetCurveTempProp( k, j, 1) ;
|
||||
pOffs.Set( pOffsCompo) ;
|
||||
}
|
||||
else
|
||||
pOffs->SetTempProp( j, 1) ;
|
||||
// se prima curva esterna, è il primo contorno esterno della nuova regione
|
||||
if ( j == 0 && bFirstCurve) {
|
||||
if ( ! pSfrChk->AddExtLoop( Release( pOffs)))
|
||||
|
||||
+2
-2
@@ -1105,7 +1105,7 @@ SurfTriMesh::GetSilhouette( const Vector3d& vtDir, double dTol, POLYLINEVECTOR&
|
||||
pSfrPart->Offset( dTol, ICurve::OFF_FILLET) ;
|
||||
if ( IsNull( pSfr))
|
||||
if ( pSfrPart->GetNormVersor() * vtVers > 0)
|
||||
bOk = pSfr.Set( Release( pSfrPart)) ;
|
||||
bOk = pSfr.Set( pSfrPart) ;
|
||||
else
|
||||
bOk = false ;
|
||||
else {
|
||||
@@ -1151,7 +1151,7 @@ SurfTriMesh::GetSilhouette( const Vector3d& vtDir, double dTol, POLYLINEVECTOR&
|
||||
if ( ! IsNull( pSfrTria)) {
|
||||
pSfrTria->Offset( dTol, ICurve::OFF_FILLET) ;
|
||||
if ( IsNull( pSfr))
|
||||
pSfr.Set( Release( pSfrTria)) ;
|
||||
pSfr.Set( pSfrTria) ;
|
||||
else
|
||||
pSfr->Add( *pSfrTria) ;
|
||||
}
|
||||
|
||||
@@ -694,7 +694,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
|
||||
// Elimino loop interni non validi
|
||||
bool bDouble = true ;
|
||||
for ( int nInnLoop = 0 ; nInnLoop < int( vInnerLoop.size()) ; ++ nInnLoop) {
|
||||
if ( int( cvClosedChain[vInnerLoop[nInnLoop]].size()) > 2) {
|
||||
if ( cvClosedChain[vInnerLoop[nInnLoop]].size() > 2) {
|
||||
bDouble = false ;
|
||||
break ;
|
||||
}
|
||||
@@ -820,6 +820,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Divido i loop che si autointercettano
|
||||
int nInitialLoopNum = int( vPolygons.size()) ;
|
||||
for ( int nL = 1 ; nL < nInitialLoopNum ; ++ nL) {
|
||||
@@ -868,8 +869,8 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
|
||||
itSt2 = LoopPointList.emplace( itEn2, vAddingPointWithOrder[nPi]) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Spezzo i loop autointersecantesi
|
||||
|
||||
POLYLINEVECTOR vAuxPolygons ;
|
||||
vAuxPolygons.emplace_back( vPolygons[nL]) ;
|
||||
|
||||
@@ -917,7 +918,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
|
||||
}
|
||||
bool bReplaced = false ;
|
||||
for ( int nl = 0 ; nl < int( vAuxPolygons.size()) ; ++ nl) {
|
||||
if ( true/*vAuxPolygons.GetAreaXY(double& dArea)*/) {
|
||||
if ( true) {
|
||||
if ( ! bReplaced) {
|
||||
vPolygons[nL].Clear() ;
|
||||
Point3d ptP ;
|
||||
|
||||
Reference in New Issue
Block a user