Compare commits

..

53 Commits

Author SHA1 Message Date
LorenzoM 2bb59366a3 Virtual milling additivo 2022-01-05 15:46:40 +01:00
LorenzoM 33547de67a Virtual milling additivo 2021-10-25 09:25:54 +02:00
LorenzoM b5230f6935 Migliorie booleans, adv vmill, multi-utensile 2021-10-20 10:38:58 +02:00
LorenzoM 45033d1097 Merge commit 'add949b6a69fddab9cc8994c6115f3f30a4946e1' into LorenzoM 2021-10-18 11:16:40 +02:00
LorenzoM 67e4b81e99 Correzione errori e migliorie a virtual milling 2021-10-15 17:45:04 +02:00
DarioS add949b6a6 EgtGeomKernel :
- tentativo abortito di velocizzare Silhouette di superfici.
2021-10-04 09:01:36 +02:00
DarioS 4731df3702 EgtGeomKernel 2.3i2 :
- modificata completamente SurfTriMesh::GetSilhouette ora richiede un parametro per la tolleranza nel calcolo (diminuita sensibilità a problemi topologici)
- aggiunta funzione GetSurfFlatRegionFromTriangle.
2021-09-26 16:27:31 +02:00
DarioS e7d0b00e0f EgtGeomKernel :
- correzione a Zmap per calcolo grafica a triangoli.
2021-09-13 16:47:15 +02:00
DarioS 641708a5fa EgtGeomKernel 2.3i1 :
- in Regioni se richiesto offset praticamente nullo non si fa alcunché.
2021-09-13 15:48:36 +02:00
LorenzoM c802054427 Merge commit 'f5b11a61a078d45a66875e68fea7a79a64d3cbe1' into LorenzoM 2021-09-01 17:51:08 +02:00
LorenzoM b9548a4d33 Modifiche ad asportazioni avanzate vm 2021-09-01 17:32:41 +02:00
DarioS f5b11a61a0 EgtGeomKernel 2.3h3 :
- correzione crezione regioni da curve chiuse (contorni esterni che si intersecano e diventano in parte anche contorni interni).
2021-08-26 10:38:41 +02:00
DarioS a4cc43dadb EgtGeomKernel 2.3h2 :
- OffsetCurve ora gestisce anche il caso di curve piane con estrusione inclinata fino a 60gradi dalla normale del piano (l'offest si basa su un ellisse).
2021-08-25 15:03:56 +02:00
DarioS 334ce10018 EgtGeomKernel :
- ricompilazione.
2021-08-20 15:18:54 +02:00
LorenzoM ade2d97804 Aggiunte nuove funzionalità Asportazioni volumi 2021-08-05 15:22:08 +02:00
LorenzoM d2cb613505 Modifiche ad asportazioni volumi avanzate 2021-08-04 12:18:35 +02:00
LorenzoM 2d04e29844 Merge commit '3d233597f318f8431d32e000553c5f0914426821' into LorenzoM 2021-08-03 16:29:40 +02:00
LorenzoM 2cc5c505e3 Modifiche asportazioni volumei avanzate 2021-08-03 16:17:31 +02:00
LorenzoM f302e52206 Modifiche ad asportazioni volumi avanzate 2021-08-03 16:16:42 +02:00
DarioS 3d233597f3 EgtGeomKernel :
- a SurfTriMesh::DoSewing aggiunto parametro opzionale double dTol.
2021-08-01 17:12:07 +02:00
DarioS a5fad89380 EgtGeomKernel 2.3h1 :
- piccole migliorie suggerite da clang-cl.
2021-08-01 10:50:15 +02:00
DarioS d0f9c2fff5 EgtGeomKernel :
- piccole modifiche di stile.
2021-07-27 15:20:38 +02:00
LorenzoM e1bfa954ff Merge commit '038142a6d78d7d16086a7ea604e0c0a94dc221f5' into LorenzoM 2021-07-23 11:03:04 +02:00
LorenzoM 9c4118209e Modifiche asportazioni volumi avanzate 2021-07-23 09:03:28 +02:00
LorenzoM a2325a266f Modifiche ad asportazioni avanzate 2021-07-22 12:52:30 +02:00
DarioS 038142a6d7 EgtGeomKernel 2.3g3 :
- aggiustamenti e ricompilazione per seconda proprietà temporanea degli oggetti geometrici.
2021-07-21 16:44:28 +02:00
LorenzoM 26424252f9 Aggiunta una seconda tempProp a oggetti vari 2021-07-21 12:50:58 +02:00
LorenzoM 6b6b30437f Modifiche varie 2021-07-21 09:31:46 +02:00
LorenzoM c6768c8efe Merge remote-tracking branch 'origin/HEAD' into LorenzoM 2021-07-20 14:29:32 +02:00
LorenzoM a58f188228 Asportazioni avanzate volumi virtual milling 2021-07-20 14:12:26 +02:00
LorenzoM d3f3a7c769 Migliorie PolyLine 2021-07-05 18:58:26 +02:00
LorenzoM a093894c72 Merge commit '03815d7747d9a9742a9b2c644ebc174848e47342' into LorenzoM 2021-06-30 16:12:43 +02:00
LorenzoM 5393cc1535 Correzione Delaunay 2021-06-30 16:07:06 +02:00
LorenzoM f86db281a1 Merge commit '3932cf07e56d30bae0af61e5095a21d731af8742' into LorenzoM 2021-06-30 11:10:48 +02:00
LorenzoM dc17c648dc Migliorie in polyline e split parti triangolabili 2021-06-25 17:10:15 +02:00
LorenzoM 111880573c Controllo in aggiunta punti e correzioni varie 2021-06-23 16:15:31 +02:00
LorenzoM 992c358bff Aggiunto controllo sulla non degenerazione dei triangoli nella triangolazione 2021-06-11 09:24:27 +02:00
LorenzoM ec0bc55078 Merge remote-tracking branch 'origin/master' into LorenzoM 2021-06-07 09:18:27 +02:00
LorenzoM f93583c624 Correzione trim linea con poligono esteso 2021-05-24 13:04:20 +02:00
LorenzoM 13064cc829 Correzione errori in trim linea con poligono 2021-05-21 18:10:19 +02:00
LorenzoM 561e444661 Aggiunta classificazione linea rispetto a un poligono esteso 2021-05-20 17:49:25 +02:00
LorenzoM e5a45021fa Merge remote-tracking branch 'origin/master' into LorenzoM 2021-05-14 17:34:36 +02:00
LorenzoM 576459dd5f Fix loop infiniti 2021-05-14 17:34:23 +02:00
LorenzoM f13661c0bd Divisione di rettangoli lunghi 2021-05-12 18:03:16 +02:00
LorenzoM 341495ed9d Modifiche ritriangolazione facce 2021-05-03 16:15:35 +02:00
LorenzoM 1789586556 Miglioramento in routine di ritriangolazione facce 2021-04-30 17:45:25 +02:00
LorenzoM 43233528f2 Migliorato algoritmo di divisione delle facce 2021-04-29 15:02:39 +02:00
LorenzoM ec51c51c54 Miglioramento gestione facce complanari 2021-04-28 16:59:26 +02:00
LorenzoM 2d6804215d Miglioramento gestione facce complanari 2021-04-28 13:07:26 +02:00
LorenzoM c56e573ae3 Miglioramento gestione facce complanari 2021-04-27 15:26:49 +02:00
LorenzoM c5e8a5753b Miglioramento gestione contatti edge-edge 2021-04-26 15:03:38 +02:00
LorenzoM 8db33f941b Miglioratagestione dellefacce complanari 2021-04-23 17:54:58 +02:00
LorenzoM b0be7306a9 Migliorata gestione facce complanari 2021-04-23 14:32:38 +02:00
47 changed files with 6554 additions and 1700 deletions
+5 -2
View File
@@ -59,8 +59,10 @@ class ArcApproxer
//----------------------------------------------------------------------------
CurveArc::CurveArc( void)
: m_nStatus( TO_VERIFY), m_PtCen(), m_VtN(), m_VtS(), m_dRad(),
m_dAngCenDeg(), m_dDeltaN(), m_VtExtr(), m_dThick(), m_nTempProp()
m_dAngCenDeg(), m_dDeltaN(), m_VtExtr(), m_dThick()
{
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
}
//----------------------------------------------------------------------------
@@ -578,7 +580,8 @@ CurveArc::CopyFrom( const CurveArc& caSrc)
return true ;
m_VtExtr = caSrc.m_VtExtr ;
m_dThick = caSrc.m_dThick ;
m_nTempProp = caSrc.m_nTempProp ;
m_nTempProp[0] = caSrc.m_nTempProp[0] ;
m_nTempProp[1] = caSrc.m_nTempProp[1] ;
return Set( caSrc.m_PtCen, caSrc.m_VtN, caSrc.m_dRad,
caSrc.m_VtS, caSrc.m_dAngCenDeg, caSrc.m_dDeltaN) ;
}
+6 -5
View File
@@ -49,10 +49,11 @@ class CurveArc : public ICurveArc, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd = 0) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd = 0) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // ICurve
bool IsSimple( void) const override
@@ -211,7 +212,7 @@ class CurveArc : public ICurveArc, public IGeoObjRW
double m_dDeltaN ; // variazione di quota lungo VtN della fine rispetto all'inizio
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
double m_dThick ; // spessore
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore proprietà temporanee
} ;
//-----------------------------------------------------------------------------
+5 -2
View File
@@ -45,8 +45,10 @@ GEOOBJ_REGISTER( CRV_BEZIER, NGE_C_BEZ, CurveBezier) ;
//----------------------------------------------------------------------------
CurveBezier::CurveBezier( void)
: m_nStatus( TO_VERIFY), m_nDeg(), m_bRat( false), m_dParSing( -2),
m_VtExtr(), m_dThick(), m_nTempProp()
m_VtExtr(), m_dThick()
{
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
}
//----------------------------------------------------------------------------
@@ -283,7 +285,8 @@ CurveBezier::CopyFrom( const CurveBezier& cbSrc)
m_vWeCtrl = cbSrc.m_vWeCtrl ;
m_VtExtr = cbSrc.m_VtExtr ;
m_dThick = cbSrc.m_dThick ;
m_nTempProp = cbSrc.m_nTempProp ;
m_nTempProp[0] = cbSrc.m_nTempProp[0] ;
m_nTempProp[1] = cbSrc.m_nTempProp[1] ;
return true ;
}
+6 -5
View File
@@ -51,10 +51,11 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd = 0) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd = 0) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // ICurve
bool IsSimple( void) const override { return true ; }
@@ -189,7 +190,7 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
DBLVECTOR m_vWeCtrl ; // vettore dei pesi di controllo
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
double m_dThick ; // spessore
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore proprietà temporanee
} ;
//-----------------------------------------------------------------------------
+13 -8
View File
@@ -40,8 +40,10 @@ GEOOBJ_REGISTER( CRV_COMPO, NGE_C_CMP, CurveComposite) ;
//----------------------------------------------------------------------------
CurveComposite::CurveComposite( void)
: m_nStatus( TO_VERIFY), m_VtExtr(), m_dThick(), m_ptStart(), m_nTempProp(), m_Iter( m_CrvSmplS.end())
: m_nStatus( TO_VERIFY), m_VtExtr(), m_dThick(), m_ptStart(), m_Iter( m_CrvSmplS.end())
{
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
}
//----------------------------------------------------------------------------
@@ -63,7 +65,8 @@ CurveComposite::Clear( void)
m_VtExtr = V_NULL ;
m_dThick = 0 ;
m_ptStart = ORIG ;
m_nTempProp = 0 ;
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
m_Iter = m_CrvSmplS.end() ;
// imposto ricalcolo della grafica
@@ -541,7 +544,8 @@ CurveComposite::CopyFrom( const CurveComposite& ccSrc)
Clear() ;
m_VtExtr = ccSrc.m_VtExtr ;
m_dThick = ccSrc.m_dThick ;
m_nTempProp = ccSrc.m_nTempProp ;
m_nTempProp[0] = ccSrc.m_nTempProp[0] ;
m_nTempProp[1] = ccSrc.m_nTempProp[1] ;
for ( auto& pCrv : ccSrc.m_CrvSmplS) {
if ( ! AddCurve( *pCrv))
return false ;
@@ -558,7 +562,8 @@ CurveComposite::RelocateFrom( CurveComposite& ccSrc)
Clear() ;
m_VtExtr = ccSrc.m_VtExtr ;
m_dThick = ccSrc.m_dThick ;
m_nTempProp = ccSrc.m_nTempProp ;
m_nTempProp[0] = ccSrc.m_nTempProp[0] ;
m_nTempProp[1] = ccSrc.m_nTempProp[1] ;
for ( ICurve* pCrv = ccSrc.RemoveFirstOrLastCurve( false) ;
pCrv != nullptr ;
pCrv = ccSrc.RemoveFirstOrLastCurve( false)) {
@@ -3243,7 +3248,7 @@ CurveComposite::IsACircle( double dLinTol, Point3d& ptCen, Vector3d& vtN, double
//----------------------------------------------------------------------------
bool
CurveComposite::SetCurveTempProp( int nCrv, int nProp)
CurveComposite::SetCurveTempProp( int nCrv, int nProp, int nPropNum)
{
// la curva deve essere validata
if ( m_nStatus != OK)
@@ -3252,13 +3257,13 @@ CurveComposite::SetCurveTempProp( int nCrv, int nProp)
if ( nCrv < 0 || nCrv >= int( m_CrvSmplS.size()))
return false ;
// eseguo assegnazione
m_CrvSmplS[nCrv]->SetTempProp( nProp) ;
m_CrvSmplS[nCrv]->SetTempProp( nProp, nPropNum) ;
return true ;
}
//----------------------------------------------------------------------------
bool
CurveComposite::GetCurveTempProp( int nCrv, int& nProp) const
CurveComposite::GetCurveTempProp( int nCrv, int& nProp, int nPropNum) const
{
// la curva deve essere validata
if ( m_nStatus != OK)
@@ -3267,6 +3272,6 @@ CurveComposite::GetCurveTempProp( int nCrv, int& nProp) const
if ( nCrv < 0 || nCrv >= int( m_CrvSmplS.size()))
return false ;
// eseguo recupero
nProp = m_CrvSmplS[nCrv]->GetTempProp() ;
nProp = m_CrvSmplS[nCrv]->GetTempProp( nPropNum) ;
return true ;
}
+8 -7
View File
@@ -50,10 +50,11 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd = 0) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd = 0) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // ICurve
bool IsSimple( void) const override
@@ -158,8 +159,8 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
bool IsAPoint( void) const override ;
bool IsALine( double dLinTol, Point3d& ptStart, Point3d& ptEnd) const override ;
bool IsACircle( double dLinTol, Point3d& ptCen, Vector3d& vtN, double& dRad, bool& bCCW) const override ;
bool SetCurveTempProp( int nCrv, int nProp) override ;
bool GetCurveTempProp( int nCrv, int& nProp) const override ;
bool SetCurveTempProp( int nCrv, int nProp, int nPropNum = 0) override ;
bool GetCurveTempProp( int nCrv, int& nProp, int nPropNum = 0) const override ;
public : // IGeoObjRW
int GetNgeId( void) const override ;
@@ -202,7 +203,7 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
double m_dThick ; // spessore
Point3d m_ptStart ; // punto iniziale per composita vuota per Add di linee o archi
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore proprietà temporanee
mutable PCSD_CONST_ITER m_Iter ; // iteratore
} ;
+5 -2
View File
@@ -29,8 +29,10 @@ GEOOBJ_REGISTER( CRV_LINE, NGE_C_LIN, CurveLine) ;
//----------------------------------------------------------------------------
CurveLine::CurveLine( void)
: m_nStatus( TO_VERIFY), m_PtStart(), m_PtEnd(), m_VtExtr(), m_dThick(), m_nTempProp()
: m_nStatus( TO_VERIFY), m_PtStart(), m_PtEnd(), m_VtExtr(), m_dThick()
{
m_nTempProp[0] = 0 ;
m_nTempProp[0] = 0 ;
}
//----------------------------------------------------------------------------
@@ -123,7 +125,8 @@ CurveLine::CopyFrom( const CurveLine& clSrc)
return true ;
m_VtExtr = clSrc.m_VtExtr ;
m_dThick = clSrc.m_dThick ;
m_nTempProp = clSrc.m_nTempProp ;
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
return Set( clSrc.m_PtStart, clSrc.m_PtEnd) ;
}
+6 -5
View File
@@ -49,10 +49,11 @@ class CurveLine : public ICurveLine, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd = 0) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd = 0) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // ICurve
bool IsSimple( void) const override
@@ -164,7 +165,7 @@ class CurveLine : public ICurveLine, public IGeoObjRW
Point3d m_PtEnd ; // punto finale
Vector3d m_VtExtr ; // vettore estrusione
double m_dThick ; // spessore
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore proprietà temporanee
} ;
//-----------------------------------------------------------------------------
BIN
View File
Binary file not shown.
+7 -12
View File
@@ -51,7 +51,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>ClangCL</PlatformToolset>
@@ -86,6 +86,7 @@
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
<IncludePath>C:\;$(IncludePath)</IncludePath>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>$(ProjectName)R$(PlatformArchitecture)</TargetName>
@@ -101,6 +102,7 @@
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
<IncludePath>C:\;$(IncludePath)</IncludePath>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@@ -114,7 +116,6 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnablePREfast>false</EnablePREfast>
<AdditionalIncludeDirectories>\EgtDev\Extern\GeometricToolsEngine</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -149,7 +150,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>\EgtDev\Extern\GeometricToolsEngine</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -196,7 +197,6 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>\EgtDev\Extern\GeometricToolsEngine</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -239,10 +239,10 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<OmitFramePointers>true</OmitFramePointers>
<FloatingPointModel>Precise</FloatingPointModel>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<WholeProgramOptimization>false</WholeProgramOptimization>
<DebugInformationFormat>None</DebugInformationFormat>
<AdditionalIncludeDirectories>\EgtDev\Extern\GeometricToolsEngine</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -366,12 +366,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="IntersCurveCurve.cpp" />
<ClCompile Include="IntersLineArc.cpp" />
<ClCompile Include="IntersLineLine.cpp" />
<ClCompile Include="IntersLinePlane.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="IntersLinePlane.cpp" />
<ClCompile Include="IntersLineSurfTm.cpp" />
<ClCompile Include="IntersLineTria.cpp" />
<ClCompile Include="Intervals.cpp" />
+7 -13
View File
@@ -46,12 +46,6 @@
<Filter Include="File di origine\GeoCollision">
<UniqueIdentifier>{865b76ee-b10d-41fc-861c-b48ce52fa277}</UniqueIdentifier>
</Filter>
<Filter Include="File di intestazione\tpp">
<UniqueIdentifier>{9596e38a-8880-4ab5-bd65-e1db39c92ac5}</UniqueIdentifier>
</Filter>
<Filter Include="File di origine\tpp">
<UniqueIdentifier>{636e60fa-4b24-4a7b-b2e9-74e1c1e8fb31}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Vector3d.cpp">
@@ -460,10 +454,10 @@
<Filter>File di origine\GeoCollision</Filter>
</ClCompile>
<ClCompile Include="tpp_assert.cpp">
<Filter>File di origine\tpp</Filter>
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="tpp_impl.cpp">
<Filter>File di origine\tpp</Filter>
<Filter>File di origine</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
@@ -1089,19 +1083,19 @@
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="dpoint.hpp">
<Filter>File di intestazione\tpp</Filter>
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="tpp_assert.hpp">
<Filter>File di intestazione\tpp</Filter>
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="tpp_interface.hpp">
<Filter>File di intestazione\tpp</Filter>
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="triangle.h">
<Filter>File di intestazione\tpp</Filter>
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="triangle_impl.hpp">
<Filter>File di intestazione\tpp</Filter>
<Filter>File di intestazione</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
+4 -1
View File
@@ -49,6 +49,8 @@ ExtDimension::ExtDimension( void)
: m_dExtLineLen( STD_EXTLINELEN), m_dArrowLen( STD_ARROWLEN), m_dTextDist( STD_TEXTDIST),
m_bLenIsMM( true), m_nDecDigit( STD_DECDIGIT), m_sFont( STD_FONT), m_dTextHeight( STD_TEXTHEIGHT)
{
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
}
//----------------------------------------------------------------------------
@@ -186,7 +188,8 @@ ExtDimension::CopyFrom( const ExtDimension& clSrc)
m_nDecDigit = clSrc.m_nDecDigit ;
m_sFont = clSrc.m_sFont ;
m_dTextHeight = clSrc.m_dTextHeight ;
m_nTempProp = clSrc.m_nTempProp ;
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
return true ;
}
+6 -5
View File
@@ -50,10 +50,11 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd = 0) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd = 0) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // IExtDimension
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
@@ -148,5 +149,5 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
int m_nDecDigit ; // numero di cifre decimali
std::string m_sFont ; // font del testo
double m_dTextHeight ; // altezza del testo
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore proprietà temporanee
} ;
+5 -2
View File
@@ -35,8 +35,10 @@ GEOOBJ_REGISTER( EXT_TEXT, NGE_E_TXT, ExtText) ;
//----------------------------------------------------------------------------
ExtText::ExtText( void)
: m_pSTM( nullptr), m_bNoSTM( false), m_ptP(), m_vtN( 0, 0, 1), m_vtD( 1, 0, 0), m_sFont(),
m_nWeight( 400), m_bItalic( false), m_dHeight( 10), m_dRatio( 1), m_dAddAdvance( 0), m_nTempProp()
m_nWeight( 400), m_bItalic( false), m_dHeight( 10), m_dRatio( 1), m_dAddAdvance( 0)
{
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
}
//----------------------------------------------------------------------------
@@ -184,7 +186,8 @@ ExtText::CopyFrom( const ExtText& clSrc)
m_dRatio = clSrc.m_dRatio ;
m_dAddAdvance = clSrc.m_dAddAdvance ;
m_nInsPos = clSrc.m_nInsPos ;
m_nTempProp = clSrc.m_nTempProp ;
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
return true ;
}
+6 -5
View File
@@ -50,10 +50,11 @@ class ExtText : public IExtText, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd = 0) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd = 0) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // IExtText
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
@@ -143,5 +144,5 @@ class ExtText : public IExtText, public IGeoObjRW
double m_dRatio ; // rapporto tra larghezza e altezza
double m_dAddAdvance ; // avanzamento addizionale tra caratteri
int m_nInsPos ; // posizione del punto di inserimento rispetto al testo
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore proprietà temporanee
} ;
+559 -118
View File
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -32,8 +32,9 @@ using namespace std ;
//----------------------------------------------------------------------------
GdbObj::GdbObj( void)
: m_nId( GDB_ID_NULL), m_pAttribs( nullptr), m_pTxrData( nullptr), m_pUserObj( nullptr),
m_pSelPrev( nullptr), m_pSelNext( nullptr),
m_pGDB( nullptr), m_pNext( nullptr), m_pPrev( nullptr), m_pParent( nullptr)
m_pGDB( nullptr), m_pNext( nullptr), m_pPrev( nullptr), m_pParent( nullptr),
m_pSelNext( nullptr), m_pSelPrev( nullptr)
{
}
+1 -1
View File
@@ -49,7 +49,7 @@ const double BEZARC_ANG_CEN_MAX = 90 ;
//----------------- Costanti per superfici TriMesh ---------------------------
// tolleranza lineare standard
const double STM_STD_LIN_TOL = 0.1 ;
const double STM_STD_LIN_TOL = EPS_SMALL/*0.1*/ ;
// angolo limite per definire un edge che è contorno di poligono
const double STM_STD_BOUNDARY_ANG = 0.1 ;
// angolo limite per mediare le normali in un vertice
+5 -2
View File
@@ -29,8 +29,10 @@ GEOOBJ_REGISTER( GEO_FRAME3D, NGE_G_FRM, GeoFrame3d) ;
//----------------------------------------------------------------------------
GeoFrame3d::GeoFrame3d( void)
: m_frF(), m_nTempProp()
: m_frF()
{
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
}
//----------------------------------------------------------------------------
@@ -114,7 +116,8 @@ GeoFrame3d::CopyFrom( const GeoFrame3d& gfSrc)
{
if ( &gfSrc == this)
return true ;
m_nTempProp = gfSrc.m_nTempProp ;
m_nTempProp[0] = gfSrc.m_nTempProp[0] ;
m_nTempProp[1] = gfSrc.m_nTempProp[1] ;
return Set( gfSrc.m_frF) ;
}
+6 -5
View File
@@ -57,10 +57,11 @@ class GeoFrame3d : public IGeoFrame3d, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd = 0) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd = 0) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // IGeoFrame3d
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
@@ -95,5 +96,5 @@ class GeoFrame3d : public IGeoFrame3d, public IGeoObjRW
private :
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
Frame3d m_frF ; // oggetto
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore proprietà temporanee
} ;
+5 -2
View File
@@ -28,8 +28,10 @@ GEOOBJ_REGISTER( GEO_PNT3D, NGE_G_PNT, GeoPoint3d) ;
//----------------------------------------------------------------------------
GeoPoint3d::GeoPoint3d( void)
: m_ptP(), m_nTempProp()
: m_ptP()
{
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
}
//----------------------------------------------------------------------------
@@ -82,7 +84,8 @@ GeoPoint3d::CopyFrom( const GeoPoint3d& clSrc)
{
if ( &clSrc == this)
return true ;
m_nTempProp = clSrc.m_nTempProp ;
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
return Set( clSrc.m_ptP) ;
}
+6 -5
View File
@@ -57,10 +57,11 @@ class GeoPoint3d : public IGeoPoint3d, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd = 0) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd = 0) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // IGeoPoint3d
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
@@ -89,5 +90,5 @@ class GeoPoint3d : public IGeoPoint3d, public IGeoObjRW
private :
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
Point3d m_ptP ; // oggetto
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore proprietà temporanee
} ;
+5 -2
View File
@@ -29,8 +29,10 @@ GEOOBJ_REGISTER( GEO_VECT3D, NGE_G_VEC, GeoVector3d) ;
//----------------------------------------------------------------------------
GeoVector3d::GeoVector3d( void)
: m_vtV(), m_nTempProp()
: m_vtV()
{
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
}
//----------------------------------------------------------------------------
@@ -98,7 +100,8 @@ GeoVector3d::CopyFrom( const GeoVector3d& clSrc)
{
if ( &clSrc == this)
return true ;
m_nTempProp = clSrc.m_nTempProp ;
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
return Set( clSrc.m_vtV, clSrc.m_ptBase) ;
}
+6 -5
View File
@@ -65,10 +65,11 @@ class GeoVector3d : public IGeoVector3d, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd = 0) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd = 0) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // IGeoVector3d
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
@@ -104,5 +105,5 @@ class GeoVector3d : public IGeoVector3d, public IGeoObjRW
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
Vector3d m_vtV ; // oggetto
Point3d m_ptBase ; // punto base da cui tracciare il vettore
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore proprietà temporanee
} ;
+39 -13
View File
@@ -70,16 +70,23 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
Reset() ;
// verifico che la curva esista e sia piana
Plane3d plPlane ;
if ( pCrv == nullptr || ! pCrv->IsFlat( plPlane))
if ( pCrv == nullptr || ! pCrv->IsFlat( plPlane, false, 10 * EPS_SMALL))
return false ;
// se esiste estrusione, verifico sia perpendicolare al piano della curva
// recupero o assegno estrusione
Vector3d vtExtr ;
if ( pCrv->GetExtrusion( vtExtr) && ! vtExtr.IsSmall()) {
if ( ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), vtExtr))
return false ;
}
else
if ( ! pCrv->GetExtrusion( vtExtr) || vtExtr.IsSmall()) {
vtExtr = plPlane.GetVersN() ;
if ( vtExtr.IsZminus())
vtExtr.Invert() ;
}
// recupero normale al piano della curva
Vector3d vtNorm = plPlane.GetVersN() ;
if ( vtNorm * vtExtr < 0)
vtNorm.Invert() ;
// verifico che estrusione non sia troppo vicina al piano della curva (almeno 30 gradi di angolazione)
double dExtrOnN = vtExtr * vtNorm ;
if ( dExtrOnN < 0.5)
return false ;
// recupero spessore
double dThick ;
pCrv->GetThickness( dThick) ;
@@ -102,6 +109,9 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
// determino se necessario cambiare riferimento ( dal vettore estrusione)
bool bNeedRef = ( ! vtExtr.IsZplus()) ;
// determino se necessario effettuare scalatura
bool bNeedScale = ( abs( dExtrOnN) < cos( 0.1 * DEGTORAD)) ;
// creo una copia della curva
CurveComposite ccCopy ;
if ( ! ccCopy.CopyFrom( pCrv))
@@ -109,13 +119,23 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
ccCopy.SetExtrusion( vtExtr) ;
// se necessario cambio il riferimento
Frame3d frExtr ;
if ( bNeedRef) {
Frame3d frCopy ;
if ( bNeedScale) {
// calcolo il riferimento con vtNorm come asse Z e componente di vtExtr perpendicolare a vtNorm come asse X
if ( ! frCopy.Set( ORIG, vtNorm, vtExtr - dExtrOnN * vtNorm))
return false ;
ccCopy.SetExtrusion( vtNorm) ;
// esprimo la curva in questo riferimento
ccCopy.ToLoc( frCopy) ;
// scalo lungo l'asse X locale
ccCopy.Scale( GLOB_FRM, dExtrOnN, 1, 1) ;
}
else if ( bNeedRef) {
// calcolo il riferimento OCS con VtExtr come asse Z
if ( ! frExtr.Set( ORIG, vtExtr))
if ( ! frCopy.Set( ORIG, vtExtr))
return false ;
// esprimo la curva in questo riferimento
ccCopy.ToLoc( frExtr) ;
ccCopy.ToLoc( frCopy) ;
}
// verifico che la curva sia fatta solo da rette e archi che giacciono nel piano XY (VtExtr è ora Z+)
@@ -601,9 +621,15 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
}
// riporto il risultato nel riferimento originale
if ( bNeedRef) {
if ( bNeedScale) {
for ( auto pCrv : m_CrvLst) {
pCrv->Scale( GLOB_FRM, 1 / dExtrOnN, 1, 1) ;
pCrv->ToGlob( frCopy) ;
}
}
else if ( bNeedRef) {
for ( auto pCrv : m_CrvLst)
pCrv->ToGlob( frExtr) ;
pCrv->ToGlob( frCopy) ;
}
// assegno estrusione e spessore come curva originale
+69 -66
View File
@@ -19,11 +19,11 @@
#include "PolygonPlane.h"
#include "PointsPCA.h"
#include "GeoConst.h"
#include "/EgtDev/Include/EGkPolygon3d.h"
#include "/EgtDev/Include/EGkPolyLine.h"
#include "/EgtDev/Include/EGkPlane3d.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkPolygon3d.h"
#include "/EgtDev/Include/EGtNumUtils.h"
using namespace std ;
@@ -55,7 +55,7 @@ PolyLine::AddUPoint( double dPar, const Point3d& ptP, bool bEndOrStart)
{
// se da aggiungere in coda
if ( bEndOrStart) {
// se il punto è uguale all'ultimo (ignoro parametro), non lo inserisco ma ok
// se il punto uguale all'ultimo (ignoro parametro), non lo inserisco ma ok
if ( m_lUPoints.size() > 0 && AreSamePointApprox( ptP, m_lUPoints.back().first)) {
++ m_nRejected ;
return true ;
@@ -70,7 +70,7 @@ PolyLine::AddUPoint( double dPar, const Point3d& ptP, bool bEndOrStart)
}
// altrimenti si aggiunge in testa
else {
// se il punto è uguale al primo (ignoro parametro), non lo inserisco ma ok
// se il punto uguale al primo (ignoro parametro), non lo inserisco ma ok
if ( m_lUPoints.size() > 0 && AreSamePointApprox( ptP, m_lUPoints.front().first)) {
++ m_nRejected ;
return true ;
@@ -94,7 +94,7 @@ PolyLine::Close( void)
// ci devono essere almeno 2 punti
if ( m_lUPoints.size() < 2)
return false ;
// verifico non sia già chiuso
// verifico non sia gi chiuso
if ( AreSamePointApprox( m_lUPoints.front().first, m_lUPoints.back().first))
return false ;
// aggiungo un punto uguale al primo in coda
@@ -229,7 +229,7 @@ PolyLine::ToLoc( const Frame3d& frRef)
bool
PolyLine::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
{
// se i due riferimenti coincidono, non devo fare alcunché
// se i due riferimenti coincidono, non devo fare alcunch
if ( AreSameFrame( frOri, frDest))
return true ;
// ciclo sui punti
@@ -244,7 +244,7 @@ PolyLine::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
bool
PolyLine::Join( PolyLine& PL, double dOffsetPar)
{
// se l'altra polilinea non contiene alcunchè, esco con ok
// se l'altra polilinea non contiene alcunch, esco con ok
if ( PL.m_lUPoints.size() == 0)
return true ;
// verifico che l'ultimo punto di questa polilinea coincida con il primo dell'altra
@@ -396,7 +396,7 @@ PolyLine::GetPrevUPoint( double* pdPar, Point3d* pptP, bool bNotFirst) const
bool
PolyLine::GetCurrUPoint( double* pdPar, Point3d* pptP) const
{
// verifico validità punto corrente
// verifico validit punto corrente
if ( m_iter == m_lUPoints.end())
return false ;
@@ -437,7 +437,7 @@ PolyLine::GetFirstULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d*
bool
PolyLine::GetNextULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) const
{
// parametro e punto iniziali (è il precedente finale)
// parametro e punto iniziali ( il precedente finale)
if ( m_iter == m_lUPoints.end())
return false ;
if ( pdIni != nullptr)
@@ -518,19 +518,19 @@ PolyLine::IsFlat( int& nRank, Point3d& ptCen, Vector3d& vtDir, double dToler) co
PointsPCA ptsPCA ;
for ( bool bFound = GetFirstLine( ptP1, ptP2) ; bFound ; bFound = GetNextLine( ptP1, ptP2))
ptsPCA.AddPoint( Media( ptP1, ptP2), Dist( ptP1, ptP2)) ;
// recupero il rango, ovvero la dimensionalità dell'insieme di punti
// recupero il rango, ovvero la dimensionalit dell'insieme di punti
nRank = ptsPCA.GetRank() ;
// se dimensione nulla, o non ci sono punti o sono tutti praticamente coincidenti
if ( nRank == 0)
return ptsPCA.GetCenter( ptCen) ;
// se dimensione 1, allora i punti sono distribuiti su una linea
if ( nRank == 1) {
// assegno il centro e la direzione della linea (il verso è indifferente)
// assegno il centro e la direzione della linea (il verso indifferente)
ptsPCA.GetCenter( ptCen) ;
ptsPCA.GetPrincipalComponent( 0, vtDir) ;
return true ;
}
// altrimenti dimensione 2 o 3, allora è determinato un piano principale, verifico se tutti i punti vi giacciono
// altrimenti dimensione 2 o 3, allora determinato un piano principale, verifico se tutti i punti vi giacciono
// Center and normal vector
ptsPCA.GetCenter( ptCen) ;
Vector3d vtX, vtY ;
@@ -538,9 +538,9 @@ PolyLine::IsFlat( int& nRank, Point3d& ptCen, Vector3d& vtDir, double dToler) co
ptsPCA.GetPrincipalComponent( 1, vtY) ;
vtDir = vtX ^ vtY ;
if ( ! vtDir.Normalize()) {
// riduco la dimensionalità a lineare
// riduco la dimensionalit a lineare
nRank = 1 ;
// assegno il centro e la direzione della linea (il verso è indifferente)
// assegno il centro e la direzione della linea (il verso indifferente)
ptsPCA.GetCenter( ptCen) ;
vtDir = vtX ;
return true ;
@@ -569,12 +569,12 @@ PolyLine::IsFlat( Plane3d& plPlane, double dToler) const
plPlane.Reset() ;
return false ;
}
// recupero dati sulla planarità della polilinea
// recupero dati sulla planarit della polilinea
int nRank ;
Point3d ptCen ;
Vector3d vtDir ;
bool bFlat = IsFlat( nRank, ptCen, vtDir, dToler) ;
// imposto il piano a seconda della dimensionalità
// imposto il piano a seconda della dimensionalit
switch ( nRank) {
case 0 : // punto
plPlane.Set( ptCen, Z_AX) ;
@@ -645,7 +645,7 @@ PolyLine::GetAreaXY( double& dArea) const
// verifico sia chiusa
if ( ! IsClosed())
return false ;
// calcolo l'area considerando solo XY (è la Z di Newell)
// calcolo l'area considerando solo XY ( la Z di Newell)
dArea = 0 ;
Point3d ptIni, ptFin ;
for ( bool bFound = GetFirstLine( ptIni, ptFin) ; bFound ; bFound = GetNextLine( ptIni, ptFin)) {
@@ -779,10 +779,10 @@ PolyLine::RemoveAlignedPoints( double dToler)
}
// se curva chiusa con almeno 4 punti, devo analizzare il terzetto attorno alla chiusura
if ( IsClosed() && m_lUPoints.size() >= 4) {
// precP e currP sono già corretti
// precP e currP sono gi corretti
// il primo punto ripete l'ultimo (geometricamente coincide con currP)
auto firstP = m_lUPoints.begin() ;
// questo è il vero successivo
// questo il vero successivo
nextP = next( firstP) ;
// distanza del punto corrente dal segmento che unisce gli adiacenti
DistPointLine dPL( currP->first, precP->first, nextP->first) ;
@@ -833,7 +833,7 @@ PolyLine::MyChangeStart( int nPos)
return false ;
// cancello ultimo punto ( coincide con primo)
m_lUPoints.pop_back() ;
// sposto la metà iniziale dei punti alla fine
// sposto la met iniziale dei punti alla fine
for ( int i = 0 ; i < nPos ; ++ i)
m_lUPoints.splice( m_lUPoints.end(), m_lUPoints, m_lUPoints.begin()) ;
// aggiungo punto finale come copia dell'iniziale
@@ -938,7 +938,7 @@ PolyLine::MyApproxOnSide( const Vector3d& vtN, bool bLeftSide, double dToler)
}
}
}
// non è stato eliminato alcunché
// non stato eliminato alcunch
// ripristino la tolleranza corrente
dCurrToler = dToler ;
// avanzo il terzetto di uno step
@@ -979,7 +979,7 @@ PolyLine::MakeConvex( const Vector3d& vtN, bool bLeftSide)
bool
PolyLine::MyMakeConvex( const Vector3d& vtN, bool bLeftSide)
{
// ciclo i controlli finchè non ci sono rimozioni
// ciclo i controlli finch non ci sono rimozioni
bool bRemoved = true ;
while ( bRemoved) {
bRemoved = false ;
@@ -1007,7 +1007,7 @@ PolyLine::MyMakeConvex( const Vector3d& vtN, bool bLeftSide)
bRemoved = true ;
continue ;
}
// non è stato eliminato alcunché : avanzo il terzetto di uno step
// non stato eliminato alcunch : avanzo il terzetto di uno step
precP = currP ;
currP = nextP ;
++ nextP ;
@@ -1034,7 +1034,7 @@ PolyLine::Invert( bool bInvertU)
m_lUPoints.reverse() ;
// se richiesto, inverto anche il parametro U
if ( bInvertU) {
// recupero il primo valore di U che è il vecchio finale ed è il riferimento di inversione
// recupero il primo valore di U che il vecchio finale ed il riferimento di inversione
double dUfin = m_lUPoints.front().second ;
// ciclo su tutti gli elementi
for ( auto& UPoint : m_lUPoints) {
@@ -1249,7 +1249,7 @@ PolyLine::GetMinAreaRectangleXY( Point3d& ptCen, Vector3d& vtAx, double& dLen, d
bool
PolyLine::Trim( const Plane3d& plPlane, bool bInVsOut)
{
// se vuota non faccio alcunché
// se vuota non faccio alcunch
if ( m_lUPoints.size() == 0)
return false ;
@@ -1299,14 +1299,13 @@ PolyLine::Trim( const Plane3d& plPlane, bool bInVsOut)
return true ;
}
//----------------------------------------------------------------------------
/*static*/ bool
ChangePolyLineStart( const Point3d& ptNewStart, PolyLine& Loop, double dTol)
bool
PolyLine::ChangePolyLineStart( const Point3d& ptNewStart, double dTol)
{
// Rinomino la lista di punti della PolyLine.
PNTULIST& LoopList = Loop.GetUPointList() ;
// Ciclo sui segmenti del loop per cercare il tratto del loop chiuso più vicino al punto.
PNTULIST& LoopList = GetUPointList() ;
// Ciclo sui segmenti del loop per cercare il tratto del loop chiuso pi vicino al punto.
double dMinSqDist = DBL_MAX ;
auto itMinDist = LoopList.end() ;
auto itSt = LoopList.begin() ;
@@ -1356,18 +1355,18 @@ ChangePolyLineStart( const Point3d& ptNewStart, PolyLine& Loop, double dTol)
LoopList.erase( itNewStart) ;
}
}
return true ;
}
//----------------------------------------------------------------------------
// nSegNum 0-based
/*static*/ bool
PointPositionOnPolyLine( const Point3d& ptPoint, /*const*/ PolyLine& Loop, int& nSegNum, double& dParOnSeg, double dTol)
bool
PolyLine::PointPositionOnPolyLine( const Point3d& ptPoint, int& nSegNum, double& dParOnSeg, double dTol) const
{
// Rinomino la lista di punti della PolyLine.
/*const*/ PNTULIST& LoopList = Loop.GetUPointList() ;
// Ciclo sui segmenti del loop per cercare il tratto del loop chiuso più vicino al punto.
const PNTULIST& LoopList = GetUPointList() ;
// Ciclo sui segmenti del loop per cercare il tratto del loop chiuso pi vicino al punto.
nSegNum = - 1 ;
double dMinSqDist = DBL_MAX ;
int nS = 0 ;
@@ -1405,16 +1404,15 @@ PointPositionOnPolyLine( const Point3d& ptPoint, /*const*/ PolyLine& Loop, int&
}
//----------------------------------------------------------------------------
/*static*/ bool
IsPointInsidePolyLine( const Point3d& ptP, const PolyLine& plPoly)
bool
PolyLine::IsPointInsidePolyLine( const Point3d& ptP) const
{
// Se la PolyLine non è chiusa, il punto non può essere interno.
if ( ! plPoly.IsClosed())
// Se la PolyLine non chiusa, il punto non pu essere interno.
if ( ! IsClosed())
return false ;
// Lista dei punti
PolyLine& MyPlPoly = const_cast< PolyLine&>( plPoly) ;
const PNTULIST& List = MyPlPoly.GetUPointList() ;
// Ciclo sui segmenti della PolyLine per cercarne il tratto più vicino al punto.
const PNTULIST& List = GetUPointList() ;
// Ciclo sui segmenti della PolyLine per cercarne il tratto pi vicino al punto.
double dMinSqDist = DBL_MAX ;
Point3d ptMinDist ;
auto itMinDistSt = List.end() ;
@@ -1458,7 +1456,7 @@ IsPointInsidePolyLine( const Point3d& ptP, const PolyLine& plPoly)
Vector3d vtTan = itMinDistEn->first - itMinDistSt->first ;
vtTan.Normalize() ;
Polygon3d AuxPolygon ;
AuxPolygon.FromPolyLine( plPoly) ;
AuxPolygon.FromPolyLine( *this) ;
Vector3d vtPolyNorm = AuxPolygon.GetVersN() ;
Vector3d vtPrevOut = vtPrevTan ^ vtPolyNorm ;
Vector3d vtOut = vtTan ^ vtPolyNorm ;
@@ -1488,7 +1486,7 @@ IsPointInsidePolyLine( const Point3d& ptP, const PolyLine& plPoly)
Vector3d vtNextTan = itNextEn->first - itMinDistEn->first ;
vtNextTan.Normalize() ;
Polygon3d AuxPolygon ;
AuxPolygon.FromPolyLine( plPoly) ;
AuxPolygon.FromPolyLine( *this) ;
Vector3d vtPolyNorm = AuxPolygon.GetVersN() ;
Vector3d vtOut = vtTan ^ vtPolyNorm ;
Vector3d vtNextOut = vtNextTan ^ vtPolyNorm ;
@@ -1511,7 +1509,7 @@ IsPointInsidePolyLine( const Point3d& ptP, const PolyLine& plPoly)
Vector3d vtTan = itMinDistEn->first - itMinDistSt->first ;
vtTan.Normalize() ;
Polygon3d AuxPolygon ;
AuxPolygon.FromPolyLine( plPoly) ;
AuxPolygon.FromPolyLine( *this) ;
Vector3d vtPolyNorm = AuxPolygon.GetVersN() ;
Vector3d vtOut = vtTan ^ vtPolyNorm ;
vtP -= ( vtP * vtTan) * vtTan ;
@@ -1523,13 +1521,13 @@ IsPointInsidePolyLine( const Point3d& ptP, const PolyLine& plPoly)
//----------------------------------------------------------------------------
bool
DistPointPolyLine( const Point3d& ptP, const PolyLine& plPoly, double& dPointPolyLineDist)
PolyLine::DistPointPolyLine( const Point3d& ptP, double& dPointPolyLineDist) const
{
if ( plPoly.GetPointNbr() == 0)
if ( GetPointNbr() == 0)
return false ;
dPointPolyLineDist = DBL_MAX ;
Point3d ptSt, ptEn ;
bool bContinue = plPoly.GetFirstPoint( ptSt) && plPoly.GetNextPoint( ptEn) ;
bool bContinue = GetFirstPoint( ptSt) && GetNextPoint( ptEn) ;
while ( bContinue) {
double dPoinLineDist ;
DistPointLine PointLineDistCalc( ptP, ptSt, ptEn) ;
@@ -1537,18 +1535,18 @@ DistPointPolyLine( const Point3d& ptP, const PolyLine& plPoly, double& dPointPol
if ( dPoinLineDist < dPointPolyLineDist)
dPointPolyLineDist = dPoinLineDist ;
ptSt = ptEn ;
bContinue = plPoly.GetNextPoint( ptEn) ;
bContinue = GetNextPoint( ptEn) ;
}
return true ;
}
//----------------------------------------------------------------------------
/*static*/ bool
SplitPolyLineAtPoint( const Point3d& ptPoint, /*const*/ PolyLine& Loop, PolyLine& Loop1, PolyLine& Loop2, double dTol)
bool
PolyLine::SplitPolyLineAtPoint( const Point3d& ptPoint, PolyLine& Loop1, PolyLine& Loop2, double dTol) const
{
// Rinomino la lista di punti della PolyLine.
/*const*/ PNTULIST& LoopList = Loop.GetUPointList() ;
// Ciclo sui segmenti del loop per cercare il tratto del loop chiuso più vicino al punto.
const PNTULIST& LoopList = GetUPointList() ;
// Ciclo sui segmenti del loop per cercare il tratto del loop chiuso pi vicino al punto.
double dMinSqDist = DBL_MAX ;
auto itMinDistSt = LoopList.end() ;
auto itSt = LoopList.begin() ;
@@ -1571,7 +1569,8 @@ SplitPolyLineAtPoint( const Point3d& ptPoint, /*const*/ PolyLine& Loop, PolyLine
if ( dMinSqDist > dTol * dTol)
return false ;
// Se il punto di stop sta su un vertice non devo aggiungerlo e il
// punto di stop sarà uno degli estremi del segmento su cui giace.
// punto di stop sar uno degli estremi del segmento su cui giace.
bool bPointOnEnd = false ;
auto itStop = itMinDistSt ;
auto itNext = itMinDistSt ;
++ itNext ;
@@ -1580,7 +1579,8 @@ SplitPolyLineAtPoint( const Point3d& ptPoint, /*const*/ PolyLine& Loop, PolyLine
else if ( AreSamePointApprox( ptPoint, itNext->first))
itStop = itNext ;
else {
itStop = LoopList.emplace( itNext, ptPoint, 0.) ;
bPointOnEnd = true ;
itStop = itNext ;
}
// Creo i due loop
PNTULIST& LoopList1 = Loop1.GetUPointList() ;
@@ -1588,7 +1588,10 @@ SplitPolyLineAtPoint( const Point3d& ptPoint, /*const*/ PolyLine& Loop, PolyLine
for ( auto it = LoopList.begin() ; it != itStop ; ++ it) {
LoopList1.emplace_back( it->first, it->second) ;
}
LoopList1.emplace_back( itStop->first, itStop->second) ;
LoopList1.emplace_back( ptPoint, 0) ;
if ( bPointOnEnd) {
LoopList2.emplace_back( ptPoint, 0) ;
}
for ( auto it = itStop ; it != LoopList.end() ; ++ it) {
LoopList2.emplace_back( it->first, it->second) ;
}
@@ -1596,28 +1599,28 @@ SplitPolyLineAtPoint( const Point3d& ptPoint, /*const*/ PolyLine& Loop, PolyLine
}
//----------------------------------------------------------------------------
/*static*/ bool
AddPolyLineToPolyLine( PolyLine& Poly, PolyLine& PolyToAdd, double dTol)
bool
PolyLine::AddPolyLineToPolyLine( PolyLine& PolyToAdd, double dTol)
{
// Se la PolyLine a cui devo aggiungere l'altra è chiusa, non posso aggiungere nulla.
if ( Poly.IsClosed())
// Se la PolyLine a cui devo aggiungere l'altra chiusa, non posso aggiungere nulla.
if ( IsClosed())
return false ;
// Se la PolyLina che devo aggiungere è vuota, ho finito.
// Se la PolyLina che devo aggiungere vuota, ho finito.
PNTULIST& PolyToAddList = PolyToAdd.GetUPointList() ;
if ( int( PolyToAddList.size()) == 0)
return true ;
// Se Poly non è vuota e la sua fine non coincide con l'inizio di PolyToAdd, non è possibile aggiungere nulla.
// Se Poly non vuota e la sua fine non coincide con l'inizio di PolyToAdd, non possibile aggiungere nulla.
Point3d ptLast ;
Poly.GetLastPoint( ptLast) ;
GetLastPoint( ptLast) ;
auto it = PolyToAddList.begin() ;
if ( Poly.GetPointNbr() != 0 && ! AreSamePointEpsilon( it->first, ptLast, dTol))
if ( GetPointNbr() != 0 && ! AreSamePointEpsilon( it->first, ptLast, dTol))
return false ;
/*if ( Poly.GetPointNbr() == 0)
Poly.AddUPoint( 0., it->first) ;
Poly.AddUPoint( 0., it->first) ;
++ it ;*/
// Aggiungo i punti.
for ( ; it != PolyToAddList.end() ; ++ it) {
Poly.AddUPoint( 0., it->first) ;
AddUPoint( 0., it->first) ;
}
return true ;
}
+46 -10
View File
@@ -17,6 +17,7 @@
#include "CurveArc.h"
#include "CurveComposite.h"
#include "SurfFlatRegion.h"
#include "AdjustLoops.h"
#include "GeoConst.h"
#include "/EgtDev/Include/EgkPolyLine.h"
#include "/EgtDev/Include/EgkBiArcs.h"
@@ -278,13 +279,34 @@ GetSurfFlatRegionFromFatCurve( ICurve* pCrv, double dRadius, bool bSquareEnds, b
//----------------------------------------------------------------------------
ISurfFlatRegion*
GetSurfFlatRegionFromPolyLine( const PolyLine& ContourPolyLine)
GetSurfFlatRegionFromTriangle( const Triangle3d& Tria)
{
// Creo la regione.
PtrOwner<SurfFlatRegion> pSfr( CreateBasicSurfFlatRegion()) ;
if ( IsNull( pSfr))
return nullptr ;
// Creo curva composita.
// Creo curva composita.
PtrOwner<CurveComposite> pLoop( CreateBasicCurveComposite()) ;
if ( IsNull( pLoop))
return nullptr ;
if ( ! pLoop->AddPoint( Tria.GetP( 0)) ||
! pLoop->AddLine( Tria.GetP( 1)) ||
! pLoop->AddLine( Tria.GetP( 2)) ||
! pLoop->Close())
return nullptr ;
pSfr->AddExtLoop( Release( pLoop)) ;
return Release( pSfr) ;
}
//----------------------------------------------------------------------------
ISurfFlatRegion*
GetSurfFlatRegionFromPolyLine( const PolyLine& ContourPolyLine)
{
// Creo la regione.
PtrOwner<SurfFlatRegion> pSfr( CreateBasicSurfFlatRegion()) ;
if ( IsNull( pSfr))
return nullptr ;
// Creo curva composita.
PtrOwner<CurveComposite> pLoop( CreateBasicCurveComposite()) ;
if ( IsNull( pLoop))
return nullptr ;
@@ -306,13 +328,13 @@ GetSurfFlatRegionFromPolyLine( const PolyLine& ContourPolyLine)
ISurfFlatRegion*
GetSurfFlatRegionFromPolyLineVector( const POLYLINEVECTOR& vContoursPolyLineVec)
{
// Creo la regione.
// Creo la regione.
PtrOwner<SurfFlatRegion> pSfr( CreateBasicSurfFlatRegion()) ;
if ( IsNull( pSfr))
return nullptr ;
// Ciclo sulle PolyLine.
// Ciclo sulle PolyLine.
for ( int nL = 0 ; nL < int( vContoursPolyLineVec.size()) ; ++ nL) {
// Creo curva composita.
// Creo curva composita.
PtrOwner<CurveComposite> pLoop( CreateBasicCurveComposite()) ;
if ( IsNull( pLoop))
return nullptr ;
@@ -326,11 +348,11 @@ GetSurfFlatRegionFromPolyLineVector( const POLYLINEVECTOR& vContoursPolyLineVec)
ptSt = ptEn ;
bContinue = vContoursPolyLineVec[nL].GetNextPoint( ptEn) ;
}
// Loop esterno
// Loop esterno
if ( nL == 0) {
pSfr->AddExtLoop( Release( pLoop)) ;
}
// Loop interno
// Loop interno
else {
pSfr->AddIntLoop( Release( pLoop)) ;
}
@@ -363,8 +385,20 @@ SurfFlatRegionByContours::AddCurve( ICurve* pCrv)
// verifico sia chiusa
if ( ! pMyCrv->IsClosed())
return false ;
// la inserisco nel vettore delle curve
m_vpCrv.push_back( Release( pMyCrv)) ;
// verifico sia piana e imposto estrusione come normale al piano
double dArea ;
Plane3d plPlane ;
if ( ! pMyCrv->GetArea( plPlane, dArea))
return false ;
pMyCrv->SetExtrusion( plPlane.GetVersN()) ;
pMyCrv->SetThickness( 0) ;
// rimuovo eventuali sovrapposizioni (calcolate nel suo piano)
ICURVEPLIST CrvLst ;
if ( ! AdjustLoops( Release( pMyCrv), CrvLst))
return false ;
// la/le inserisco nel vettore delle curve
for ( auto& pSingCrv : CrvLst)
m_vpCrv.push_back( pSingCrv) ;
return true ;
}
@@ -418,6 +452,7 @@ SurfFlatRegionByContours::GetSurf( void)
if ( IsNull( pSfr))
return nullptr ;
// aggiungo le diverse curve
bool bExtLoop = false ;
bool bFirstCrv ;
do {
bFirstCrv = true ;
@@ -436,6 +471,7 @@ SurfFlatRegionByContours::GetSurf( void)
}
// provo a inserirla
if ( pSfr->AddExtLoop( Release( pCrv))) {
bExtLoop = true ;
bFirstCrv = false ;
delete m_vpCrv[j] ;
m_vpCrv[j] = nullptr ;
@@ -460,7 +496,7 @@ SurfFlatRegionByContours::GetSurf( void)
}
} while ( m_bAllowedMultiChunk && ! bFirstCrv) ;
// se non valida, errore
if ( ! pSfr->IsValid())
if ( ! bExtLoop || ! pSfr->IsValid())
return nullptr ;
// restituisco la superficie
return Release( pSfr) ;
+5 -2
View File
@@ -35,8 +35,10 @@ GEOOBJ_REGISTER( SRF_BEZIER, NGE_S_BEZ, SurfBezier) ;
//----------------------------------------------------------------------------
SurfBezier::SurfBezier(void)
: m_pSTM( nullptr), m_nStatus( TO_VERIFY), m_nDegU(), m_nDegV(), m_nSpanU(), m_nSpanV(), m_bRat( false),
m_bTrimmed( false), m_pTrimReg( nullptr), m_nTempProp( 0)
m_bTrimmed( false), m_pTrimReg( nullptr)
{
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
}
//----------------------------------------------------------------------------
@@ -566,7 +568,8 @@ SurfBezier::CopyFrom( const SurfBezier& sbSrc)
m_vPtCtrl = sbSrc.m_vPtCtrl ;
if ( sbSrc.m_bRat)
m_vWeCtrl = sbSrc.m_vWeCtrl ;
m_nTempProp = sbSrc.m_nTempProp ;
m_nTempProp[0] = sbSrc.m_nTempProp[0] ;
m_nTempProp[1] = sbSrc.m_nTempProp[1] ;
return true ;
}
+6 -5
View File
@@ -53,10 +53,11 @@ class SurfBezier : public ISurfBezier, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // ISurf
bool IsSimple( void) const override
@@ -165,7 +166,7 @@ class SurfBezier : public ISurfBezier, public IGeoObjRW
PNTVECTOR m_vPtCtrl ; // vettore dei punti di controllo
DBLVECTOR m_vWeCtrl ; // vettore dei pesi di controllo
SurfFlatRegion* m_pTrimReg ; // eventuale regione di trim
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore proprietà temporanee
} ;
//-----------------------------------------------------------------------------
+7 -3
View File
@@ -33,8 +33,10 @@ GEOOBJ_REGISTER( SRF_FLATRGN, NGE_S_FRG, SurfFlatRegion) ;
//----------------------------------------------------------------------------
SurfFlatRegion::SurfFlatRegion( void)
: m_pSTM( nullptr), m_nStatus( TO_VERIFY), m_nTempProp()
: m_pSTM( nullptr), m_nStatus( TO_VERIFY)
{
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
}
//----------------------------------------------------------------------------
@@ -55,7 +57,8 @@ SurfFlatRegion::Clear( void)
delete pLoop ;
m_vpLoop.clear() ;
m_nTempProp = 0 ;
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
@@ -397,7 +400,8 @@ SurfFlatRegion::CopyFrom( const SurfFlatRegion& sfrSrc)
m_vpLoop.push_back( pCrv) ;
}
m_vExtInd = sfrSrc.m_vExtInd ;
m_nTempProp = sfrSrc.m_nTempProp ;
m_nTempProp[0] = sfrSrc.m_nTempProp[0] ;
m_nTempProp[1] = sfrSrc.m_nTempProp[1] ;
m_nStatus = sfrSrc.m_nStatus ;
return ( m_nStatus == OK && ! m_vpLoop.empty()) ;
}
+6 -5
View File
@@ -51,10 +51,11 @@ class SurfFlatRegion : public ISurfFlatRegion, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd = 0) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd = 0) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // ISurf
bool IsSimple( void) const override
@@ -144,7 +145,7 @@ class SurfFlatRegion : public ISurfFlatRegion, public IGeoObjRW
Frame3d m_frF ; // riferimento intrinseco
PCRV_DEQUE m_vpLoop ; // deque delle curve che formano i loop
INTVECTOR m_vExtInd ; // indice dei loop esterni nel precedente vettore
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore proprietà temporanee
} ;
//-----------------------------------------------------------------------------
+3
View File
@@ -27,6 +27,9 @@ SurfFlatRegion::Offset( double dDist, int nType)
int nChunk = GetChunkCount() ;
if ( nChunk == 0)
return false ;
// se offset nullo, non devo fare alcunché
if ( abs( dDist) < 10 * EPS_SMALL)
return true ;
// creo una nuova regione
PtrOwner<SurfFlatRegion> pSfr( new( nothrow) SurfFlatRegion) ;
if ( IsNull( pSfr))
+284 -103
View File
File diff suppressed because it is too large Load Diff
+33 -14
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2019
// EgalTech 2014-2021
//----------------------------------------------------------------------------
// File : SurfTriMesh.h Data : 12.02.19 Versione : 2.1b2
// File : SurfTriMesh.h Data : 26.09.21 Versione : 2.3i2
// Contenuto : Dichiarazione della classe Superficie TriMesh.
//
//
@@ -18,6 +18,7 @@
#include "GeoObjRW.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkHashGrids3d.h"
#include "/EgtDev/Include/EGkPointGrid3d.h"
#include <deque>
#include <set>
@@ -133,6 +134,10 @@ typedef std::vector<LineFacetClass> LineFacetClassVector ;
//----------------------------------------------------------------------------
enum FacetPlaneIntersType { FPI_ERROR = 0, FPI_CUT = 1, FPI_INN = 2, FPI_OUT = 3, FPI_ON = 4 } ;
//----------------------------------------------------------------------------
enum LineClassificationWithExtPolygon { LCP_ERROR = 0, LCP_INN = 1, LCP_OUT = 2, LCP_OVERLAP = 3 } ;
//----------------------------------------------------------------------------
// Definizione strutture e contenitori
// Contatti interno-interno
@@ -206,10 +211,11 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd = 0) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd = 0) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // ISurf
bool IsSimple( void) const override
@@ -225,7 +231,7 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
bool Init( int nNumVert, int nNumTria, int nNumFacet = 0) override ;
void SetLinearTolerance( double dLinTol) override
{ m_dLinTol = std::max( dLinTol, EPS_SMALL) ; }
{ m_dLinTol = EPS_SMALL/*std::max( dLinTol, EPS_SMALL)*/ ; } ///////////////////////////////////////////////////////////////
void SetBoundaryAngle( double dBoundaryAngDeg) override
{ m_dBoundaryAng = std::max( dBoundaryAngDeg, EPS_ANG_SMALL) ;
m_dCosBndAng = cos( m_dBoundaryAng * DEGTORAD) ;
@@ -248,7 +254,7 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
bool CreateByScrewing( const PolyLine& PL, const Point3d& ptAx, const Vector3d& vtAx,
double dAngRot, double dStepRot, double dMove) override ;
bool DoCompacting( double dTol = EPS_SMALL) override ;
bool DoSewing( const ISurfTriMesh& stmOther, const Frame3d& frOther = GLOB_FRM) override ;
bool DoSewing( const ISurfTriMesh& stmOther, const Frame3d& frOther = GLOB_FRM, double dTol = 2 * EPS_SMALL) override ;
int GetVertexCount( void) const override ;
int GetTriangleCount( void) const override ;
int GetTriangleCount( int nTFlag) const override ;
@@ -277,7 +283,7 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
bool GetTriangleBoundaryEdges( int nId, TriFlags3d& TFlags) const override ;
bool GetTriangleSmoothNormals( int nId, TriNormals3d& TNrms) const override ;
bool GetLoops( POLYLINEVECTOR& vPL) const override ;
bool GetSilhouette( const Vector3d& vtDir, POLYLINEVECTOR& vPL) const override ;
bool GetSilhouette( const Vector3d& vtDir, double dTol, POLYLINEVECTOR& vPL) const override ;
int GetFacetCount( void) const override ;
int GetFacetSize( void) const override
{ return int( m_vFacet.size()) ; }
@@ -379,6 +385,8 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
bool MarchOneFacetTria( int nF, int& nT, int& nV, int nTimeStamp, PolyLine& PL, bool& bEnd) const ;
void ResetHashGrids3d( void) const ;
bool VerifyHashGrids3d( void) const ;
void ResetPointGrid3d( void) const ;
bool VerifyPointGrid3d( void) const ;
bool VerifyConnection( void) const ;
bool DecomposeLoop( CHAINVECTOR& cvOpenChain, INTVECTOR& vnDegVec, PNTMATRIX& cvBoundClosedLoopVec, BOOLVECTOR& vbInOut) ;
bool RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECTORMAP& Ambiguos, SurfTriMesh& Surf, bool& bModif) ;
@@ -386,10 +394,12 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
bool IntersectTriMeshTriangle( SurfTriMesh& Other) ;
int IntersFacetPlane( const SurfFlatRegion& Region, const PolyLine& ExtLoop, const Plane3d& plCutPlane,
LineFacetClassVector& IntersLinePart) ;
int IntersFacetPlane( const POLYLINEVECTOR& vFacetLoopsVec, const Plane3d& plCutPlane,
LineFacetClassVector& IntersLinePart) ;
bool IntersFacetFacet( const SurfFlatRegion& RegionA, const PolyLine& ExtLoopA,
const SurfFlatRegion& RegionB, const PolyLine& ExtLoopB,
LineFacetClassVector& IntersLinePart) ;
bool ItersectTriMeshFacets( SurfTriMesh& Other) ;
bool IntersectTriMeshFacets( SurfTriMesh& Other) ;
bool RetriangulateFacetPieces( const PieceMap& NewFacet,
const INTERSEDGEMAP& EdgeInterLineMap,
const INTERSEDGEMAP& EdgeEdgeLineMap) ;
@@ -415,20 +425,29 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
double m_dCosBndAng ; // coseno dell'angolo limite per considerare un lato un contorno
double m_dSmoothAng ; // angolo limite per mediare le normali (in gradi)
double m_dCosSmAng ; // coseno dell'angolo limite per mediare le normali
bool m_bOriented ; // la superficie è orientata consistentemente in tutte le sue parti
bool m_bOriented ; // la superficie orientata consistentemente in tutte le sue parti
bool m_bClosed ; // la superficie racchiude un volume
bool m_bFaceted ; // flag di validità della sfaccettatura
bool m_bFaceted ; // flag di validit della sfaccettatura
VERTVECTOR m_vVert ; // vettore dei vertici
TRIAVECTOR m_vTria ; // vettore dei triangoli
INTVECTOR m_vFacet ; // vettore delle sfaccettature
mutable int m_nTimeStamp ; // orologio locale
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore propriet temporanee
int m_nMaxTFlag ; // massimo valore dei TFlag dei triangoli
mutable int m_nParts ; // numero di parti connesse (-1 se da calcolare)
mutable HashGrids3d* m_pHGrd3d ; // Hash Grid 3d nel suo riferimento
mutable BBox3d m_b3HGrd3d ; // Box3d collegato a Hash Grid 3d
mutable BBox3d m_b3HGrd3d ; // Box3d collegato a Hash Grid 3d
mutable PointGrid3d* m_pPGrd3d ; // Point Grid 3d nel suo riferimento
} ;
//----------------------------------------------------------------------------
//static bool ChangePolyLineStart( const Point3d& ptNewStart, PolyLine& Loop) ;
//// nSegNum 0-based
//static bool PointPositionOnPolyLine( const Point3d& ptPoint, /*const*/ PolyLine& Loop, int& nSegNum, double& dParOnSeg) ;
//static bool IsPointInsidePolyLine( const Point3d& ptP, /*const*/ PolyLine& plPoly) ;
//static bool SplitPolyLineAtPoint( const Point3d& ptPoint, /*const*/ PolyLine& Loop, PolyLine& Loop1, PolyLine& Loop2) ;
//static bool AddPolyLineToPolyLine(PolyLine& Poly, PolyLine& PolyToAdd) ;
//-----------------------------------------------------------------------------
inline SurfTriMesh* CreateBasicSurfTriMesh( void)
{ return ( static_cast<SurfTriMesh*>( CreateGeoObj( SRF_TRIMESH))) ; }
+1002 -384
View File
File diff suppressed because it is too large Load Diff
+4 -3
View File
@@ -114,7 +114,7 @@ SurfTriMesh::UpdateTriaFaceting( int nRefT, int nFacet, const Plane3d& plPlane,
}
if ( nV == SVT_NULL)
return false ;
double dTol = max( min( m_dLinTol, 20 * EPS_SMALL), 2 * EPS_SMALL) ;
double dTol = max( min( m_dLinTol, 20 * EPS_SMALL), /*2 **/ EPS_SMALL) ; ////////////////////////////////////////////////////
if ( ! PointInPlaneEpsilon( m_vVert[m_vTria[nT].nIdVert[nV]].ptP, plPlane, dTol))
return true ;
// il triangolo fa parte della faccia
@@ -413,7 +413,7 @@ SurfTriMesh::GetFacetLoops( int nF, POLYLINEVECTOR& vPL) const
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
Plane3d plPlane ;
double dArea ;
if ( ! vPL[i].IsClosedAndFlat( plPlane, dArea, 100 * EPS_SMALL))
if ( ! vPL[i].IsClosedAndFlat( plPlane, dArea, /*100 **/ EPS_SMALL))
return false ;
// se loop esterno
if ( vtN * plPlane.GetVersN() > 0) {
@@ -712,9 +712,10 @@ SurfTriMesh::RemoveFacet( int nF)
if ( ! DoCompacting())
return false ;
// dichiaro necessità ricalcolo della grafica e di hashgrids3d
// dichiaro necessità ricalcolo della grafica e di hashgrids3d e pointgrid3d
m_OGrMgr.Reset() ;
ResetHashGrids3d() ;
ResetPointGrid3d() ;
return true ;
}
+188 -21
View File
@@ -27,9 +27,10 @@ using namespace std ;
//----------------------------------------------------------------------------
Tool::Tool( bool bApproxWithLines)
: m_dLinTol( LIN_TOL_STD), m_dAngTolDeg( ANG_TOL_APPROX_DEG), m_nType( UNDEF), m_nCurrentNum( 0), m_dHeight( 0), m_dTipHeight( 0),
m_dRadius( 0), m_dRCorner( 0), m_dTipRadius( 0), m_dRefRadius( 0), m_dCutterHeight( 0), m_dMrtChsWidth( 0), m_dMrtChsThickness( 0),
m_bApproxWithLines( bApproxWithLines)
: m_bApproxWithLines( bApproxWithLines), m_dLinTol( LIN_TOL_STD), m_dAngTolDeg( ANG_TOL_APPROX_DEG),
m_nType( UNDEF), m_nCurrentNum( 0), m_dHeight( 0), m_dTipHeight( 0), m_dRadius( 0), m_dRCorner( 0),
m_dTipRadius( 0), m_dRefRadius( 0), m_dCutterHeight( 0), m_dMrtChsWidth( 0), m_dMrtChsThickness( 0)/*,
m_bAllPartCut( true)*/
{
}
@@ -73,6 +74,10 @@ Tool::SetTolerances( double dLinTol, double dAngTolDeg)
bool
Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR, double dCutterH, int nToolNum)
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// Per test additivi //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//return SetAdditiveTool( sToolName, dH, dR, dCornR, nToolNum) ;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Impostazioni generali
m_sName = sToolName ;
m_nCurrentNum = nToolNum ;
@@ -100,9 +105,13 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR,
Point3d pt3( m_dRadius, - m_dHeight, 0) ;
Point3d pt4( 0, - m_dHeight, 0) ;
m_Outline.AddPoint( pt0) ;
m_Outline.AddLine( pt1);
m_Outline.AddLine( pt1) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt3) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddLine( pt4) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
}
// utensile naso di toro
else if ( dCornR < dR - EPS_SMALL) {
@@ -120,10 +129,15 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR,
Point3d pt3( m_dTipRadius, - m_dHeight, 0) ;
Point3d pt4( 0, - m_dHeight, 0) ;
m_Outline.AddPoint( pt0) ;
m_Outline.AddLine( pt1);
m_Outline.AddLine( pt2);
m_Outline.AddLine( pt1) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt2) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddArcTg( pt3) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
m_Outline.AddLine( pt4) ;
m_Outline.SetCurveTempProp( 3, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
// se da approosimare
if ( m_bApproxWithLines)
return SetGenTool( sToolName, &m_Outline, nToolNum) ;
@@ -143,9 +157,13 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR,
Point3d pt2( m_dRadius, - m_dHeight + m_dTipHeight, 0) ;
Point3d pt4( 0, - m_dHeight, 0) ;
m_Outline.AddPoint( pt0) ;
m_Outline.AddLine( pt1);
m_Outline.AddLine( pt2);
m_Outline.AddLine( pt1) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt2) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddArcTg( pt4) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
}
// impossibile
else
@@ -201,9 +219,14 @@ Tool::SetAdvTool( const string& sToolName, double dH, double dR,
// profilo
m_Outline.AddPoint( pt0) ;
m_Outline.AddLine( pt1) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt2) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddLine( Point3d( m_dTipRadius, - m_dHeight, 0)) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
m_Outline.AddLine( pt5) ;
m_Outline.SetCurveTempProp( 3, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
// eventuali sistemazioni per altezza tagliente
if ( ModifyForCutterHeight())
return SetGenTool( sToolName, &m_Outline, nToolNum) ;
@@ -213,7 +236,7 @@ Tool::SetAdvTool( const string& sToolName, double dH, double dR,
// Altrimenti utensile generico
// se Tip a punta ( TipRadius è raggio teorico della parte finale dell'utensile senza raccordo)
// se Tip a punta ( TipRadius raggio teorico della parte finale dell'utensile senza raccordo)
if ( m_dTipRadius < m_dRadius) {
// se punta a sfera
if ( m_dTipRadius < EPS_SMALL) {
@@ -242,10 +265,16 @@ Tool::SetAdvTool( const string& sToolName, double dH, double dR,
// creazione curva composita
m_Outline.AddPoint( pt0) ;
m_Outline.AddLine( pt1) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt2) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddLine( pt3) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
m_Outline.AddCurve( cvArc) ;
m_Outline.SetCurveTempProp( 3, 1, 1) ;
m_Outline.AddLine( pt5) ;
m_Outline.SetCurveTempProp( 4, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
}
// altrimenti punta a naso di toro
else {
@@ -271,16 +300,22 @@ Tool::SetAdvTool( const string& sToolName, double dH, double dR,
// creazione curva composita
m_Outline.AddPoint( pt0) ;
m_Outline.AddLine( pt1) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt2) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddLine( pt3) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
m_Outline.AddCurve( Release( pArc)) ;
m_Outline.SetCurveTempProp( 3, 1, 1) ;
m_Outline.AddLine( pt5) ;
m_Outline.SetCurveTempProp( 4, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
}
}
// altrimenti Tip a coda di rondine ( TipRadius è raggio misurabile della parte finale dell'utensile)
// altrimenti Tip a coda di rondine ( TipRadius raggio misurabile della parte finale dell'utensile)
else {
// il raggio della punta non può essere inferiore al raggio corner
// il raggio della punta non pu essere inferiore al raggio corner
if ( m_dTipRadius < m_dRCorner)
return false ;
// Assegno il raggio di riferimento
@@ -305,10 +340,16 @@ Tool::SetAdvTool( const string& sToolName, double dH, double dR,
// creazione curva composita
m_Outline.AddPoint( pt0) ;
m_Outline.AddLine( pt1) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt2) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddLine( pt3) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
m_Outline.AddCurve( cvArc) ;
m_Outline.SetCurveTempProp( 3, 1, 1) ;
m_Outline.AddLine( pt5) ;
m_Outline.SetCurveTempProp( 4, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
}
// eventuali sistemazioni per altezza tagliente
@@ -321,7 +362,7 @@ Tool::SetAdvTool( const string& sToolName, double dH, double dR,
bool
Tool::ModifyForCutterHeight( void)
{
// Se altezza tagliente non definita o superiore alla altezza utensile non devo fare alcunché
// Se altezza tagliente non definita o superiore alla altezza utensile non devo fare alcunch
if ( m_dCutterHeight < EPS_SMALL || m_dCutterHeight > m_dHeight - EPS_SMALL)
return false ;
// quota di taglio
@@ -340,6 +381,8 @@ Tool::ModifyForCutterHeight( void)
m_Outline.TrimStartAtParam( dU) ;
m_Outline.AddLine( Point3d( 0, dYtrim, 0), false) ;
m_Outline.AddLine( ORIG, false) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
return true ;
}
return false ;
@@ -375,22 +418,36 @@ Tool::SetSawTool( const string& sToolName, double dH, double dR,
// creazione profilo
m_Outline.AddPoint( pt0) ;
m_Outline.AddLine( pt1) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt2) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddLine( pt3) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
m_Outline.AddLine( pt4) ;
m_Outline.SetCurveTempProp( 3, 1, 1) ;
m_Outline.AddLine( pt5) ;
m_Outline.SetCurveTempProp( 4, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
}
// altrimenti con raggio corner
else {
// creazione profilo
m_Outline.AddPoint( pt0) ;
m_Outline.AddLine( pt1) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt2) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddLine( pt3 - X_AX * dCornR) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddArcTg( pt3 - Y_AX * dCornR) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
m_Outline.AddLine( pt4 + Y_AX * dCornR) ;
m_Outline.SetCurveTempProp( 3, 1, 1) ;
m_Outline.AddArcTg( pt4 - X_AX * dCornR) ;
m_Outline.SetCurveTempProp( 4, 1, 1) ;
m_Outline.AddLine( pt5) ;
m_Outline.SetCurveTempProp( 5, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
}
}
// altrimenti senza gambo
@@ -405,18 +462,28 @@ Tool::SetSawTool( const string& sToolName, double dH, double dR,
// creazione profilo
m_Outline.AddPoint( pt0) ;
m_Outline.AddLine( pt3) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt4) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt5) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
}
// altrimenti con raggio corner
else {
// creazione profilo
m_Outline.AddPoint( pt0) ;
m_Outline.AddLine( pt3 - X_AX * dCornR) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddArcTg( pt3 - Y_AX * dCornR) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt4 + Y_AX * dCornR) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddArcTg( pt4 - X_AX * dCornR) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( pt5) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
}
}
// Assegno il raggio di riferimento
@@ -436,17 +503,30 @@ Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline,
if ( pToolOutline != &m_Outline)
m_Outline.Clear() ;
m_ArcLineApprox.Clear() ;
// Copio il profilo e garantisco sia di soli archi e rette (converto eventuali curve di Bezier)
if ( ! m_Outline.CopyFrom( pToolOutline) ||
! m_Outline.ArcsBezierCurvesToArcsPerpExtr( m_dLinTol, m_dAngTolDeg))
return false ;
// Ciclo sulle curve componenti
// Valuto se tutte le curve tagliano
m_ArcLineApprox.SetTempProp( 1, 1) ;
const ICurve* pCurve = m_Outline.GetFirstCurve() ;
while ( pCurve != nullptr && m_ArcLineApprox.GetTempProp( 1) == 1) {
int nCutTempProp = pCurve->GetTempProp( 1) ;
if ( nCutTempProp == 0) {
m_ArcLineApprox.SetTempProp( 0, 1) ;
}
pCurve = m_Outline.GetNextCurve() ;
}
// Ciclo sulle curve componenti
pCurve = m_Outline.GetFirstCurve() ;
while ( pCurve != nullptr) {
// Se la curva è un arco ed è richiesto la verifica per l'approssimazione,
int nCutTempProp = pCurve->GetTempProp( 1) ;
// Se la curva un arco ed richiesto la verifica per l'approssimazione,
// verifico se approssimarlo
if ( m_bApproxWithLines && pCurve->GetType() == CRV_ARC) {
@@ -454,11 +534,11 @@ Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline,
Point3d ptO = GetBasicCurveArc( pCurve)->GetCenter() ;
double dRadius = GetBasicCurveArc( pCurve)->GetRadius() ;
// Se il centro è fuori dall'asse devo approssimare
// Se il centro fuori dall'asse devo approssimare
bool bCurrApprox = ( abs( ptO.x) > EPS_SMALL) ;
// Se una delle altre curve dista dal centro meno del raggio, devo approssimare
for ( int nI = 0 ; ! bCurrApprox && nI < m_Outline.GetCurveCount() ; ++ nI) {
for ( int nI = 0 ; ! bCurrApprox && nI < m_Outline.GetCurveCount() && m_ArcLineApprox.GetTempProp( 1) == 1 ; ++ nI) {
const ICurve* pOtherCrv = m_Outline.GetCurve( nI) ;
if ( pOtherCrv != pCurve) {
DistPointCurve CalcDist( ptO, *pOtherCrv) ;
@@ -493,6 +573,7 @@ Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline,
m_vArcNormals.emplace_back( vtExtN) ;
int nCvCount = m_ArcLineApprox.GetCurveCount() ;
m_ArcLineApprox.SetCurveTempProp( nCvCount - 1, int( m_vArcNormals.size()) - 1) ;
m_ArcLineApprox.SetCurveTempProp( nCvCount - 1, nCutTempProp, 1) ;
}
}
// altrimenti lo aggiungo semplicemente
@@ -500,16 +581,20 @@ Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline,
m_ArcLineApprox.AddCurve( *pCurve, true) ;
int nCvCount = m_ArcLineApprox.GetCurveCount() ;
m_ArcLineApprox.SetCurveTempProp( nCvCount - 1, - 1) ;
m_ArcLineApprox.SetCurveTempProp( nCvCount - 1, nCutTempProp, 1) ;
}
}
// altrimenti è segmento e lo aggiungo semplicemente
else
// altrimenti segmento e lo aggiungo semplicemente
else {
m_ArcLineApprox.AddCurve( *pCurve, true) ;
int nCvCount = m_ArcLineApprox.GetCurveCount() ;
m_ArcLineApprox.SetCurveTempProp( nCvCount - 1, nCutTempProp, 1) ;
}
pCurve = m_Outline.GetNextCurve() ;
}
// Il profilo dell'utensile deve stare nel 1° e 4° quadrante del piano XY
// Il profilo dell'utensile deve stare nel 1 e 4 quadrante del piano XY
BBox3d Bounding ;
m_Outline.GetLocalBBox( Bounding) ;
if ( Bounding.GetMin().x < - 10 * EPS_SMALL)
@@ -521,7 +606,7 @@ Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline,
// Assegno le dimensioni dell'utensile
m_dHeight = - Bounding.GetMin().y ;
m_dRadius = Bounding.GetMax().x ;
// Assegno il raggio di riferimento se non già assegnato
// Assegno il raggio di riferimento se non gi assegnato
if ( m_dRefRadius < EPS_SMALL)
m_dRefRadius = 0.25 * m_dRadius ;
@@ -579,3 +664,85 @@ Tool::SetChiselTool( const string& sToolName, double dH, double dW, double dTh,
return true ;
}
//----------------------------------------------------------------------------
bool
Tool::SetAdditiveTool( const std::string& sToolName, double dH, double dR, double dRC, int nToolNum)
{
// Impostazioni generali
m_sName = sToolName ;
m_nCurrentNum = nToolNum ;
m_nType = UNDEF ;
m_Outline.Clear() ;
m_ArcLineApprox.Clear() ;
// verifica sulle minime dimensioni globali
if ( dH < EPS_SMALL || dR < EPS_SMALL || dRC < - EPS_SMALL)
return false ;
m_nType = ADDITIVE ;
m_dHeight = dH ;
m_dRadius = dR ;
m_dRCorner = dRC ;
m_dTipHeight = 0 ;
m_dTipRadius = 0 ;
m_dRefRadius = 0 ;
m_dCutterHeight = dH ;
double dSquareCornerRadProj = m_dRCorner * m_dRCorner - 0.25 * m_dHeight * m_dHeight ;
// Utensile sfiancato
if ( dSquareCornerRadProj > 0) {
double dCenX = m_dRadius - m_dRCorner ;
double dCylRad = dCenX + sqrt( dSquareCornerRadProj) ;
// Utensile mal definito
if ( dCylRad < 0)
return false ;
// Profilo
m_Outline.AddPoint( Point3d( 0, 0, 0)) ;
m_Outline.AddLine( Point3d( dCylRad, 0, 0)) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
CurveArc cvArc ;
cvArc.SetC2P( Point3d( dCenX, - 0.5 * m_dHeight, 0), Point3d( dCylRad, 0, 0), Point3d( dCylRad, - m_dHeight, 0)) ;
m_Outline.AddCurve( cvArc) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddLine( Point3d( 0, - m_dHeight, 0)) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
}
// Utensile cilindrico con eventuale raggio corner
else {
// Utensile mal definito
if ( m_dRadius - m_dRCorner < EPS_SMALL)
return false ;
// Raggio corner nullo
if ( m_dRadius < EPS_SMALL) {
// Profilo
m_Outline.AddPoint( Point3d( 0, 0, 0)) ;
m_Outline.AddLine( Point3d( m_dRadius, 0, 0)) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
m_Outline.AddLine( Point3d( m_dRadius, - m_dHeight, 0)) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddLine( Point3d( 0, - m_dHeight, 0)) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
}
else {
// Profilo
m_Outline.AddPoint( Point3d( 0, 0, 0)) ;
m_Outline.AddLine( Point3d( m_dRadius - m_dRCorner, 0, 0)) ;
m_Outline.SetCurveTempProp( 0, 1, 1) ;
CurveArc cvArc ;
cvArc.SetC2P( Point3d( m_dRadius - m_dRCorner, - m_dRCorner, 0), Point3d( m_dRadius - m_dRCorner, 0, 0), Point3d( m_dRadius, - m_dRCorner, 0)) ;
m_Outline.SetCurveTempProp( 1, 1, 1) ;
m_Outline.AddLine( Point3d( m_dRadius, - m_dHeight + m_dRCorner, 0)) ;
m_Outline.SetCurveTempProp( 2, 1, 1) ;
cvArc.SetC2P( Point3d( m_dRadius - m_dRCorner, - m_dHeight + m_dRCorner, 0), Point3d( m_dRadius, - m_dHeight + m_dRCorner, 0), Point3d( m_dRadius - m_dRCorner, - m_dHeight, 0)) ;
m_Outline.AddCurve( cvArc) ;
m_Outline.SetCurveTempProp( 3, 1, 1) ;
m_Outline.AddLine( Point3d( 0, - m_dHeight, 0)) ;
m_Outline.SetCurveTempProp( 4, 1, 1) ;
m_Outline.SetTempProp( 1, 1) ;
}
}
return SetGenTool( sToolName, &m_Outline, nToolNum) ;
}
+7 -2
View File
@@ -16,7 +16,7 @@
#include "CurveComposite.h"
//----------------------------------------------------------------------------
class Tool
class Tool
{
public :
Tool( bool bApproxWithLines = false) ;
@@ -33,6 +33,7 @@ class Tool
bool SetGenTool( const std::string& sToolName, const ICurveComposite* pToolOutline, int nToolNum) ;
bool SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc, int nToolNum) ;
bool SetChiselTool( const std::string& sToolName, double dH, double dW, double dTh, int nToolNum) ;
bool SetAdditiveTool( const std::string& sToolName, double dH, double dR, double dRC, int nToolNum) ;
bool SetToolNum( int nToolNum)
{ m_nCurrentNum = nToolNum ; return true ; }
int GetType() const
@@ -61,6 +62,8 @@ class Tool
{ return ( m_ArcLineApprox.GetCurveCount() == 0 ? m_Outline : m_ArcLineApprox) ; }
const VCT3DVECTOR& GetArcNormalVec( void) const
{ return m_vArcNormals ; }
bool GetCuttingFlag() const
{ /*return m_bAllPartCut ;*/ return ( m_nType == GEN ? m_ArcLineApprox.GetTempProp( 1) == 1 : true ) ; }
public :
enum ToolType { UNDEF = 0, // Utensile indefinito
@@ -70,13 +73,15 @@ class Tool
BULLNOSEMILL = 4, // Naso di toro
CONEMILL = 5, // Con parte terminale conica
MORTISER = 6, // Mortasatrice
CHISEL = 7} ; // Scalpello
CHISEL = 7, // Scalpello
ADDITIVE = 8} ; // Additivo
private :
bool ModifyForCutterHeight( void) ;
private :
bool m_bApproxWithLines ;
//bool m_bAllPartCut ;
double m_dLinTol ;
double m_dAngTolDeg ;
std::string m_sName ;
+49 -264
View File
@@ -12,6 +12,14 @@
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
//#include "stdafx.h"
//#include "DllMain.h"
//#include "Triangulate.h"
//#include "ProjPlane.h"
//#include "/EgtDev/Include/EGkPolyLine.h"
//#include "/EgtDev/Include/EGkPlane3d.h"
//#include "/EgtDev/Include/EGkStringUtils3d.h"
//#include <algorithm>
#include "stdafx.h"
#include "DllMain.h"
#include "Triangulate.h"
@@ -23,14 +31,14 @@
#include "/EgtDev/Include/EGkPolyLine.h"
#include "/EgtDev/Include/EGkPlane3d.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "Mathematics/TriangulateCDT.h"
#include <algorithm>
#include "tpp_interface.hpp"
#include <algorithm>
using namespace std ;
using namespace tpp ;
using namespace gte ;
//----------------------------------------------------------------------------
enum EarStatus{ EAS_NULL = -1, EAS_NO = 0, EAS_OK = 1} ;
@@ -46,7 +54,7 @@ static bool ChangeStartPntVector( int nNewStart, PNTVECTOR& vPi) ;
bool
Triangulate::Make( const PolyLine& PL, PNTVECTOR& vPt, INTVECTOR& vTr, TrgType trgType)
{
// verifico che la polilinea sia chiusa e piana e calcolo il piano medio del poligono
// verifico che la polilinea sia chiusa e piana e calcolo il piano medio del poligono
double dArea ;
Plane3d plPlane ;
if ( ! PL.IsClosedAndFlat( plPlane, dArea, 50 * EPS_SMALL))
@@ -55,11 +63,11 @@ Triangulate::Make( const PolyLine& PL, PNTVECTOR& vPt, INTVECTOR& vTr, TrgType t
if ( trgType != TRG_STANDARD)
return Make( POLYLINEVECTOR{ PL}, vPt, vTr, trgType) ;
// determino il piano ottimale di proiezione e il relativo senso di rotazione
// determino il piano ottimale di proiezione e il relativo senso di rotazione
bool bCCW ;
if ( ! CalcProjPlane( plPlane.GetVersN(), m_nPlane, bCCW))
return false ;
// riempio il vettore con i vertici del poligono da triangolare
// riempio il vettore con i vertici del poligono da triangolare
vPt.clear() ;
vPt.reserve( PL.GetPointNbr() - 1) ;
// salto il primo punto (coincide con l'ultimo)
@@ -69,24 +77,24 @@ Triangulate::Make( const PolyLine& PL, PNTVECTOR& vPt, INTVECTOR& vTr, TrgType t
// inserisco i punti
while ( PL.GetNextPoint( ptP))
vPt.push_back( ptP) ;
// se non CCW inverto il vettore dei punti
// se non CCW inverto il vettore dei punti
if ( ! bCCW)
reverse( vPt.begin(), vPt.end()) ;
// creo il vettore degli indici del Poligono
// creo il vettore degli indici del Poligono
INTVECTOR vPol ;
int n = int( vPt.size()) ;
vPol.reserve( n) ;
for ( int i = 0 ; i < n ; ++ i)
vPol.push_back( i) ;
// eseguo la triangolazione
// eseguo la triangolazione
if ( ! MakeByEC2( vPt, vPol, vTr) &&
! MakeByEC3( vPt, vPol, vTr)) {
! MakeByEC3( vPt, vPol, vTr)) {
LOG_ERROR( GetEGkLogger(), "Error in MakeByEC23(1)")
return false ;
return false ;
}
// se era CW, devo invertire il senso dei triangoli
// se era CW, devo invertire il senso dei triangoli
if ( ! bCCW)
reverse( vTr.begin(), vTr.end()) ;
@@ -95,12 +103,13 @@ Triangulate::Make( const PolyLine& PL, PNTVECTOR& vPt, INTVECTOR& vTr, TrgType t
//----------------------------------------------------------------------------
// In : POLYLINEVECTOR : vector of polylines, the first outer, the others inner
// trgType : triangulation type
// Out : PNTVECTOR (Point3d Vector) : points of the polyline
// INTVECTOR (int Vector) : 3*T indices of above points for T triangles
//----------------------------------------------------------------------------
bool
Triangulate::Make( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr, TrgType trgType)
{
{
// pulisco i vettori di ritorno
vPt.clear() ;
vTr.clear() ;
@@ -108,7 +117,7 @@ Triangulate::Make( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr, Tr
if ( &vPL == nullptr || vPL.empty())
return false ;
// se una sola polilinea mi riconduco al caso precedente
if ( vPL.size() == 1)
if ( vPL.size() == 1 && trgType == TRG_STANDARD)
return Make( vPL[0], vPt, vTr) ;
// verifico che la polilinea esterna sia chiusa e piana e calcolo il piano medio del poligono
double dArea ;
@@ -151,13 +160,6 @@ Triangulate::Make( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr, Tr
}
return true ;
}
else if ( trgType == TRG_DEL_GTE) {
if ( ! MakeByDelaunayGTE( vPL, vPt, vTr)) {
LOG_ERROR( GetEGkLogger(), "Error in MakeByDelaunay ( Geometric Tools Engine)") ;
return false ;
}
return true ;
}
// ear clipping
// se non CCW inverto tutte le polilinee
@@ -217,7 +219,7 @@ Triangulate::Make( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr, Tr
INTVECTOR vPol ;
int n = int( vPt.size()) ;
vPol.reserve( n) ;
// non devo gestire separatamente CCW perch ho gi invertito i punti
// non devo gestire separatamente CCW perch� ho gi� invertito i punti
for ( int i = 0 ; i < n ; ++ i)
vPol.push_back( i) ;
@@ -241,55 +243,51 @@ Triangulate::Make( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr, Tr
bool
Triangulate::MakeByDelaunay( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr, bool bConforming, bool bQuality)
{
// sistema di riferimento locale sul piano della polyline
Plane3d plPlane ;
double dArea;
if ( ! vPL[0].IsClosedAndFlat( plPlane, dArea, 50 * EPS_SMALL))
return false ;
Frame3d frLoc ;
frLoc.Set( plPlane.GetPoint(), plPlane.GetVersN()) ;
POLYLINEVECTOR vMyPL = vPL ;
for ( size_t t = 0 ; t < vPL.size() ; ++ t) {
vMyPL[t].ToLoc( frLoc) ;
if ( vMyPL[t].GetPointNbr() < 4) // per poter triangolare devo avere almeno tre punti distinti
return false ;
}
// vertici e constraint per la triangolazione
// vertici e constraint per la triangolazione
vector<Delaunay::Point> vDelaunayVert ;
INTVECTOR vDelaunayConstr ;
INTVECTOR vDelaunayConstr ;
for ( size_t i = 0 ; i < vMyPL.size() ; i++) {
Point3d ptFirst, pt ;
vMyPL[i].GetFirstPoint( ptFirst) ;
vDelaunayVert.push_back( Delaunay::Point( ptFirst.x, ptFirst.y)) ;
int nFirst = ( int)vDelaunayVert.size() - 1 ; // indice del primo punto della polyline fra i vertici della triangolazione
int nFirst = vDelaunayVert.size() - 1 ; // indice del primo punto della polyline fra i vertici della triangolazione
vDelaunayConstr.push_back( nFirst) ;
while ( vMyPL[i].GetNextPoint( pt)) {
vDelaunayVert.push_back( Delaunay::Point( pt.x, pt.y)) ;
// nei constraint gli indici vanno inseriti due volte perchè vengono letti a due a due per definire un segmento
vDelaunayConstr.push_back( ( int)vDelaunayVert.size() - 1) ;
vDelaunayConstr.push_back( ( int)vDelaunayVert.size() - 1) ;
// nei constraint gli indici vanno inseriti due volte perchè vengono letti a due a due per definire un segmento
vDelaunayConstr.push_back( vDelaunayVert.size() - 1) ;
vDelaunayConstr.push_back( vDelaunayVert.size() - 1) ;
}
// impongo che l'ultimo vertice coincida con il primo ( curva chiusa)
// impongo che l'ultimo vertice coincida con il primo ( curva chiusa)
vDelaunayVert.pop_back() ;
vDelaunayConstr.erase(vDelaunayConstr.end() - 2, vDelaunayConstr.end()) ;
vDelaunayConstr.push_back( nFirst) ;
}
// holes : sono definiti da un punto interno al buco
// holes : sono definiti da un punto interno al buco
std::vector<Delaunay::Point> vDelaunayHoles ;
for ( size_t i = 1 ; i < vMyPL.size() ; i++) {
Point3d pt ;
CurveComposite * pCrvHole = CreateBasicCurveComposite() ;
pCrvHole->FromPolyLine( vMyPL[i]) ;
pCrvHole->GetCentroid( pt) ;
// se il centroide fosse esterno, cerco per tentativi un punto qualsiasi all'interno della curva
// se il centroide fosse esterno, cerco per tentativi un punto qualsiasi all'interno della curva
double dPar = 0.5 ;
while ( ! IsPointInsidePolyLine( pt, vMyPL[i])) {
while ( ! vMyPL[i].IsPointInsidePolyLine( pt)) {
double dParS, dParE ;
pCrvHole->GetDomain( dParS, dParE) ;
if ( dPar > dParE)
@@ -298,14 +296,14 @@ Triangulate::MakeByDelaunay( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTO
pCrvHole->GetPointTang( dPar, ICurve::FROM_MINUS, pt, vtDir) ;
vtDir.Rotate( Z_AX, 0, -1) ;
pt += 2 * EPS_SMALL * vtDir ;
// tento con un nuovo punto
// tento con un nuovo punto
dPar += 10 * EPS_SMALL ;
}
vDelaunayHoles.push_back( Delaunay::Point( pt.x, pt.y)) ;
}
// parti concave
// parti concave
PNTVECTOR vPtConvexHull ;
vMyPL[0].GetConvexHullXY( vPtConvexHull) ;
CurveComposite* pCrv = CreateBasicCurveComposite() ;
@@ -316,13 +314,13 @@ Triangulate::MakeByDelaunay( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTO
CurveLine * pLine = CreateBasicCurveLine() ;
pLine->Set( vPtConvexHull[i], vPtConvexHull[NextIdx]) ;
// verifico se ho regioni da eliminare
// verifico se ho regioni da eliminare
IntersCurveCurve intCC( *pLine, *pCrv) ;
CRVCVECTOR ccClass ;
intCC.GetCurveClassification( 0, ccClass) ;
for ( size_t j = 0 ; j < ccClass.size() ; j ++) {
if ( ccClass[j].nClass == CRVC_OUT) {
// cerco per tentativi un punto a caso all'interno della regione da eliminare
// cerco per tentativi un punto a caso all'interno della regione da eliminare
double dPar = ( ccClass[j].dParS + ccClass[j].dParE) / 2 ;
double dDist = 0 ;
Point3d pt ;
@@ -339,14 +337,14 @@ Triangulate::MakeByDelaunay( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTO
pt += EPS_SMALL * ( vtDir) ;
vDelaunayHoles.push_back( Delaunay::Point( pt.x , pt.y)) ;
}
// tento con nuovo punto
// tento con nuovo punto
dPar += 10 * EPS_SMALL ;
}
}
}
}
// triangolazione
// triangolazione
Delaunay trGenerator( vDelaunayVert) ;
trGenerator.setSegmentConstraint( vDelaunayConstr) ;
trGenerator.setHolesConstraint( vDelaunayHoles) ;
@@ -355,11 +353,11 @@ Triangulate::MakeByDelaunay( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTO
else
trGenerator.Triangulate( bQuality) ;
// se non ho generato triangoli, errore
// se non ho generato triangoli, errore
if ( trGenerator.ntriangles() == 0)
return false ;
// vertici
// vertici
std::vector< Delaunay::Point> vVertex = trGenerator.MyVertexTraverse() ;
for (size_t i = 0; i < vVertex.size(); i++) {
Point3d pt( vVertex[i][0], vVertex[i][1]) ;
@@ -367,229 +365,13 @@ Triangulate::MakeByDelaunay( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTO
vPt.push_back( pt) ;
}
// triangoli
// triangoli
vTr = trGenerator.MyTriangleTraverse() ;
return true ;
}
//----------------------------------------------------------------------------
// Delaunay Triangulation ( Geometric Tools Engine library)
//----------------------------------------------------------------------------
bool
Triangulate::MakeByDelaunayGTE( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr)
{
// sistema di riferimento locale sul piano della polyline
Plane3d plPlane ;
double dArea;
if ( ! vPL[0].IsClosedAndFlat( plPlane, dArea, 50 * EPS_SMALL))
return false ;
Frame3d frLoc ;
frLoc.Set( plPlane.GetPoint(), plPlane.GetVersN()) ;
POLYLINEVECTOR vMyPL = vPL ;
for ( size_t t = 0 ; t < vPL.size() ; ++ t) {
vMyPL[t].ToLoc( frLoc) ;
if ( vMyPL[t].GetPointNbr() < 4)
return false ;
}
CurveComposite * pCrvPL = CreateBasicCurveComposite() ;
pCrvPL->FromPolyLine( vMyPL[0]) ;
// controllo che holes siano contenuti nel loop esterno
for ( size_t i = 1 ; i < vMyPL.size() ; i ++) {
CurveComposite * pCrvHole = CreateBasicCurveComposite() ;
pCrvHole->FromPolyLine( vMyPL[i]) ;
IntersCurveCurve intCC( *pCrvPL, *pCrvHole) ;
CRVCVECTOR ccClass ;
intCC.GetCurveClassification( 1, ccClass) ;
if ( ccClass.size() > 1 || ccClass[0].nClass != CRVC_IN)
return false ;
}
// Verifico non ci siano autointersezioni
SelfIntersCurve Inters( *pCrvPL) ;
if ( Inters.GetIntersCount() > 0 && Inters.GetOverlaps() == 0)
return false ;
// Gestione autointersezione
// if ( Inters.GetIntersCount() > 0 && Inters.GetOverlaps() == 0) {
//
// // vertici della triangolazione
// vector<Vector2<double>> vPoints ;
// Point3d pt ;
// vMyPL[0].GetFirstPoint( pt) ;
// vPoints.push_back( {pt.x, pt.y}) ;
// pt.ToGlob( frLoc) ;
// vPt.push_back( pt) ;
// while ( vMyPL[0].GetNextPoint( pt) ) {
// vPoints.push_back( {pt.x, pt.y}) ;
// pt.ToGlob( frLoc) ;
// vPt.push_back( pt) ;
// }
// vPt.pop_back() ;
// vPoints.pop_back() ;
//
// // i punti di autointersezione P sono salvati come pair: parametro di P, indice posizione di P in vPoints
// vector<pair<double,int>> dParams ;
// for ( int i = 0 ; i < Inters.GetIntersCount() ; i++) {
//
// IntCrvCrvInfo aInfo ;
// Inters.GetIntCrvCrvInfo( i, aInfo) ;
//
// Point3d pt ;
// pt = aInfo.IciA[0].ptI ;
// pt.ToGlob( frLoc) ;
//
// auto it = find_if( vPt.begin(), vPt.end(), [pt]( const Point3d& ptCrv){ return AreSamePointApprox( ptCrv, pt) ;} ) ;
// // se il punto di interezione è uno dei vertici
// if ( it != vPt.end()) {
// dParams.push_back( pair<double, int> (aInfo.IciA[0].dU, it - vPt.begin())) ;
// dParams.push_back( pair<double, int> (aInfo.IciB[0].dU, it - vPt.begin())) ;
// }
// // se non è uno dei vertici, lo aggiungo in vPt e in vPoints
// else {
// vPt.push_back( pt) ;
// pt.ToLoc( frLoc) ;
// vPoints.push_back( { pt.x, pt.y}) ;
// dParams.push_back( pair<double, int> (aInfo.IciA[0].dU, vPoints.size() - 1)) ;
// dParams.push_back( pair<double, int> (aInfo.IciB[0].dU, vPoints.size() - 1)) ;
// }
// }
// sort( dParams.begin(), dParams.end(), []( const pair<double, int>& a, const pair<double, int>& b){ return a.first < b.first ; }) ;
//
// // lati del poligono :
// INTVECTOR vPolygonIdx ;
// for ( int i = 0 ; i < vMyPL[0].GetPointNbr() ; i++)
// vPolygonIdx.push_back( i) ;
//
// // inserisco i nuovi lati determinati dai punti di intersezione
// for ( int i = 0 ; i < dParams.size() ; i++) {
// // se il parametro c'è già, non lo inserisco
// if ( find_if( vPolygonIdx.begin(), vPolygonIdx.end(),
// [dParams, i]( const int& val) { return abs( val - dParams[i].first) < 0 ; }) != vPolygonIdx.end())
// break ;
// // altrimenti lo inserisco in modo ordinato nel vettore
// auto it = lower_bound( vPolygonIdx.begin(), vPolygonIdx.end(), dParams[i].first,
// []( const int& a , const int& b) { return a < b ; }) ;
// vPolygonIdx.insert( it, dParams[i].second) ;
// }
//
// auto pPolygon = std::make_shared<PolygonTree>() ;
// pPolygon->polygon = vPolygonIdx ;
//
// // holes
// int k = vPoints.size() ;
// for ( size_t i = 1 ; i < vMyPL.size() ; i++) {
//
// auto pHole = std::make_shared<PolygonTree>() ;
// Point3d pt ;
// vMyPL[i].GetFirstPoint( pt) ;
// vPoints.push_back( { pt.x, pt.y}) ;
// pHole->polygon.push_back( k) ;
// k ++ ;
// while ( vMyPL[i].GetNextPoint( pt)) {
// vPoints.push_back( { pt.x, pt.y}) ;
// pHole->polygon.push_back( k) ;
// k ++ ;
// }
//
// vPoints.pop_back() ;
// pHole->polygon.pop_back() ;
// k -- ;
//
// pPolygon->child.push_back( pHole) ;
//
// }
//
// // Triangolazione
// PolygonTreeEx PTOutput ;
// TriangulateCDT<double> triangulator ;
// triangulator( vPoints, pPolygon, PTOutput) ;
//
// for ( auto const& tri : PTOutput.interiorTriangles) {
// vTr.push_back( tri[0]) ;
// vTr.push_back( tri[1]) ;
// vTr.push_back( tri[2]) ;
// }
//
// return true ;
//
// }
// i vertici della triangolazione vPt sono i punti delle polyline nel sistema globale
for ( size_t i = 0 ; i < vPL.size() ; i++) {
Point3d pt ;
vPL[i].GetFirstPoint( pt) ;
vPt.push_back( Point3d( pt.x, pt.y, pt.z)) ;
while ( vPL[i].GetNextPoint( pt ) )
vPt.push_back( Point3d( pt.x, pt.y, pt.z)) ;
// ultimo punto della polyline coincide con il primo, quindi non serve
vPt.pop_back() ;
}
vector<Vector2<double>> vPoints ; // vertici per la triangolazione
auto pPolygon = std::make_shared<PolygonTree>() ; // poligono da triangolare
Point3d pt ;
int k = 0 ;
vMyPL[0].GetFirstPoint( pt) ;
vPoints.push_back( { pt.x, pt.y}) ;
pPolygon->polygon.push_back( k) ;
k ++ ;
while ( vMyPL[0].GetNextPoint( pt) ) {
vPoints.push_back( { pt.x, pt.y}) ;
pPolygon->polygon.push_back( k) ;
k ++ ;
}
// ultimo punto della polyline coincide con il primo, quindi non serve
vPoints.pop_back() ;
pPolygon->polygon.pop_back() ;
k -- ;
// holes
for ( size_t i = 1 ; i < vMyPL.size() ; i++) {
auto pHole = std::make_shared<PolygonTree>() ;
vMyPL[i].GetFirstPoint( pt) ;
vPoints.push_back( { pt.x, pt.y}) ;
pHole->polygon.push_back( k) ;
k ++ ;
while ( vMyPL[i].GetNextPoint( pt)) {
vPoints.push_back( { pt.x, pt.y}) ;
pHole->polygon.push_back( k) ;
k ++ ;
}
vPoints.pop_back() ;
pHole->polygon.pop_back() ;
k -- ;
pPolygon->child.push_back( pHole) ;
}
// Triangolazione
PolygonTreeEx PTOutput ;
TriangulateCDT<double> triangulator ;
triangulator( vPoints, pPolygon, PTOutput) ;
for ( auto const & tri : PTOutput.interiorTriangles) {
vTr.push_back( tri[0]) ;
vTr.push_back( tri[1]) ;
vTr.push_back( tri[2]) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
@@ -935,7 +717,10 @@ Triangulate::TestTriangle( const PNTVECTOR& vPt, const INTVECTOR& vPol,
bool bIsEar = true ;
// An ear must be convex (here counterclockwise)
if ( TriangleIsCCW( vPt[vPol[vPrev[i]]], vPt[vPol[i]], vPt[vPol[vNext[i]]]) &&
! Collinear( vPt[vPol[vPrev[i]]], vPt[vPol[i]], vPt[vPol[vNext[i]]])) {
! Collinear( vPt[vPol[vPrev[i]]], vPt[vPol[i]], vPt[vPol[vNext[i]]]) /*&&
! AreSamePoint( vPt[vPol[vPrev[i]]], vPt[vPol[i]]) &&
! AreSamePoint( vPt[vPol[i]], vPt[vPol[vNext[i]]]) &&
! AreSamePoint( vPt[vPol[vNext[i]]], vPt[vPol[vPrev[i]]])*/ ) {
// Loop over all vertices not part of the tentative ear
BBox3d b3Tria ;
b3Tria.Add( vPt[vPol[vPrev[i]]]) ;
+3 -3
View File
@@ -20,8 +20,7 @@
enum TrgType { TRG_STANDARD, // ear clipping
TRG_DEL_CONFORMING, // conforming constrained Delaunay ( with quality constraint)
TRG_DEL_QUALITY, // constrained Delaunay with quality constraints ( no angle smaller than 20 degrees)
TRG_DEL_NOQUALITY, // constrained Delaunay without quality constraints
TRG_DEL_GTE // constrained Delaunay with Geomtric Tools Engine library
TRG_DEL_NOQUALITY // constrained Delaunay without quality constraints
} ;
//----------------------------------------------------------------------------
@@ -38,7 +37,6 @@ class Triangulate
bool MakeByEC2( const PNTVECTOR& vPt, const INTVECTOR& vPol, INTVECTOR& vTr) ;
bool MakeByEC3( const PNTVECTOR& vPt, const INTVECTOR& vPol, INTVECTOR& vTr) ;
bool MakeByDelaunay( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr, bool bConforming, bool bQuality) ;
bool MakeByDelaunayGTE( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr) ;
bool TestTriangle( const PNTVECTOR& vPt, const INTVECTOR& vPol,
const INTVECTOR& vPrev, INTVECTOR& vNext, int i) ;
double CalcTriangleAspectRatio( const Point3d& ptPa, const Point3d& ptPb, const Point3d& ptPc) ;
@@ -60,3 +58,5 @@ class Triangulate
PointGrid3d m_VertGrid ;
INTVECTOR m_vVert ;
} ;
+86 -18
View File
@@ -34,8 +34,8 @@ GEOOBJ_REGISTER( VOL_ZMAP, NGE_V_ZMP, VolZmap) ;
//----------------------------------------------------------------------------
VolZmap::VolZmap(void)
: m_nStatus( TO_VERIFY), m_nMapNum( 0), m_nNumBlock( 0), m_nConnectedCompoCount( 0), m_dStep( 10.0),
m_nVoxNumPerBlock( N_VOXBLOCK), m_nDexVoxRatio( 1), m_nShape( GENERIC), m_nTempProp( 0), m_Tool( true)
: m_nStatus( TO_VERIFY), m_dStep( 10.0), m_nMapNum( 0), m_nShape( GENERIC), m_nVoxNumPerBlock( N_VOXBLOCK),
m_nDexVoxRatio( 1), m_nNumBlock( 0), m_nConnectedCompoCount( 0), m_nCurrTool( - 1)/*, m_Tool( true)*/
{
for ( int i = 0 ; i < N_MAPS ; ++ i) {
m_nNx[i] = 0 ;
@@ -45,7 +45,9 @@ VolZmap::VolZmap(void)
m_dMaxZ[i] = 0 ;
m_nFracLin[i] = 0 ;
}
m_Tool.SetTolerances( LIN_TOL_STD, ANG_TOL_APPROX_DEG) ;
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
//m_Tool.SetTolerances( LIN_TOL_STD, ANG_TOL_APPROX_DEG) ;
}
//----------------------------------------------------------------------------
@@ -72,8 +74,9 @@ VolZmap::Clear( void)
m_Values[i].clear() ;
}
m_dStep = EPS_SMALL ;
m_nTempProp = 0 ;
m_Tool.Clear() ;
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
ResetAllTools() ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
@@ -138,7 +141,8 @@ VolZmap::CopyFrom( const VolZmap& vzmSrc)
m_dStep = vzmSrc.m_dStep ;
m_nStatus = vzmSrc.m_nStatus ;
m_nTempProp = vzmSrc.m_nTempProp ;
m_nTempProp[0] = vzmSrc.m_nTempProp[0] ;
m_nTempProp[1] = vzmSrc.m_nTempProp[1] ;
// dimensiono membri legati ai blocchi
m_BlockToUpdate = vzmSrc.m_BlockToUpdate ;
@@ -758,7 +762,6 @@ VolZmap::CheckMapConnection( void)
int tStopIntZ = int( m_Values[0][tDexZ].size()) ;
// Ciclo sugli intervalli del dexel
for ( int tIntZ = 0 ; tIntZ < tStopIntZ ; ++ tIntZ) {
if ( m_Values[0][tDexZ][tIntZ].nCompo == 0) {
++ m_nConnectedCompoCount ;
m_Values[0][tDexZ][tIntZ].nCompo = m_nConnectedCompoCount ;
@@ -1677,8 +1680,10 @@ VolZmap::Cut( const Plane3d& plPlane)
Plane3d plMyPlane = plPlane ;
plMyPlane.ToLoc( m_MapFrame) ;
// Imposto numero fittizio di utensile per avere il colore di sezione opportuno
int nToolNumOld = m_Tool.GetCurrentToolNum() ;
m_Tool.SetToolNum( 1) ;
if ( m_nCurrTool < 0)
return false ;
int nToolNumOld = m_vTool[m_nCurrTool].GetCurrentToolNum() ;
m_vTool[m_nCurrTool].SetToolNum( 1) ;
// Interseco lo Zmap col piano, ciclando sulle griglie
bool bModified = false ;
for ( int nMap = 0 ; nMap < int( m_nMapNum) ; ++ nMap) {
@@ -1732,7 +1737,7 @@ VolZmap::Cut( const Plane3d& plPlane)
}
// Ripristino numero utensile
m_Tool.SetToolNum( nToolNumOld) ;
m_vTool[m_nCurrTool].SetToolNum( nToolNumOld) ;
if ( bModified == true) {
// Imposto forma generica
@@ -1967,14 +1972,18 @@ VolZmap::CalcBlockNum( void)
bool
VolZmap::SetToolTolerances( double dLinTol, double dAngTolDeg)
{
return m_Tool.SetTolerances( dLinTol, dAngTolDeg) ;
if ( m_nCurrTool < 0)
return false ;
return m_vTool[m_nCurrTool].SetTolerances( dLinTol, dAngTolDeg) ;
}
//----------------------------------------------------------------------------
bool
VolZmap::SetStdTool( const string& sToolName, double dH, double dR, double dCornR, double dCutterH, int nFlag)
{
return m_Tool.SetStdTool( sToolName, dH, dR, dCornR, dCutterH, nFlag) ;
if ( m_nCurrTool < 0)
return false ;
return m_vTool[m_nCurrTool].SetStdTool( sToolName, dH, dR, dCornR, dCutterH, nFlag) ;
}
//----------------------------------------------------------------------------
@@ -1982,7 +1991,9 @@ bool
VolZmap::SetAdvTool( const string& sToolName,
double dH, double dR, double dTipH, double dTipR, double dCornR, double dCutterH, int nFlag)
{
return m_Tool.SetAdvTool( sToolName, dH, dR, dTipH, dTipR, dCornR, dCutterH, nFlag) ;
if ( m_nCurrTool < 0)
return false ;
return m_vTool[m_nCurrTool].SetAdvTool( sToolName, dH, dR, dTipH, dTipR, dCornR, dCutterH, nFlag) ;
}
//----------------------------------------------------------------------------
@@ -1990,33 +2001,90 @@ bool
VolZmap::SetSawTool( const string& sToolName,
double dH, double dR, double dThick, double dStemR, double dCornR, int nFlag)
{
return m_Tool.SetSawTool( sToolName, dH, dR, dThick, dStemR, dCornR, nFlag) ;
if ( m_nCurrTool < 0)
return false ;
return m_vTool[m_nCurrTool].SetSawTool( sToolName, dH, dR, dThick, dStemR, dCornR, nFlag) ;
}
//----------------------------------------------------------------------------
bool
VolZmap::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline, int nFlag)
{
return m_Tool.SetGenTool( sToolName, pToolOutline, nFlag) ;
if ( m_nCurrTool < 0)
return false ;
return m_vTool[m_nCurrTool].SetGenTool( sToolName, pToolOutline, nFlag) ;
}
//----------------------------------------------------------------------------
bool
VolZmap::SetMortiserTool( const string& sToolName, double dH, double dW, double dTh, double dRc, int nFlag)
{
return m_Tool.SetMortiserTool( sToolName, dH, dW, dTh, dRc, nFlag) ;
if ( m_nCurrTool < 0)
return false ;
return m_vTool[m_nCurrTool].SetMortiserTool( sToolName, dH, dW, dTh, dRc, nFlag) ;
}
//----------------------------------------------------------------------------
bool
VolZmap::SetChiselTool( const string& sToolName, double dH, double dW, double dTh, int nFlag)
{
return m_Tool.SetChiselTool( sToolName, dH, dW, dTh, nFlag) ;
if ( m_nCurrTool < 0)
return false ;
return m_vTool[m_nCurrTool].SetChiselTool( sToolName, dH, dW, dTh, nFlag) ;
}
//----------------------------------------------------------------------------
bool
VolZmap::SetCurrTool( int nCurrTool)
{
if ( nCurrTool < 0 || nCurrTool >= int( m_vTool.size()))
return false ;
m_nCurrTool = nCurrTool ;
return true ;
}
//----------------------------------------------------------------------------
int
VolZmap::GetToolCount( void) const
{
return int( m_vTool.size()) ;
}
//----------------------------------------------------------------------------
bool
VolZmap::AddTool( void)
{
m_vTool.emplace_back( true) ;
m_vTool.back().SetTolerances( LIN_TOL_STD, ANG_TOL_APPROX_DEG) ;
return true ;
}
//----------------------------------------------------------------------------
bool
VolZmap::ResetAllTools( void)
{
bool bOk = true ;
for ( int n = 0 ; n < int( m_vTool.size()) ; ++ n) {
bOk = bOk || m_vTool[n].Clear() ;
}
m_vTool.clear() ;
return bOk ;
}
//----------------------------------------------------------------------------
bool
VolZmap::ResetTool( void)
{
return m_Tool.Clear() ;
bool bOk = m_vTool.back().Clear() ;
m_vTool.erase( m_vTool.begin() + int( m_vTool.size()) - 1) ;
return bOk ;
}
//----------------------------------------------------------------------------
const ICurveComposite&
VolZmap::GetToolOutline( bool bApprox) const
{
if ( m_nCurrTool < 0)
return cvEmptyOutline ;
return ( bApprox ? m_vTool[m_nCurrTool].GetApproxOutline() : m_vTool[m_nCurrTool].GetOutline()) ;
}
+78 -8
View File
@@ -60,10 +60,11 @@ class VolZmap : public IVolZmap, public IGeoObjRW
{ return m_OGrMgr.GetObjGraphics() ; }
const IObjGraphics* GetObjGraphics( void) const override
{ return m_OGrMgr.GetObjGraphics() ; }
void SetTempProp( int nProp) override
{ m_nTempProp = nProp ; }
int GetTempProp( void) const override
{ return m_nTempProp ; }
void SetTempProp( int nProp, int nPropInd = 0) override
{ if ( nPropInd >= 0 && nPropInd < 2)
m_nTempProp[nPropInd] = nProp ; }
int GetTempProp( int nPropInd = 0) const override
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
public : // IVolZmap
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
@@ -71,6 +72,7 @@ class VolZmap : public IVolZmap, public IGeoObjRW
bool Create( const Point3d& ptO, double dDimX, double dDimY, double dDimZ, double dStep, bool bTriDex) override ;
bool CreateFromFlatRegion( const ISurfFlatRegion& Surf, double dDimZ, double dStep, bool bTriDex) override ;
bool CreateFromTriMesh( const ISurfTriMesh& Surf, double dStep, bool bTriDex) override ;
bool CreateEmptyMap( const Point3d& ptO, double dLengthX, double dLengthY, double dLengthZ, double dStep, bool bTriDex) override ;
int GetBlockCount( void) const override ;
int GetBlockUpdatingCounter( int nBlock) const override ;
bool GetBlockTriangles( int nBlock, TRIA3DEXVECTOR& vTria) const override ;
@@ -89,9 +91,14 @@ class VolZmap : public IVolZmap, public IGeoObjRW
bool SetGenTool( const std::string& sToolName, const ICurveComposite* pToolOutline, int nFlag) override ;
bool SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc, int nFlag) override ;
bool SetChiselTool( const std::string& sToolName, double dH, double dW, double dTh, int nFlag) override ;
bool SetCurrTool( int nCurrTool) override ;
int GetToolCount( void) const override ;
int GetCurrTool( void) const override
{ return m_nCurrTool ; }
bool AddTool( void) override ;
bool ResetAllTools( void) override ;
bool ResetTool( void) override ;
const ICurveComposite& GetToolOutline( bool bApprox = false) const override
{ return ( bApprox ? m_Tool.GetApproxOutline() : m_Tool.GetOutline()) ;}
const ICurveComposite& GetToolOutline( bool bApprox = false) const override ;
bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Point3d& ptPe, const Vector3d& vtDe) override ;
bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& vtAs,
const Point3d& ptPe, const Vector3d& vtDe, const Vector3d& vtAe) override ;
@@ -302,6 +309,38 @@ class VolZmap : public IVolZmap, public IGeoObjRW
inline bool TestParaBBox( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtD, const Vector3d& vtA,
double dLenX, double dLenY, double dLenZ,
int& nStI, int& nStJ, int& nEnI, int& nEnJ) ;
// Asportazioni superfici elementari vuote
bool SurfCircCrown_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtAx, double dMaxRad, double dMinRad) ;
bool SurfCircCrown_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtAx, double dMaxRad, double dMinRad) ;
bool SurfCircCrown_ZMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtAx, double dMaxRad, double dMinRad) ;
bool SurfCircCrown_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtAx, double dMaxRad, double dMinRad) ;
/*bool SurfCyl_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dRad, bool bTapB, bool bTapT) ;
bool SurfCyl_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dRad, bool bTapB, bool bTapT) ;*/
bool SurfCyl_ZMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dRad, bool bOuterCutter) ;
bool SurfCyl_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE,
const Vector3d& vtToolDir, double dHei, double dRad, bool bOuterCutter, bool bTapB, bool bTapT) ;
bool SurfConus_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad,
bool bOuterCutter, const Vector3d& vtArcNormMaxR, const Vector3d& vtArcNormMinR) ;
bool SurfConus_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dMaxRad, double dMinRad, bool bOuterCutter, bool bTapB, bool bTapT,
const Vector3d& vtArcNormMaxR, const Vector3d& vtArcNormMinR) ;
bool SurfConus_ZMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad,
bool bOuterCutter, const Vector3d& vtArcNormMaxR, const Vector3d& vtArcNormMinR) ;
bool SurfConus_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtAx,
double dHei, double dMaxRad, double dMinRad, bool bOuterCutter, bool bTapB, bool bTapT,
const Vector3d& vtArcNormMaxR, const Vector3d& vtArcNormMinR) ;
bool SurfSphericalShellPart_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtAx,
double dRad, double dInfH, double dSupH, bool bOuterCutter) ;
bool SurfSphericalShell_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtAx,
double dRad, double dHei, bool bOuterCutter) ;
// Additivo
bool AddingMotion( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtAx/*, double dHei, double dRad, double dCornerRad*/) ;
// Intersezioni
bool IntersLineBox( const Point3d& ptP, const Vector3d& vtV, const Point3d& ptMin, const Point3d& ptMax) const ;
bool IntersLineBox( const Point3d& ptP, const Vector3d& vtV, const Point3d& ptMin, const Point3d& ptMax,
@@ -331,6 +370,34 @@ class VolZmap : public IVolZmap, public IGeoObjRW
const Frame3d& frTruncPyramFrame, double dSegMin, double dSegMax, double dHeight,
Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ;
bool TestIntersPlaneZmapBBox( const Plane3d& plPlane) const ;
// Intersezioni per asportazioni avanzate
int IntersLineCircCrown( const Point3d& ptLineP, const Vector3d& vtLineDir,
const Point3d& ptCen, const Vector3d& vtAx, double dMaxRad, double dMinRad,
Point3d& ptInt, Vector3d& vtN) const ;
int IntersLineParallelogram( const Point3d& ptLineP, const Vector3d& vtLineDir,
const Point3d& ptParOrig, const Vector3d& vtSeg1, const Vector3d& vtSeg2,
bool bExtNorm, Point3d& ptInt, Vector3d& vtN) const ;
int IntersLineCylinderCuttedByPlanes( const Point3d& ptLineP, const Vector3d& vtLineDir,
const Point3d& ptBaseCen, const Vector3d& vtAx, double dRad, double dH, bool bInOut,
const std::vector<Plane3d>& vPlanesVec,
Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ;
int IntersLineCircSweptSurfCuttedByPlanes( const Point3d& ptLineP, const Vector3d& vtLineDir,
const Point3d& ptCen, const Vector3d& vtAx, double dRad, const Vector3d& vtSweptVec, bool bInOut,
const std::vector<Plane3d>& vPlanesVec,
Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ;
int IntersLineConeCuttedByPlanes( const Point3d& ptLineP, const Vector3d& vtLineDir,
const Point3d& ptVert, const Vector3d& vtAx, double dRad, double dH, bool bInOut,
const std::vector<Plane3d>& vPlanesVec,
Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ;
int IntersLineSphereCuttedByPlanes( const Point3d& ptLineP, const Vector3d& vtLineD,
const Point3d& ptCen, double dRad, bool bInOut,
const std::vector<Plane3d>& vPlanesVec,
Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ;
int IntersLineCatTongue( const Point3d& ptLineP, const Vector3d& vtLineD,
const Point3d& ptCenSt, const Point3d& ptCenEn, const Vector3d& vtNorm, double dRad,
Point3d& ptInt, Vector3d& vtN) const ;
// Voxel: esistenza e passaggio da N a ijk per i voxel
bool IsValidVoxel( int nN) const ;
bool IsValidVoxel( int nI, int nJ, int nK) const ;
@@ -401,7 +468,7 @@ class VolZmap : public IVolZmap, public IGeoObjRW
private :
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
Status m_nStatus ; // stato
int m_nTempProp ; // proprietà temporanea
int m_nTempProp[2] ; // vettore proprietà temporanee
double m_dStep ; // passo delle griglie
int m_nMapNum ; // numero di griglie ( 1 o 3)
Frame3d m_MapFrame ; // riferimento intrinseco dello Zmap
@@ -451,7 +518,10 @@ class VolZmap : public IVolZmap, public IGeoObjRW
mutable std::atomic<bool> m_bBreak ;
std::atomic<bool> m_bIsBox ;
Tool m_Tool ;
// Utensili
std::vector<Tool> m_vTool ;
int m_nCurrTool ;
CurveComposite cvEmptyOutline ;
} ;
+5 -5
View File
@@ -249,7 +249,7 @@ VolZmap::IntersRayDexel( const Point3d& ptP, const Vector3d& vtV, int nGrid, int
}
//----------------------------------------------------------------------------
// Calcola la profondità del materiale lungo un raggio, identificato da un punto e un versoreore.
// Calcola la profondità del materiale lungo un raggio, identificato da un punto e un versore.
// Punto e versore devono essere espressi nel sistema di riferimento locale, in cui è immerso quello dello Zmap.
// InLength = distanza di ingresso (se -1 il punto è interno, se -2 il punto è esterno e il raggio non interseca lo Zmap)
// OutLength = distanza di uscita
@@ -293,7 +293,7 @@ VolZmap::GetDepthWithDexel( const Point3d& ptPLoc, const Vector3d& vtDLoc, doubl
double dOutLen[N_MAPS] ;
// Ciclo sulle griglie
for ( int nGrid = 0 ; nGrid < m_nMapNum ; ++ nGrid) {
for ( int nGrid = 0 ; nGrid < m_nMapNum ; ++ nGrid) {
Point3d ptP0 = ptP ;
Vector3d vtV0 = vtD ;
@@ -417,7 +417,7 @@ VolZmap::GetDepthWithDexel( const Point3d& ptPLoc, const Vector3d& vtDLoc, doubl
else {
dInLength = INFINITO ;
dOutLength = - INFINITO ;
for ( int nGr = 0 ; nGr < 3 ; ++ nGr) {
for ( int nGr = 0 ; nGr < m_nMapNum ; ++ nGr) {
if ( dInLen[nGr] > -2 && dInLen[nGr] < dInLength)
dInLength = dInLen[nGr] ;
if ( dOutLen[nGr] > -2 && dOutLen[nGr] > dOutLength)
@@ -3130,8 +3130,8 @@ VolZmap::GetPartVolume( int nPart, double& dVol) const
// Eseguo il calcolo della lunghezza totale degli spilloni
double dLen = 0 ;
for ( int nMap = 0 ; nMap < int( m_nMapNum) ; ++ nMap) {
for ( int nDex = 0 ; nDex < int( m_Values[nMap].size()) ; ++ nDex) {
for ( int nMap = 0 ; nMap < m_nMapNum ; ++ nMap) {
for ( int nDex = 0 ; nDex < m_nDim[nMap] ; ++ nDex) {
for ( int nInt = 0 ; nInt < int( m_Values[nMap][nDex].size()) ; ++ nInt) {
// se il pezzo di spillone appartiene alla parte, ne aggiungo la lunghezza
if ( m_Values[nMap][nDex][nInt].nCompo == nPart + 1) {
+78
View File
@@ -28,6 +28,10 @@ using namespace std ;
bool
VolZmap::Create( const Point3d& ptO, double dLengthX, double dLengthY, double dLengthZ, double dStep, bool bTriDex)
{
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// Per test additivi //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//return CreateEmptyMap( ptO, dLengthX, dLengthY, dLengthZ, dStep, bTriDex) ;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Controlli sull'ammissibilità delle dimensioni lineari del grezzo e del passo
if ( dStep < EPS_SMALL || dLengthX < EPS_SMALL || dLengthY < EPS_SMALL || dLengthZ < EPS_SMALL)
return false ;
@@ -665,3 +669,77 @@ VolZmap::CreateFromTriMesh( const ISurfTriMesh& Surf, double dStep, bool bTriDex
return bCompleted ;
}
//----------------------------------------------------------------------------
bool
VolZmap::CreateEmptyMap( const Point3d& ptO, double dLengthX, double dLengthY, double dLengthZ, double dStep, bool bTriDex)
{
// Controlli sull'ammissibilità delle dimensioni lineari del grezzo e del passo
if ( dStep < EPS_SMALL || dLengthX < EPS_SMALL || dLengthY < EPS_SMALL || dLengthZ < EPS_SMALL)
return false ;
// Il passo di discretizzazione non può essere inferiore a 100 * EPS_SMALL
m_dStep = max( dStep, 100 * EPS_SMALL) ;
// Aggiorno la dimensione della mappa 1 o 3
m_nMapNum = ( bTriDex ? 3 : 1) ;
// Disponendo i sistemi di riferimento in una successione, le coordinate x,y,z
// di uno si ottengono da una permutazione ciclica di quelle del precedente sistema.
// es: X(n) = Z(n-1), Y(n) = X(n-1), Z(n) = Y(n-1)
// Definisco il sistema di riferimento intrinseco
m_MapFrame.Set( ptO, X_AX, Y_AX, Z_AX) ;
// Definisco i vettori dei limiti su indici
m_nNx[0] = max( int( ( dLengthX + EPS_SMALL) / m_dStep + 0.5), 1) ;
m_nNy[0] = max( int( ( dLengthY + EPS_SMALL) / m_dStep + 0.5), 1) ;
// Numero di componenti connesse
m_nConnectedCompoCount = 1 ;
// Se tridexel
if ( bTriDex) {
m_nNx[1] = m_nNy[0] ;
m_nNy[1] = max( int( ( dLengthZ + EPS_SMALL) / m_dStep + 0.5), 1) ;
m_nNx[2] = m_nNy[1] ;
m_nNy[2] = m_nNx[0] ;
}
// altrimenti mono dexel
else {
m_nNx[1] = 0 ;
m_nNy[1] = 0 ;
m_nNx[2] = 0 ;
m_nNy[2] = 0 ;
}
// Definisco il numero di blocchi lungo x,y e z
if ( ! CalcBlockNum())
return false ;
// Creazione delle mappe
// Calcolo del numero di celle per ogni mappa
for ( int i = 0 ; i < m_nMapNum ; ++ i)
m_nDim[i] = m_nNx[i] * m_nNy[i] ;
// Creazione delle celle per ogni mappa
for ( int i = 0 ; i < m_nMapNum ; ++ i)
m_Values[i].resize( m_nDim[i]) ;
// Definizione delle limitazioni iniziali in Z per ogni mappa
m_dMinZ[0] = 0 ;
m_dMaxZ[0] = dLengthZ ;
m_dMinZ[1] = 0 ;
m_dMaxZ[1] = ( bTriDex ? dLengthX : 0) ;
m_dMinZ[2] = 0 ;
m_dMaxZ[2] = ( bTriDex ? dLengthY : 0) ;
// Tipologia
m_nShape = BOX ;
// Aggiornamento dello stato
m_nStatus = OK ;
return true ;
}
+9 -9
View File
@@ -1,13 +1,13 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2019
// EgalTech 2015-2021
//----------------------------------------------------------------------------
// File : VolZmap.cpp Data : 07.03.19 Versione : 2.1c2
// File : VolZmap.cpp Data : 13.09.21 Versione : 2.3i1
// Contenuto : Implementazione della classe Volume Zmap (tre griglie)
//
//
//
// Modifiche : 22.01.15 DS Creazione modulo.
//
// 13.09.21 LM Correzione funzione che determina se voxel su frontiera di un blocco.
//
//----------------------------------------------------------------------------
@@ -844,7 +844,7 @@ VolZmap::UpdateTripleMapGraphics( void) const
VecTriHold.resize( m_nNumBlock) ;
// Ciclo sui blocchi per eliminare le slice fra blocchi da aggiornare
for ( int t = 0 ; t < m_nNumBlock ; ++ t) {
for ( int t = 0 ; t < m_nNumBlock ; ++ t) {
for ( auto it = m_SliceXY[t].begin() ; it != m_SliceXY[t].end() ;) {
int nSlIJK[3] ;
if ( GetVoxIJKFromN( it->first, nSlIJK[0], nSlIJK[1], nSlIJK[2])) {
@@ -1083,7 +1083,7 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
// Flag di regolarità dei campi scalare e vettoriale
bool bReg = true ;
// Ciclo sui segmenti
for ( int EdgeIndex = 0 ; EdgeIndex < 12 ; ++ EdgeIndex) {
// Se il segmento non attraversa la superficie passo al successivo
@@ -3984,13 +3984,13 @@ VolZmap::IsAVoxelOnBoundary( const int nLimits[], const int nIJK[], int nDeltaIn
-- nDeltaIndex[0] ;
else if ( nIJK[0] == nLimits[1] - 1)
++ nDeltaIndex[0] ;
if ( nIJK[0] == nLimits[0])
if ( nIJK[1] == nLimits[2])
-- nDeltaIndex[1];
else if ( nIJK[0] == nLimits[1] - 1)
else if ( nIJK[1] == nLimits[3] - 1)
++ nDeltaIndex[1];
if ( nIJK[0] == nLimits[0])
if ( nIJK[2] == nLimits[4])
-- nDeltaIndex[2];
else if ( nIJK[0] == nLimits[1] - 1)
else if ( nIJK[2] == nLimits[5] - 1)
++ nDeltaIndex[2];
return ( nDeltaIndex[0] != 0 || nDeltaIndex[1] != 0 || nDeltaIndex[2] != 0) ;
}
+3862 -545
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -10156,7 +10156,6 @@ struct behavior *b;
sortarray[j][0], sortarray[j][1]);
}
setvertextype(sortarray[j], UNDEADVERTEX);
if ( b->poly) setvertex2tri( sortarray[j], NULL) ;
m->undeads++;
} else {
i++;