Compare commits

...

25 Commits

Author SHA1 Message Date
LorenzoM d1cf3f1f2f Tolto un commento 2021-11-05 17:06:12 +01:00
LorenzoM ffa7c3dad5 Corretto errore bModif 2021-11-05 17:00:47 +01:00
LorenzoM a3502b5c07 Merge remote-tracking branch 'origin/master' into develop 2021-11-04 12:40:10 +01:00
LorenzoM a9259e8679 Merge modifiche Dario su SurfTriMeshBoolean 2021-11-04 12:37:25 +01:00
LorenzoM d3bc7bee64 TEST Taglio generalizzato 2021-11-04 12:30:24 +01:00
DarioS aa82c82ddc EgtGeomKernel 2.3k2 :
- corretta SurfTriMesh::SimplifyFacets.
2021-11-04 10:03:35 +01:00
DarioS 8a6dbf044e EgtGeomKernel :
- piccole modifiche in Cut e GeneralizedCut per eseguire il più possibile SimplfyFacet.
2021-11-03 13:30:26 +01:00
DarioS 76d009ddbe EgtGeomKernel 2.3k1 :
- corretto offset di segmenti di retta singoli con estrusione
- modifiche per calcolo taglio superfici TriMesh
- modifiche a funzione SimplifyFacets di superfici TriMesh.
2021-11-02 08:19:11 +01:00
LorenzoM 6deff01b6e Modifiche generalized cut 2021-10-29 17:17:51 +02:00
LorenzoM e79bb117d2 Pulizia codice simplify facet 2021-10-27 17:53:12 +02:00
LorenzoM 2ea4b59b9b Aggiunta funzione FimplifyFacets in TriMesh 2021-10-26 18:11:58 +02:00
DarioS 6e9465247f EgtGeomKernel 2.3j1 :
- diemnticato un file.
2021-10-24 18:00:00 +02:00
DarioS 1d1fb41212 EgtGeomKernel 2.3j :
- modifiche a SurfTriMesh::Cut (più semplice abilitare calcolo con facce invece di triangoli)
- ora CurveClassification (di Regioni e Curve) ricevono anche il parametro dMinLen.
2021-10-24 17:57:53 +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
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
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
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
45 changed files with 1604 additions and 1265 deletions
+2 -2
View File
@@ -13,8 +13,8 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "\EgtDev\Include\EGkBBox3d.h"
#include "\EgtDev\Include\EGkFrame3d.h"
#include "/EgtDev/Include/EGkBBox3d.h"
#include "/EgtDev/Include/EGkFrame3d.h"
#include <algorithm>
using namespace std ;
+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
} ;
//-----------------------------------------------------------------------------
+14 -9
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)) {
@@ -3129,7 +3134,7 @@ CurveComposite::RemoveUndercutOnY( double dLinTol, double dAngTolDeg)
pSfrCut->Translate( b3Box.GetMin() - Point3d( 10 * EPS_SMALL, dLen, 0)) ;
// calcolo la classificazione della curva rispetto alla regione
CRVCVECTOR ccClass ;
if ( ! pSfrCut->GetCurveClassification( *pOutLoop, ccClass))
if ( ! pSfrCut->GetCurveClassification( *pOutLoop, EPS_SMALL, ccClass))
return false ;
// determino gli intervalli di curva da conservare
Intervals inOk ;
@@ -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
} ;
//-----------------------------------------------------------------------------
+10 -11
View File
@@ -23,33 +23,30 @@
bool
CalcMinDistPointPolyLine( const Point3d& ptP, PolyLine& PL, double dLinTol, MDCVECTOR& vApproxMin)
{
double dSqDist ;
double dPar ;
double dUIni ;
double dUFin ;
Point3d ptIni ;
Point3d ptFin ;
double dMinDist ;
double dSqMinDist ;
MinDistCalc approxMin ;
vApproxMin.reserve( 4) ;
vApproxMin.clear() ;
bool bFound = false ;
bool bOnEnd = false ;
vApproxMin.reserve( 4) ;
vApproxMin.clear() ;
double dUIni, dUFin ;
Point3d ptIni, ptFin ;
double dMinDist, dSqMinDist ;
for ( bool bLine = PL.GetFirstULine( &dUIni, &ptIni, &dUFin, &ptFin) ;
bLine ;
bLine = PL.GetNextULine( &dUIni, &ptIni, &dUFin, &ptFin)) {
// calcolo la distanza del punto dal segmento
DistPointLine dstPtLn( ptP, ptIni, ptFin) ;
double dSqDist ;
if ( ! dstPtLn.GetSqDist( dSqDist))
continue ;
// altro punto con la stessa minima distanza già trovata
if ( bFound && abs( dSqDist - dSqMinDist) < 2 * dMinDist * dLinTol) {
// salvo i dati nella struttura
MinDistCalc approxMin ;
approxMin.dDist = dMinDist ;
dstPtLn.GetMinDistPoint( approxMin.ptQ) ;
double dPar ;
dstPtLn.GetParamAtMinDistPoint( dPar) ;
approxMin.dPar = ( 1 - dPar) * dUIni + dPar * dUFin ;
approxMin.dParMin = dUIni ;
@@ -66,8 +63,10 @@ CalcMinDistPointPolyLine( const Point3d& ptP, PolyLine& PL, double dLinTol, MDCV
dSqMinDist = dSqDist ;
dMinDist = sqrt( dSqMinDist) ;
// salvo i dati nella struttura
MinDistCalc approxMin ;
approxMin.dDist = dMinDist ;
dstPtLn.GetMinDistPoint( approxMin.ptQ) ;
double dPar ;
dstPtLn.GetParamAtMinDistPoint( dPar) ;
approxMin.dPar = ( 1 - dPar) * dUIni + dPar * dUFin ;
approxMin.dParMin = dUIni ;
BIN
View File
Binary file not shown.
+6 -8
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>
@@ -237,7 +239,7 @@ 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>
<LanguageStandard>stdcpp17</LanguageStandard>
@@ -364,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" />
@@ -395,6 +392,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="SurfFlatRegionBooleans.cpp" />
<ClCompile Include="SurfFlatRegionOffset.cpp" />
<ClCompile Include="SurfTriMeshBooleans.cpp" />
<ClCompile Include="SurfTriMeshUtilities.cpp" />
<ClCompile Include="TextureData.cpp" />
<ClCompile Include="Tool.cpp" />
<ClCompile Include="UserObjDefault.cpp" />
+3
View File
@@ -453,6 +453,9 @@
<ClCompile Include="CDeRectPrismoidTria.cpp">
<Filter>File di origine\GeoCollision</Filter>
</ClCompile>
<ClCompile Include="SurfTriMeshUtilities.cpp">
<Filter>File di origine\Geo</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
+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
} ;
+118 -118
View File
@@ -57,7 +57,7 @@
using namespace std ;
//----------------------------------------------------------------------------
// Per Id di entità
// Per Id di entità
static const int ID_NO = -99 ;
// Per tipo di costruzione di poligono
static const int POLYG_INSCR = 1 ;
@@ -189,7 +189,7 @@ GdbExecutor::Execute( const string& sCmd1, const string& sCmd2, const STRVECTOR&
LOG_ERROR( GetEGkLogger(), "Error : null GeomDb in GdbExecutor.")
return ER_ERR ;
}
// verifico validità CmdParser
// verifico validità CmdParser
if ( m_pParser == nullptr) {
LOG_ERROR( GetEGkLogger(), "Error : null CmdParser in GdbExecutor.")
return ER_ERR ;
@@ -218,7 +218,7 @@ GdbExecutor::ExecuteGroup( const string& sCmd2, const STRVECTOR& vsParams)
// 2 o 3 parametri : Id, Id del padre[, Frame]
if ( vsParams.size() != 2 && vsParams.size() != 3)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -236,7 +236,7 @@ GdbExecutor::ExecuteGroup( const string& sCmd2, const STRVECTOR& vsParams)
// 3 parametri : Id, Id del padre, Orig
if ( vsParams.size() != 3)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -253,7 +253,7 @@ GdbExecutor::ExecuteGroup( const string& sCmd2, const STRVECTOR& vsParams)
// creo il gruppo
int nIdDest = GetIdParam( vsParams[0], true) ;
int nIdNew = m_pGDB->AddGroup( nIdDest, GetIdParam( vsParams[1]), frFrame) ;
// se IdDest da calcolare, può essere una variabili a cui cambiare il valore
// se IdDest da calcolare, può essere una variabili a cui cambiare il valore
if ( nIdDest == GDB_ID_NULL)
m_pParser->SetVariable( vsParams[0], nIdNew) ;
@@ -270,7 +270,7 @@ GdbExecutor::ExecutePoint( const string& sCmd2, const STRVECTOR& vsParams)
// 3 parametri : Id, IdParent e punto
if ( vsParams.size() != 3)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frPnt ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frPnt))
return false ;
@@ -289,7 +289,7 @@ GdbExecutor::ExecutePoint( const string& sCmd2, const STRVECTOR& vsParams)
// 4 : Id, IdParent, ptP, vtV
if ( vsParams.size() != 4)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frPnt ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frPnt))
return false ;
@@ -351,7 +351,7 @@ GdbExecutor::VectorMake( const STRVECTOR& vsParams)
// 3 o 4 parametri : Id, IdParent, Vettore [, ScaleFactor]
if ( vsParams.size() != 3 && vsParams.size() != 4)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frVect ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frVect))
return false ;
@@ -378,7 +378,7 @@ GdbExecutor::VectorFromSpherical( const STRVECTOR& vsParams)
// 5 parametri : Id, IdParent, dLen, dAngVertDeg, dAngOrizzDeg
if ( vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frVect ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frVect))
return false ;
@@ -386,7 +386,7 @@ GdbExecutor::VectorFromSpherical( const STRVECTOR& vsParams)
double dLen ;
if ( ! GetLengthParam( vsParams[2], dLen))
return false ;
// recupero l'angolo in verticale (non c'è metodo generale)
// recupero l'angolo in verticale (non c'è metodo generale)
double dAngVertDeg ;
if ( ! FromString( vsParams[3], dAngVertDeg))
return false ;
@@ -410,7 +410,7 @@ GdbExecutor::VectorCrossProduct( const STRVECTOR& vsParams)
// 4 o 5 parametri : Id, IdParent, vtV1, vtV2 [, bNorm]
if ( vsParams.size() != 4 && vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frVect ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frVect))
return false ;
@@ -444,7 +444,7 @@ GdbExecutor::VectorDifference( const STRVECTOR& vsParams)
// 4 o 5 parametri : Id, IdParent, ptP1, ptP2 [, bNorm]
if ( vsParams.size() != 4 && vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frVect ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frVect))
return false ;
@@ -478,7 +478,7 @@ GdbExecutor::VectorBaseVector( const STRVECTOR& vsParams)
// 4 o 5 parametri : Id, IdParent, PtBase, Vettore [, ScaleFactor]
if ( vsParams.size() != 4 && vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frVect ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frVect))
return false ;
@@ -512,7 +512,7 @@ GdbExecutor::VectorModifyBase( const STRVECTOR& vsParams)
return false ;
// indice dell'oggetto
int nId = GetIdParam( vsParams[0]) ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frVect ;
if ( ! m_pGDB->GetGlobFrame( nId, frVect))
return false ;
@@ -537,7 +537,7 @@ GdbExecutor::ExecuteFrame( const string& sCmd2, const STRVECTOR& vsParams)
// 3 parametri : Id, ParentId, Frame
if ( vsParams.size() != 3)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -557,7 +557,7 @@ GdbExecutor::ExecuteFrame( const string& sCmd2, const STRVECTOR& vsParams)
// 5 parametri : Id, ParentId, ptOrig, ptOnX, ptNearY
if ( vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -579,7 +579,7 @@ GdbExecutor::ExecuteFrame( const string& sCmd2, const STRVECTOR& vsParams)
// 4 parametri
if ( vsParams.size() != 4)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -634,7 +634,7 @@ GdbExecutor::CurveLineMake( const STRVECTOR& vsParams)
// 4 parametri : Id, IdParent, ptStart, ptEnd
if ( vsParams.size() != 4)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -664,7 +664,7 @@ GdbExecutor::CurveLineVersorLength( const STRVECTOR& vsParams)
// 5 parametri : Id, IdParent, ptStart, vtDir, dLen
if ( vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -698,7 +698,7 @@ GdbExecutor::CurveLineDirLength( const STRVECTOR& vsParams)
// 5 parametri : Id, IdParent, ptStart, dAngDeg, dLen
if ( vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -863,7 +863,7 @@ GdbExecutor::CurveLineMinPointCurve( const STRVECTOR& vsParams)
// porto il punto nel riferimento della curva
Point3d ptSloc = ptStart ;
ptSloc.LocToLoc( frPoint, frCurve) ;
// recupero eventuale parametro per discriminare tra più soluzioni
// recupero eventuale parametro per discriminare tra più soluzioni
double dNearParam ;
if ( vsParams.size() < 5 || ! FromString( vsParams[4], dNearParam))
dNearParam = 0 ;
@@ -962,7 +962,7 @@ GdbExecutor::CurveCircleMake( const STRVECTOR& vsParams)
// 5 parametri
if ( vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -996,7 +996,7 @@ GdbExecutor::CurveCirclePlaneXY( const STRVECTOR& vsParams)
// 4 parametri
if ( vsParams.size() != 4)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -1026,7 +1026,7 @@ GdbExecutor::CurveArcMake( const STRVECTOR& vsParams)
// 8 parametri
if ( vsParams.size() != 8)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -1072,7 +1072,7 @@ GdbExecutor::CurveArcPlaneXY( const STRVECTOR& vsParams)
// 7 parametri
if ( vsParams.size() != 7)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -1114,7 +1114,7 @@ GdbExecutor::CurveArcCircle3P( const STRVECTOR& vsParams, bool bCirc)
// 5 parametri : Id, ParentId, ptP0, ptP1, ptP2
if ( vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -1148,7 +1148,7 @@ GdbExecutor::CurveArc2PDi( const STRVECTOR& vsParams)
// 5 parametri : Id, ParentId, ptPi, ptPf, dDiri
if ( vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -1164,7 +1164,7 @@ GdbExecutor::CurveArc2PDi( const STRVECTOR& vsParams)
double dDirI ;
if ( ! GetDirParam( vsParams[4], frRef, dDirI))
return false ;
// calcolo l'arco (in casi particolari può essere una retta)
// calcolo l'arco (in casi particolari può essere una retta)
ICurve* pCurve = GetArc2PD( ptPi, ptPf, dDirI) ;
if ( pCurve == nullptr)
return false ;
@@ -1179,7 +1179,7 @@ GdbExecutor::CurveArc2PRS( const STRVECTOR& vsParams)
// 5 o 6 parametri : Id, ParentId, ptPi, ptPf, dRad[, CCW/CW]
if ( vsParams.size() != 5 && vsParams.size() != 6)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -1217,7 +1217,7 @@ GdbExecutor::CurveArcC2P( const STRVECTOR& vsParams)
// 5 parametri : Id, ParentId, ptCen, ptPi, ptNearPf
if ( vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -1251,7 +1251,7 @@ GdbExecutor::CurveCircleCenterTgArc( const STRVECTOR& vsParams)
// 5 parametri : Id, ParentId, ptCen, IdArc, ptNear
if ( vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frDest ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frDest))
return false ;
@@ -1297,7 +1297,7 @@ GdbExecutor::CurveArcCenterTgArcP( const STRVECTOR& vsParams)
// 6 parametri : Id, ParentId, ptCen, IdArc, ptNearTg, ptNearEnd
if ( vsParams.size() != 6)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frDest ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frDest))
return false ;
@@ -1349,7 +1349,7 @@ GdbExecutor::CurveArcPDiTgArc( const STRVECTOR& vsParams)
// 6 parametri : Id, ParentId, ptStart, dirStart, IdArc, ptNear
if ( vsParams.size() != 6)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frDest ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frDest))
return false ;
@@ -1382,7 +1382,7 @@ GdbExecutor::CurveArcPDiTgArc( const STRVECTOR& vsParams)
return false ;
Point3d ptNtloc = ptNear ;
ptNtloc.LocToLoc( frDest, frTgArc) ;
// calcolo l'arco (in casi particolari può essere una linea)
// calcolo l'arco (in casi particolari può essere una linea)
ICurve* pCurve = GetArcPntDirTgCurve( ptSloc, FromPolar( 1, dDirI), *pTgArc, ptNtloc, Z_AX) ;
if ( pCurve == nullptr)
return false ;
@@ -1521,7 +1521,7 @@ GdbExecutor::ExecuteCurveBez( const string& sCmd2, const STRVECTOR& vsParams)
// inizializzo la curva di Bezier
if ( ! pCrvBez->Init( nDeg, false))
return false ;
// recupero il riferimento in cui è immersa
// recupero il riferimento in cui è immersa
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -1547,7 +1547,7 @@ GdbExecutor::ExecuteCurveBez( const string& sCmd2, const STRVECTOR& vsParams)
// inizializzo la curva di Bezier
if ( ! pCrvBez->Init( nDeg, true))
return false ;
// recupero il riferimento in cui è immersa
// recupero il riferimento in cui è immersa
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -1949,7 +1949,7 @@ GdbExecutor::CurveCompoFromPolygon( const STRVECTOR& vsParams, int nType)
int nNumLati ;
if ( ! FromString( vsParams[2], nNumLati))
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -1994,7 +1994,7 @@ GdbExecutor::CurveCompoFromBiarc( const STRVECTOR& vsParams)
// 6 o 7 parametri : Id, IdParent, ptP1, Dir1, ptP2, Dir2 [, Par]
if ( vsParams.size() != 6 && vsParams.size() != 7)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -2074,7 +2074,7 @@ GdbExecutor::CurveCompoExtractCurve( const STRVECTOR& vsParams, bool bEndOrStart
Frame3d frSou ;
if ( ! m_pGDB->GetGlobFrame( nIdCCompo, frSou))
return false ;
// estraggo la opportuna entità
// estraggo la opportuna entità
PtrOwner<ICurve> pCrv( pCrvCompo->RemoveFirstOrLastCurve( bEndOrStart)) ;
// se 1 solo parametro -> cancellazione
if ( vsParams.size() == 1)
@@ -2161,7 +2161,7 @@ GdbExecutor::ExecuteSurfTriMesh( const string& sCmd2, const STRVECTOR& vsParams)
else if ( sCmd2 == "COMP" || sCmd2 == "DOCOMPACTING") {
return SurfTriMeshDoCompacting( vsParams) ;
}
// se unione di due o più superfici per cucitura
// se unione di due o più superfici per cucitura
else if ( sCmd2 == "SEW" || sCmd2 == "DOSEWING") {
return SurfTriMeshDoSewing( vsParams) ;
}
@@ -2395,7 +2395,7 @@ GdbExecutor::SurfTriMeshByExtrusion( const STRVECTOR& vsParams)
CurveLocal CrvLoc( m_pGDB, nCrvId, frDest) ;
if ( CrvLoc.Get() == nullptr)
return false ;
// recupero il vettore di estrusione (già in locale)
// recupero il vettore di estrusione (già in locale)
Vector3d vtExtr ;
if ( ! GetVectorParam( vsParams[3], frDest, vtExtr))
return false ;
@@ -2471,7 +2471,7 @@ GdbExecutor::SurfTriMeshByScrewing( bool bMove, const STRVECTOR& vsParams)
// recupero la tolleranza lineare
if ( vsParams.size() == 7)
FromString( vsParams[6], dLinTol) ;
// non c'é movimento lungo l'asse
// non c'é movimento lungo l'asse
}
// recupero il riferimento del gruppo destinazione
Frame3d frDest ;
@@ -2642,7 +2642,7 @@ GdbExecutor::SurfTrimeshClonePart( const STRVECTOR& vsParams)
// Parametri : IdNew, IdOld, IdParent, nPart
if ( vsParams.size() != 4)
return false ;
// Recupero il riferimento in cui è immerso
// Recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[2]), frRef))
return false ;
@@ -2785,7 +2785,7 @@ GdbExecutor::VolZmapCreate( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptO, dLengthX, dLengthY, dLengthZ, dPrec [, bTriDexel]
if ( vsParams.size() < 7)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -2829,7 +2829,7 @@ GdbExecutor::VolZmapCreateFromFlatRegion( const STRVECTOR& vsParams)
// parametri : Id, IdParent, idCurv, dPrec, dLengthZ [, bTriDexel]
if ( vsParams.size() < 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -2867,7 +2867,7 @@ GdbExecutor::VolZmapCreateFromTriMesh( const STRVECTOR& vsParams)
// parametri : Id, IdParent, idSurf, dPrec, bFlag
if ( vsParams.size() != 5)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -2900,7 +2900,7 @@ GdbExecutor::VolZmapMilling( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptPs, ptPe, vtVs, vtVe, dLinTol, dAngTolDeg (dLinTol e dAngTol sono per lavo con gen tool), bType
if ( vsParams.size() != 9)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3019,7 +3019,7 @@ bool GdbExecutor::VolZmapDeepnessMeasure( const STRVECTOR& vsParams) {
VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nZmapId)) ;
if ( pZmap == nullptr)
return false ;
// recupero il riferimento in cui è immerso lo Zmap
// recupero il riferimento in cui è immerso lo Zmap
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3051,7 +3051,7 @@ GdbExecutor::VolZmapBBoxZmapIntersection( const STRVECTOR& vsParams)
VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nZmapId)) ;
if ( pZmap == nullptr)
return false ;
// recupero il riferimento in cui è immerso lo Zmap
// recupero il riferimento in cui è immerso lo Zmap
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3096,7 +3096,7 @@ GdbExecutor::VolZmapBBoxZmapIntersection( const STRVECTOR& vsParams)
// VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nZmapId)) ;
// if ( pZmap == nullptr)
// return false ;
// // recupero il riferimento in cui è immerso lo Zmap
// // recupero il riferimento in cui è immerso lo Zmap
// Frame3d frRef ;
// if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
// return false ;
@@ -3143,7 +3143,7 @@ GdbExecutor::VolZmapBBoxZmapIntersection( const STRVECTOR& vsParams)
// VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nZmapId)) ;
// if ( pZmap == nullptr)
// return false;
// // recupero il riferimento in cui è immerso lo Zmap
// // recupero il riferimento in cui è immerso lo Zmap
// Frame3d frRef ;
// if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
// return false ;
@@ -3213,7 +3213,7 @@ GdbExecutor::LineDiscInters( const STRVECTOR& vsParams)
{ // parametri : Id, IdParent, ptDisc, ptLine, vtDisc, vtLine, dRad
if ( vsParams.size() < 7)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3281,7 +3281,7 @@ GdbExecutor::RayDiscInters( const STRVECTOR& vsParams)
{ // parametri : Id, IdParent, ptDisc, ptLine, vtDisc, vtLine, dRad
if ( vsParams.size() < 7)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3349,7 +3349,7 @@ GdbExecutor::SegmentDiscInters( const STRVECTOR& vsParams)
{ // parametri : Id, IdParent, ptDisc, ptLine, vtDisc, vtLine, dRad, dLen
if ( vsParams.size() < 7)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3421,7 +3421,7 @@ GdbExecutor::LineSphereInters( const STRVECTOR& vsParams)
{ // parametri : Id, IdParent, ptC, ptP, vtV, dRad
if ( vsParams.size() < 6)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3472,7 +3472,7 @@ GdbExecutor::RaySphereInters( const STRVECTOR& vsParams)
{ // parametri : Id, IdParent, ptC, ptP, vtV, dRad
if ( vsParams.size() < 6)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3530,7 +3530,7 @@ GdbExecutor::SegmentSphereInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptC, ptP, vtV, dRad, dLen
if ( vsParams.size() < 7)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3594,7 +3594,7 @@ GdbExecutor::LineSemiSphereInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptC, ptP, vtSphOr, vtV, dRad
if ( vsParams.size() < 7)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3651,7 +3651,7 @@ GdbExecutor::RaySemiSphereInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptC, ptP, vtSphOr, vtV, dRad
if ( vsParams.size() < 7)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3714,7 +3714,7 @@ GdbExecutor::SegmentSemiSphereInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptC, ptP, vtSphOr, vtV, dRad, dLen
if ( vsParams.size() < 8)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3783,7 +3783,7 @@ GdbExecutor::LinCompSemiSphereInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptC, ptP, vtSphOr, vtV, dRad, dLen, nLinType
if ( vsParams.size() < 9)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3854,7 +3854,7 @@ GdbExecutor::LineInfiniteCylinderInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptCyl, ptLine, vtCyl, vtLine, dRad
if ( vsParams.size() < 7)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3923,7 +3923,7 @@ GdbExecutor::RayInfiniteCylinderInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptCyl, ptLine, vtCyl, vtLine, dRad
if ( vsParams.size() < 7)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -3992,7 +3992,7 @@ GdbExecutor::SegmentInfiniteCylinderInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptCyl, ptLine, vtCyl, vtLine, dRad, dLen
if ( vsParams.size() < 8)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -4064,7 +4064,7 @@ GdbExecutor::SegmentCylinderInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptCyl, ptLine, vtCyl, vtLine, dRad, dCylHeigth, dLen
if ( vsParams.size() < 9)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -4140,7 +4140,7 @@ GdbExecutor::SegmentConeInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptVCone, ptLine, vtCone, vtLine, dRad, dCylHeigth, dLen
if ( vsParams.size() < 9)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -4221,7 +4221,7 @@ GdbExecutor::LineTruncateConeInters( const STRVECTOR& vsParams)
{ // parametri : Id, IdParent, ptMinBase, ptLine, vtCone, vtLine, dMinRad, dMaxRad, dConeHeigth
if ( vsParams.size() < 9)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -4303,7 +4303,7 @@ GdbExecutor::RayTruncateConeInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptMinBase, ptLine, vtCone, vtLine, dMinRad, dMaxRad, dConeHeigth
if ( vsParams.size() < 9)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -4384,7 +4384,7 @@ GdbExecutor::SegmentTruncateConeInters( const STRVECTOR& vsParams)
{ // parametri : Id, IdParent, ptMinBase, ptLine, vtCone, vtLine, dMinRad, dMaxRad, dConeHeigth
if ( vsParams.size() < 10)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -4469,7 +4469,7 @@ GdbExecutor::LineTorusInters( const STRVECTOR& vsParams)
{ // parametri : Id, IdParent, ptTorus, ptLine, vtTorus, vtLine, dMinRad, dMaxRad,
if ( vsParams.size() < 8)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -4584,7 +4584,7 @@ GdbExecutor::RayTorusInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptTorus, ptLine, vtTorus, vtLine, dMinRad, dMaxRad,
if ( vsParams.size() < 8)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -4734,7 +4734,7 @@ GdbExecutor::SegmentTorusInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptTorus, ptLine, vtTorus, vtLine, dMinRad, dMaxRad, dSgLen
if ( vsParams.size() < 9)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -4903,7 +4903,7 @@ GdbExecutor::LinCompTorusPartInters( const STRVECTOR& vsParams)
// parametri : Id, IdParent, ptTorus, ptLine, vtTorus, vtLine, dMinRad, dMaxRad, dSgLen, nLinType
if ( vsParams.size() < 10)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -5124,7 +5124,7 @@ GdbExecutor::ExecuteDistPointTrimesh( const std::string& sCmd2, const STRVECTOR&
// parametri : Id, IdMovedTria, IdParent, ptP, idSurf
if ( vsParams.size() != 4)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -5228,7 +5228,7 @@ GdbExecutor::TextSimple( const STRVECTOR& vsParams)
// parametri : Id, ParentId, Text, Point, AngDeg, H
if ( vsParams.size() != 6)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -5266,7 +5266,7 @@ GdbExecutor::TextComplete( const STRVECTOR& vsParams)
// parametri : Id, ParentId, Text, Point, AngDeg, Font, W, Italic, H, Rat, AddAdv, PosIns
if ( vsParams.size() != 12)
return false ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
@@ -5486,7 +5486,7 @@ GdbExecutor::AddGeoObj( const string& sId, const string& sIdParent, IGeoObj* pGe
// creo il gruppo
int nId = GetIdParam( sId, true) ;
int nIdNew = m_pGDB->AddGeoObj( nId, GetIdParam( sIdParent), pGeoObj) ;
// se nId da calcolare, può essere una variabile a cui cambiare il valore
// se nId da calcolare, può essere una variabile a cui cambiare il valore
if ( nId == GDB_ID_NULL)
m_pParser->SetVariable( sId, nIdNew) ;
@@ -5600,9 +5600,9 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
// ci deve essere almeno un parametro
if ( vsParams.size() < 1)
return false ;
// recupero l'indice dell'entità indicata dal primo parametro
// recupero l'indice dell'entità indicata dal primo parametro
int nIdEnt = GetIdParam( vsParams[0]) ;
// recupero il riferimento in cui è immersa
// recupero il riferimento in cui è immersa
Frame3d frEnt ;
if ( ! m_pGDB->GetGlobFrame( nIdEnt, frEnt))
return false ;
@@ -5623,7 +5623,7 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
return false ;
}
}
// se entità geometrica
// se entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = m_pGDB->GetGeoObj( nIdEnt)) != nullptr) {
// se curva
@@ -5659,7 +5659,7 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
return false ;
return vtV.LocToLoc( frEnt, frVect) ;
}
case 'N' : // versore direzione nel punto più vicino a punto dato
case 'N' : // versore direzione nel punto più vicino a punto dato
{
// secondo parametro : punto di riferimento
Point3d ptRef ;
@@ -5669,7 +5669,7 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
ICurve::Side nSide = ICurve::FROM_MINUS ;
if ( vsParams.size() >= 3 && vsParams[2] == "+")
nSide = ICurve::FROM_PLUS ;
// calcolo il parametro del punto della curva più vicino al punto di riferimento
// calcolo il parametro del punto della curva più vicino al punto di riferimento
DistPointCurve dstPC( ptRef, *pCrv) ;
int nFlag ;
double dU ;
@@ -5723,7 +5723,7 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
}
return false ;
}
// altrimenti nome di vettore già nel DB
// altrimenti nome di vettore già nel DB
else {
int nIdEnt = GetIdParam( sParam) ;
const IGeoVector3d* pV ;
@@ -5742,7 +5742,7 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
bool
GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d& ptP)
{
// se insieme di 2 o 3 coordinate (considerate già nel riferimento frPnt)
// se insieme di 2 o 3 coordinate (considerate già nel riferimento frPnt)
if ( sParam[0] == '(') {
// divido in parti
STRVECTOR vsParams ;
@@ -5766,7 +5766,7 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
else
return false ;
}
// se altrimenti punto predefinito ORIG (considerato già nel riferimento frPnt)
// se altrimenti punto predefinito ORIG (considerato già nel riferimento frPnt)
else if ( sParam == "ORIG") {
ptP = ORIG ;
return true ;
@@ -5784,9 +5784,9 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
// ci deve essere almeno un parametro
if ( vsParams.size() < 1)
return false ;
// recupero l'indice dell'entità indicata dal primo parametro
// recupero l'indice dell'entità indicata dal primo parametro
int nIdEnt = GetIdParam( vsParams[0]) ;
// recupero il riferimento in cui è immersa
// recupero il riferimento in cui è immersa
Frame3d frEnt ;
if ( ! m_pGDB->GetGlobFrame( nIdEnt, frEnt))
return false ;
@@ -5801,7 +5801,7 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
return false ;
}
}
// se entità geometrica
// se entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = m_pGDB->GetGeoObj( nIdEnt)) != nullptr) {
// se curva
@@ -5835,13 +5835,13 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
return false ;
return ptP.LocToLoc( frEnt, frPnt) ;
}
case 'N' : // punto più vicino a punto dato
case 'N' : // punto più vicino a punto dato
{
// secondo parametro : punto di riferimento
Point3d ptRef ;
if ( vsParams.size() < 2 || ! GetPointParam( vsParams[1], frEnt, ptRef))
return false ;
// calcolo il punto della curva più vicino al punto di riferimento
// calcolo il punto della curva più vicino al punto di riferimento
DistPointCurve dstPC( ptRef, *pCrv) ;
int nFlag ;
if ( ! dstPC.GetMinDistPoint( 0, ptP, nFlag))
@@ -5859,11 +5859,11 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
const ICurve* pCrv2 = GetCurve( pGObj2) ;
if ( pCrv2 == nullptr)
return false ;
// recupero il riferimento in cui è immersa
// recupero il riferimento in cui è immersa
Frame3d frEnt2 ;
if ( ! m_pGDB->GetGlobFrame( nIdEnt2, frEnt2))
return false ;
// se il riferimento è diverso da quello della prima entità, devo trasformarla
// se il riferimento è diverso da quello della prima entità, devo trasformarla
PtrOwner<ICurve> pcrvTrans( nullptr) ;
if ( ! AreSameFrame( frEnt, frEnt2)) {
pcrvTrans.Set( pCrv2->Clone()) ;
@@ -5876,7 +5876,7 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
Point3d ptRef ;
if ( vsParams.size() >= 3 && ! GetPointParam( vsParams[2], frEnt, ptRef))
return false ;
// calcolo il punto di intersezione sulla prima curva più vicino al punto di riferimento
// calcolo il punto di intersezione sulla prima curva più vicino al punto di riferimento
IntersCurveCurve intCC( *pCrv, *pCrv2, true) ;
if ( ! intCC.GetIntersPointNearTo( 0, ptRef, ptP))
return false ;
@@ -5938,7 +5938,7 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
}
return false ;
}
// altrimenti nome di punto già nel DB
// altrimenti nome di punto già nel DB
else {
int nIdEnt = GetIdParam( sParam) ;
const IGeoPoint3d* pPt ;
@@ -6015,7 +6015,7 @@ GdbExecutor::GetPointWParam( const string& sParam, const Frame3d& frPnt, Point3d
FromString( vsParams[1], ptP.y) &&
FromString( vsParams[2], dW)) ;
}
// se 2 parti, nome di punto predefinito, punto notevole o già nel DB e un peso
// se 2 parti, nome di punto predefinito, punto notevole o già nel DB e un peso
else if ( vsParams.size() == 2) {
// recupero il punto
if ( ! GetPointParam( vsParams[0], frPnt, ptP))
@@ -6065,7 +6065,7 @@ GdbExecutor::GetLengthParam( const string& sParam, double& dLen)
// ci deve essere almeno un parametro
if ( vsParams.size() < 1)
return false ;
// recupero l'entità indicata dal primo parametro
// recupero l'entità indicata dal primo parametro
const IGeoObj* pGObj ;
if ( ( pGObj = m_pGDB->GetGeoObj( GetIdParam( vsParams[0]))) == nullptr)
return false ;
@@ -6088,7 +6088,7 @@ GdbExecutor::GetLengthParam( const string& sParam, double& dLen)
// ci deve essere almeno un parametro
if ( vsParams.size() < 1)
return false ;
// recupero l'entità indicata dal primo parametro
// recupero l'entità indicata dal primo parametro
const IGeoObj* pGObj ;
if ( ( pGObj = m_pGDB->GetGeoObj( GetIdParam( vsParams[0]))) == nullptr)
return false ;
@@ -6124,12 +6124,12 @@ GdbExecutor::GetDirParam( const string& sParam, const Frame3d& frDir, double& dD
// ci deve essere almeno un parametro
if ( vsParams.size() < 1)
return false ;
// recupero l'entità indicata dal primo parametro
// recupero l'entità indicata dal primo parametro
int nIdEnt = GetIdParam( vsParams[0]) ;
const IGeoObj* pGObj ;
if ( ( pGObj = m_pGDB->GetGeoObj( nIdEnt)) == nullptr)
return false ;
// recupero il riferimento in cui è immersa
// recupero il riferimento in cui è immersa
Frame3d frEnt ;
if ( ! m_pGDB->GetGlobFrame( nIdEnt, frEnt))
return false ;
@@ -6143,7 +6143,7 @@ GdbExecutor::GetDirParam( const string& sParam, const Frame3d& frDir, double& dD
if ( ! pCrv->GetStartDir( vtDir) || ! vtDir.LocToLoc( frEnt, frDir))
return false ;
vtDir.ToSpherical( nullptr, nullptr, &dDir) ;
// se esiste un secondo parametro è un offset di rotazione
// se esiste un secondo parametro è un offset di rotazione
if ( vsParams.size() >= 2) {
double dOffsetDeg = 0 ;
FromString( vsParams[1], dOffsetDeg) ;
@@ -6154,7 +6154,7 @@ GdbExecutor::GetDirParam( const string& sParam, const Frame3d& frDir, double& dD
if ( ! pCrv->GetEndDir( vtDir) || ! vtDir.LocToLoc( frEnt, frDir))
return false ;
vtDir.ToSpherical( nullptr, nullptr, &dDir) ;
// se esiste un secondo parametro è un offset di rotazione
// se esiste un secondo parametro è un offset di rotazione
if ( vsParams.size() >= 2) {
double dOffsetDeg = 0 ;
FromString( vsParams[1], dOffsetDeg) ;
@@ -6165,7 +6165,7 @@ GdbExecutor::GetDirParam( const string& sParam, const Frame3d& frDir, double& dD
if ( ! pCrv->GetMidDir( vtDir) || ! vtDir.LocToLoc( frEnt, frDir))
return false ;
vtDir.ToSpherical( nullptr, nullptr, &dDir) ;
// se esiste un secondo parametro è un offset di rotazione
// se esiste un secondo parametro è un offset di rotazione
if ( vsParams.size() >= 2) {
double dOffsetDeg = 0 ;
FromString( vsParams[1], dOffsetDeg) ;
@@ -6196,7 +6196,7 @@ GdbExecutor::GetDirParam( const string& sParam, const Frame3d& frDir, double& dD
}
return true ;
}
case 'N' : // versore direzione nel punto più vicino a punto dato
case 'N' : // versore direzione nel punto più vicino a punto dato
{
// secondo parametro : punto di riferimento
Point3d ptRef ;
@@ -6206,7 +6206,7 @@ GdbExecutor::GetDirParam( const string& sParam, const Frame3d& frDir, double& dD
ICurve::Side nSide = ICurve::FROM_MINUS ;
if ( vsParams.size() >= 3 && vsParams[2] == "+")
nSide = ICurve::FROM_PLUS ;
// calcolo il parametro del punto della curva più vicino al punto di riferimento
// calcolo il parametro del punto della curva più vicino al punto di riferimento
DistPointCurve dstPC( ptRef, *pCrv) ;
int nFlag ;
double dU ;
@@ -6236,7 +6236,7 @@ GdbExecutor::GetDirParam( const string& sParam, const Frame3d& frDir, double& dD
Vector3d vtDir = pGVect->GetVector() ;
vtDir.LocToLoc( frEnt, frDir) ;
vtDir.ToSpherical( nullptr, nullptr, &dDir) ;
// se esiste un secondo parametro è un offset di rotazione
// se esiste un secondo parametro è un offset di rotazione
if ( vsParams.size() >= 2) {
double dOffsetDeg = 0 ;
FromString( vsParams[1], dOffsetDeg) ;
@@ -6294,7 +6294,7 @@ GdbExecutor::GetFrameParam( const string& sParam, const Frame3d& frRef, Frame3d&
STRVECTOR::iterator Iter ;
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
Trim( (*Iter), " \t\r\n") ;
// se c'è un parametro è l'origine
// se c'è un parametro è l'origine
Point3d ptOrig ;
if ( vsParams.size() >= 1) {
if ( ! GetPointParam( vsParams[0], frRef, ptOrig))
@@ -6325,11 +6325,11 @@ GdbExecutor::GetFrameParam( const string& sParam, const Frame3d& frRef, Frame3d&
}
return true ;
}
// altrimenti nome di gruppo o di frame già nel DB
// altrimenti nome di gruppo o di frame già nel DB
else {
// identificativo
int nIdEnt = GetIdParam( sParam) ;
// recupero il riferimento in cui è immerso
// recupero il riferimento in cui è immerso
Frame3d frEnt ;
if ( ! m_pGDB->GetGlobFrame( nIdEnt, frEnt))
return false ;
@@ -6337,7 +6337,7 @@ GdbExecutor::GetFrameParam( const string& sParam, const Frame3d& frRef, Frame3d&
if ( m_pGDB->GetGroupFrame( nIdEnt, frF)) {
return frF.LocToLoc( frEnt, frRef) ;
}
// altrimenti entità geometrica
// altrimenti entità geometrica
else {
// verifico se riferimento
const IGeoFrame3d* pFr ;
@@ -6393,7 +6393,7 @@ GdbExecutor::GetColorParam( const string& sParam, bool& bByParent, Color& cCol)
// ci deve essere un parametro
if ( vsParams.size() != 1)
return false ;
// recupero il colore dell'entità indicata dal parametro
// recupero il colore dell'entità indicata dal parametro
bByParent = false ;
return m_pGDB->GetCalcMaterial( GetIdParam( vsParams[0]), cCol) ;
}
@@ -6427,7 +6427,7 @@ GdbExecutor::GetMaterialParam( const string& sParam, bool& bByParent, int& nMat)
// ci deve essere un parametro
if ( vsParams.size() != 1)
return false ;
// recupero il materiale dell'entità indicata dal parametro
// recupero il materiale dell'entità indicata dal parametro
bByParent = false ;
return ( m_pGDB->GetCalcMaterial( GetIdParam( vsParams[0]), nMat) && nMat != GDB_MT_COLOR) ;
}
@@ -6975,7 +6975,7 @@ GdbExecutor::ExecuteCopy( const string& sCmd2, const STRVECTOR& vsParams)
nIdNew = m_pGDB->CopyGlob( GetIdParam( vsParams[0]), nIdDest, GetIdParam( vsParams[2]), nSonBeforeAfter) ;
else
nIdNew = m_pGDB->Copy( GetIdParam( vsParams[0]), nIdDest, GetIdParam( vsParams[2]), nSonBeforeAfter) ;
// se IdDest da calcolare, può essere una variabile a cui cambiare il valore
// se IdDest da calcolare, può essere una variabile a cui cambiare il valore
if ( nIdDest == GDB_ID_NULL)
m_pParser->SetVariable( vsParams[1], nIdNew) ;
@@ -7647,7 +7647,7 @@ GdbExecutor::CurveCopyBySplitClass( const STRVECTOR& vsParams)
IntersCurveCurve intCC( *pCrv, *pCloCrv, true) ;
// recupero la classificazione della prima curva
CRVCVECTOR ccClass ;
if ( ! intCC.GetCurveClassification( 0, ccClass))
if ( ! intCC.GetCurveClassification( 0, EPS_SMALL, ccClass))
return false ;
// recupero gli indici dei gruppi destinazione e i loro riferimenti
const int N_GRP = 4 ;
@@ -7877,7 +7877,7 @@ GdbExecutor::ExecuteOutTextIcci( const string& sCmd2, const STRVECTOR& vsParams)
// devono essere 6 parametri : IdText, IdGroup, IdEnt1, IdEnt2, ptText, hText
if ( vsParams.size() != 6)
return false ;
// recupero l'indice delle entità
// recupero l'indice delle entità
int nIdEnt1 = GetIdParam( vsParams[2]) ;
int nIdEnt2 = GetIdParam( vsParams[3]) ;
// verifico siano due curve
@@ -7894,7 +7894,7 @@ GdbExecutor::ExecuteOutTextIcci( const string& sCmd2, const STRVECTOR& vsParams)
Frame3d frEnt2 ;
if ( ! m_pGDB->GetGlobFrame( nIdEnt2, frEnt2))
return false ;
// se i riferimenti sono diversi, porto la seconda entità nel riferimento della prima
// se i riferimenti sono diversi, porto la seconda entità nel riferimento della prima
PtrOwner<ICurve> pcrvTrans ;
if ( ! AreSameFrame( frEnt1, frEnt2)) {
pcrvTrans.Set( pCrv2->Clone()) ;
@@ -7953,7 +7953,7 @@ GdbExecutor::ExecuteOutTextIcci( const string& sCmd2, const STRVECTOR& vsParams)
}
}
}
// recupero il riferimento in cui è immerso il testo
// recupero il riferimento in cui è immerso il testo
Frame3d frText ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frText))
return false ;
@@ -8090,7 +8090,7 @@ bool
GdbExecutor::OutGroupTsc( int nId, int nFlag, int nLev)
{
m_OutTsc.Remark( "Start Group ---") ;
// emetto dati gruppo ( se non è radice)
// emetto dati gruppo ( se non è radice)
if ( nId > GDB_ID_ROOT) {
Frame3d frFrame ;
if ( ( nLev == 0 && m_pGDB->GetGroupGlobFrame( nId, frFrame)) ||
@@ -8113,7 +8113,7 @@ GdbExecutor::OutGroupTsc( int nId, int nFlag, int nLev)
}
}
}
// emetto entità gruppo
// emetto entità gruppo
m_OutTsc.Remark( "Entities :") ;
GdbIterator Iter( m_pGDB) ;
bool bNext = Iter.GoToFirstInGroup( nId) ;
+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)
{
}
+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
} ;
+10 -8
View File
@@ -391,7 +391,7 @@ IntersCurveCurve::GetIntersPointNearTo( int nCrv, const Point3d& ptNear, Point3d
//----------------------------------------------------------------------------
bool
IntersCurveCurve::GetCurveClassification( int nCrv, CRVCVECTOR& ccClass)
IntersCurveCurve::GetCurveClassification( int nCrv, double dLenMin, CRVCVECTOR& ccClass)
{
// pulisco vettore classificazioni
ccClass.clear() ;
@@ -407,7 +407,7 @@ IntersCurveCurve::GetCurveClassification( int nCrv, CRVCVECTOR& ccClass)
return false ;
// se esiste almeno una intersezione
if ( m_nIntersCount >= 1)
return CalcCurveClassification( m_pCurve[0], m_Info, ccClass) ;
return CalcCurveClassification( m_pCurve[0], m_Info, dLenMin, ccClass) ;
// altrimenti la curva è completamente interna oppure completamente esterna
else
return CalcCurveInOrOut( m_pCurve[0], m_pCurve[1], ccClass) ;
@@ -424,7 +424,7 @@ IntersCurveCurve::GetCurveClassification( int nCrv, CRVCVECTOR& ccClass)
SwapInfoAB( InfoTmp, 1) ;
// se esiste almeno una intersezione
if ( m_nIntersCount >= 1)
return CalcCurveClassification( m_pCurve[1], InfoTmp, ccClass) ;
return CalcCurveClassification( m_pCurve[1], InfoTmp, dLenMin, ccClass) ;
// altrimenti la curva è completamente interna oppure completamente esterna
else
return CalcCurveInOrOut( m_pCurve[1], m_pCurve[0], ccClass) ;
@@ -461,7 +461,7 @@ IntersCurveCurve::SwapInfoAB( ICCIVECTOR& Info, int IndCrvOrd)
//----------------------------------------------------------------------------
bool
IntersCurveCurve::CalcCurveClassification( const ICurve* pCurve, const ICCIVECTOR& Info, CRVCVECTOR& ccClass)
IntersCurveCurve::CalcCurveClassification( const ICurve* pCurve, const ICCIVECTOR& Info, double dLenMin, CRVCVECTOR& ccClass)
{
// numero intersezioni
int nNumInters = int( Info.size()) ;
@@ -471,6 +471,8 @@ IntersCurveCurve::CalcCurveClassification( const ICurve* pCurve, const ICCIVECTO
double dStartPar, dEndPar ;
if ( pCurve == nullptr || ! pCurve->GetDomain( dStartPar, dEndPar))
return false ;
// limito lunghezza minima
dLenMin = max( dLenMin, EPS_ZERO) ;
// elimino intersezioni senza attraversamento che giacciono in intervalli di sovrapposizione
ICCIVECTOR InfoCorr ;
InfoCorr.reserve( Info.size()) ;
@@ -527,7 +529,7 @@ IntersCurveCurve::CalcCurveClassification( const ICurve* pCurve, const ICCIVECTO
for ( int i = 0 ; i < nNumInters ; ++ i) {
// se è definito un tratto precedente
double dLenU ; pCurve->GetLengthAtParam( InfoCorr[i].IciA[0].dU, dLenU) ;
if ( InfoCorr[i].IciA[0].dU > dCurrPar + EPS_PARAM && dLenU - dCurrLen > EPS_SMALL) {
if ( InfoCorr[i].IciA[0].dU > dCurrPar + EPS_PARAM && dLenU - dCurrLen > dLenMin) {
// verifico che la definizione sul tratto sia omogenea e valida
int nPrevTy = InfoCorr[i].IciA[0].nPrevTy ;
if ( ( nLastTy != ICCT_NULL && nPrevTy != nLastTy) ||
@@ -562,7 +564,7 @@ IntersCurveCurve::CalcCurveClassification( const ICurve* pCurve, const ICCIVECTO
}
}
// eventuale tratto finale rimasto
if ( dCurrPar < dEndPar - EPS_PARAM && dEndLen - dCurrLen > EPS_SMALL) {
if ( dCurrPar < dEndPar - EPS_PARAM && dEndLen - dCurrLen > dLenMin) {
// verifico che la definizione sul tratto sia valida
if ( nLastTy == ICCT_NULL || nLastTy == ICCT_ON)
return false ;
@@ -673,7 +675,7 @@ IntersCurveCurve::GetRegionCurveClassification( void)
{
// classifico la prima curva rispetto alla seconda
CRVCVECTOR ccClass ;
if ( ! GetCurveClassification( 0, ccClass))
if ( ! GetCurveClassification( 0, EPS_SMALL, ccClass))
return CCREGC_NULL ;
// derivo la classificazione delle curve come regioni
bool bIn = false ;
@@ -710,7 +712,7 @@ IntersCurveCurve::GetRegionCurveClassification( void)
if ( bOnP)
return CCREGC_IN2 ;
CRVCVECTOR ccClass2 ;
if ( ! GetCurveClassification( 1, ccClass2) || ccClass2.empty())
if ( ! GetCurveClassification( 1, EPS_SMALL, ccClass2) || ccClass2.empty())
return CCREGC_NULL ;
if ( ccClass2[0].nClass == CRVC_OUT)
return CCREGC_OUT ;
+52 -15
View File
@@ -68,18 +68,36 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
{
// pulisco tutto
Reset() ;
// verifico se la curva è un segmento di retta
bool bIsLine = false ;
const CurveLine* pLine = GetBasicCurveLine( pCrv) ;
if ( pLine != nullptr)
bIsLine = true ;
else {
const CurveComposite* pCompo = GetBasicCurveComposite( pCrv) ;
Point3d ptStart, ptEnd ;
if ( pCompo != nullptr && pCompo->IsALine( 10 * EPS_SMALL, ptStart, ptEnd))
bIsLine = true ;
}
// verifico che la curva esista e sia piana
Plane3d plPlane ;
if ( pCrv == nullptr || ! pCrv->IsFlat( plPlane))
if ( pCrv == nullptr || ! pCrv->IsFlat( plPlane, bIsLine, 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 +120,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 +130,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+)
@@ -429,7 +460,7 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
inOk.Set( dStart, dEnd) ;
IntersCurveCurve ccInt( *pCrv, *pCircS) ;
CRVCVECTOR ccPart ;
if ( ! ccInt.GetCurveClassification( 0, ccPart))
if ( ! ccInt.GetCurveClassification( 0, EPS_SMALL, ccPart))
return false ;
for ( auto& ccOne : ccPart) {
switch ( ccOne.nClass) {
@@ -478,7 +509,7 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
inOk.Set( dStart, dEnd) ;
IntersCurveCurve ccInt( *pCrv, *pCircE) ;
CRVCVECTOR ccPart ;
if ( ! ccInt.GetCurveClassification( 0, ccPart))
if ( ! ccInt.GetCurveClassification( 0, EPS_SMALL, ccPart))
return false ;
for ( auto& ccOne : ccPart) {
switch ( ccOne.nClass) {
@@ -601,9 +632,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
+223 -5
View File
@@ -22,6 +22,7 @@
#include "/EgtDev/Include/EGkPolyLine.h"
#include "/EgtDev/Include/EGkPlane3d.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ;
@@ -829,12 +830,11 @@ PolyLine::MyChangeStart( int nPos)
// solo per polilinee chiuse
if ( ! IsClosed())
return false ;
// cancello ultimo punto ( coincide con primo)
// cancello l'ultimo punto ( coincide con il primo)
m_lUPoints.pop_back() ;
// 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
// sposto la parte iniziale dei punti alla fine
m_lUPoints.splice( m_lUPoints.end(), m_lUPoints, m_lUPoints.begin(), next( m_lUPoints.begin(), nPos)) ;
// aggiungo il punto finale come copia dell'iniziale
m_lUPoints.push_back( m_lUPoints.front()) ;
return true ;
@@ -1296,3 +1296,221 @@ PolyLine::Trim( const Plane3d& plPlane, bool bInVsOut)
return true ;
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
bool
DistPointPolyLine( const Point3d& ptP, const PolyLine& plPoly, double& dDist)
{
// La polilinea deve contenere almeno due punti
if ( plPoly.GetPointNbr() < 2)
return false ;
// Ciclo sui punti della polilinea
dDist = INFINITO ;
Point3d ptStart, ptEnd ;
plPoly.GetFirstPoint( ptStart) ;
while ( plPoly.GetNextPoint( ptEnd)) {
// distanza del punto dal segmento della polilinea
DistPointLine PointLineDistCalc( ptP, ptStart, ptEnd) ;
double dPlDist ;
PointLineDistCalc.GetDist( dPlDist) ;
if ( dPlDist < dDist)
dDist = dPlDist ;
// assegno nuovo inizio
ptStart = ptEnd ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
IsPointInsidePolyLine( const Point3d& ptP, const PolyLine& plPoly, double dToler)
{
// La polilinea deve essere chiusa e piatta, altrimenti non ha senso parlare di interno
Plane3d plPlane ;
double dArea ;
if ( ! plPoly.IsClosedAndFlat( plPlane, dArea, 10 * EPS_SMALL))
return false ;
// Impongo l'orientamento CCW
if ( dArea < 0)
plPlane.Invert() ;
// Il punto deve giacere nel piano della polilinea
if ( ! PointInPlaneEpsilon( ptP, plPlane, 10 * EPS_SMALL))
return false ;
// Riferimento alla lista dei punti
PNTULIST& List = const_cast<PolyLine&>( plPoly).GetUPointList() ;
// Ciclo sui segmenti della polilinea per cercare il segmento più vicino al punto
double dMinSqDist = SQ_INFINITO ;
Point3d ptMinDist ;
auto itMinDistEnd = List.end() ;
auto itStart = List.begin() ;
auto itEnd = next( itStart) ;
for ( ; itEnd != List.end() ; ++ itStart, ++ itEnd) {
// Distanza del punto dal segmento corrente
DistPointLine dDistCalc( ptP, itStart->first, itEnd->first) ;
double dSqDist ;
if ( dDistCalc.GetSqDist( dSqDist) && dSqDist < dMinSqDist) {
dMinSqDist = dSqDist ;
dDistCalc.GetMinDistPoint( ptMinDist) ;
itMinDistEnd = itEnd ;
}
}
// Determino tangente di riferimento
Vector3d vtTang ;
// se minima distanza nell'estremo iniziale del segmento
if ( AreSamePointApprox( ptMinDist, prev( itMinDistEnd)->first)) {
// direzione del segmento
Vector3d vtCurrTg = itMinDistEnd->first - prev( itMinDistEnd)->first ;
vtCurrTg.Normalize() ;
// direzione del segmento precedente
Vector3d vtPrevTg ;
if ( prev( itMinDistEnd) != List.begin())
vtPrevTg = prev( itMinDistEnd)->first - prev( itMinDistEnd, 2)->first ;
else
vtPrevTg = prev( itMinDistEnd)->first - prev( List.rbegin())->first ;
vtPrevTg.Normalize() ;
// tangente media
vtTang = vtPrevTg + vtCurrTg ;
vtTang.Normalize() ;
}
// se altrimenti minima distanza nell'estremo finale del segmento
else if ( AreSamePointApprox( ptMinDist, itMinDistEnd->first)) {
// direzione del segmento
Vector3d vtCurrTg = itMinDistEnd->first - prev( itMinDistEnd)->first ;
vtCurrTg.Normalize() ;
// direzione del segmento successivo
Vector3d vtNextTg ;
if ( next( itMinDistEnd) != List.end())
vtNextTg = next( itMinDistEnd)->first - itMinDistEnd->first ;
else
vtNextTg = next( List.begin())->first - itMinDistEnd->first ;
vtNextTg.Normalize() ;
// tangente media
vtTang = vtCurrTg + vtNextTg ;
vtTang.Normalize() ;
}
// altrimenti minima distanza con l'interno
else {
vtTang = itMinDistEnd->first - prev( itMinDistEnd)->first ;
}
// Determino la posizione del punto
Vector3d vtDiff = ptP - ptMinDist ;
Vector3d vtOut = vtTang ^ plPlane.GetVersN() ;
vtOut.Normalize() ;
return ( vtDiff * vtOut < -dToler) ;
}
//----------------------------------------------------------------------------
bool
GetPointParamOnPolyLine( const Point3d& ptP, const PolyLine& plPoly, double dToler, double& dPar)
{
// La polilinea deve contenere almeno due punti
if ( plPoly.GetPointNbr() < 2)
return false ;
// Ciclo sui punti della polilinea
int nSeg = -1 ;
double dMinSqDist = SQ_INFINITO ;
double dMinPar = -1 ;
Point3d ptStart, ptEnd ;
plPoly.GetFirstPoint( ptStart) ;
while ( plPoly.GetNextPoint( ptEnd)) {
// aggiorno l'indice
++ nSeg ;
// distanza del punto dal segmento della polilinea
DistPointLine dDistCalc( ptP, ptStart, ptEnd) ;
double dSqDist ;
if ( dDistCalc.GetSqDist( dSqDist) && dSqDist < dMinSqDist) {
dMinSqDist = dSqDist ;
double dSegPar ;
dDistCalc.GetParamAtMinDistPoint( dSegPar) ;
dMinPar = nSeg + dSegPar ;
}
// assegno nuovo inizio
ptStart = ptEnd ;
}
// Il punto è sulla linea se la sua distanza rispetta la tolleranza
return ( dMinSqDist < dToler * dToler) ;
}
//----------------------------------------------------------------------------
bool
ChangePolyLineStart( PolyLine& plPoly, const Point3d& ptNewStart, double dToler)
{
// La polilinea deve essere chiusa
if ( ! plPoly.IsClosed())
return false ;
// Riferimento alla lista dei punti
PNTULIST& LoopList = const_cast<PolyLine&>( plPoly).GetUPointList() ;
// Ciclo sui segmenti della polilinea per cercare il segmento più vicino al punto
double dMinSqDist = SQ_INFINITO ;
auto itMinDistEnd = LoopList.end() ;
auto itStart = LoopList.begin() ;
auto itEnd = next( itStart) ;
for ( ; itEnd != LoopList.end() ; ++ itStart, ++ itEnd) {
// Distanza del punto dal segmento corrente
DistPointLine dDistCalc( ptNewStart, itStart->first, itEnd->first) ;
double dSqDist ;
if ( dDistCalc.GetSqDist( dSqDist) && dSqDist < dMinSqDist) {
dMinSqDist = dSqDist ;
itMinDistEnd = itEnd ;
}
}
// Se il punto non sta sulla polilinea, non ha senso cambiare l'inizio
if ( dMinSqDist > dToler * dToler)
return false ;
// Se il punto non coincide con un vertice, lo aggiungo
auto itNewStart = LoopList.end() ;
if ( AreSamePointApprox( ptNewStart, prev( itMinDistEnd)->first))
itNewStart = prev( itMinDistEnd) ;
else if ( AreSamePointApprox( ptNewStart, itMinDistEnd->first))
itNewStart = itMinDistEnd ;
else
itNewStart = LoopList.emplace( itMinDistEnd, ptNewStart, 0) ;
// Cancello l'ultimo punto ( coincide con il primo)
LoopList.pop_back() ;
// Sposto la parte iniziale dei punti alla fine
LoopList.splice( LoopList.end(), LoopList, LoopList.begin(), itNewStart) ;
// Aggiungo il punto finale come copia dell'iniziale
LoopList.push_back( LoopList.front()) ;
return true ;
}
//----------------------------------------------------------------------------
bool
SplitPolyLineAtPoint( const PolyLine& plPoly, const Point3d& ptP, double dToler, PolyLine& plPoly1, PolyLine& plPoly2)
{
// La polilinea deve contenere almeno due punti
if ( plPoly.GetPointNbr() < 2)
return false ;
// Riferimento alla lista dei punti
const PNTULIST& LoopList = const_cast<PolyLine&>( plPoly).GetUPointList() ;
// Ciclo sui segmenti della polilinea per cercare il segmento più vicino al punto
double dMinSqDist = SQ_INFINITO ;
auto itMinDistEnd = LoopList.end() ;
auto itStart = LoopList.begin() ;
auto itEnd = next( itStart) ;
for ( ; itEnd != LoopList.end() ; ++ itStart, ++ itEnd) {
// Distanza del punto dal segmento corrente
DistPointLine dDistCalc( ptP, itStart->first, itEnd->first) ;
double dSqDist ;
if ( dDistCalc.GetSqDist( dSqDist) && dSqDist < dMinSqDist) {
dMinSqDist = dSqDist ;
itMinDistEnd = itEnd ;
}
}
// Se il punto non sta sulla polilinea, non ha senso spezzare
if ( dMinSqDist > dToler * dToler)
return false ;
// Copio i punti opportuni nella prima parte
PNTULIST& LoopList1 = plPoly1.GetUPointList() ;
for ( auto it = LoopList.begin() ; it != itMinDistEnd ; ++ it)
LoopList1.emplace_back( it->first, it->second) ;
plPoly1.AddUPoint( 0, ptP) ;
// Copio i punti opportuni nella seconda parte
PNTULIST& LoopList2 = plPoly2.GetUPointList() ;
for ( auto it = itMinDistEnd ; it != LoopList.end() ; ++ it)
LoopList2.emplace_back( it->first, it->second) ;
plPoly2.AddUPoint( 0, ptP, false) ;
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
} ;
//-----------------------------------------------------------------------------
+15 -11
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() ;
@@ -162,7 +165,7 @@ SurfFlatRegion::AddSimpleExtLoop( ICurve* pCrv)
for ( auto i : m_vExtInd) {
IntersCurveCurve ccInt( *pMyCrv, *m_vpLoop[i]) ;
if ( ccInt.GetCrossOrOverlapIntersCount() > 0 ||
! ccInt.GetCurveClassification( 0, ccClass) ||
! ccInt.GetCurveClassification( 0, EPS_SMALL, ccClass) ||
ccClass.empty() || ccClass[0].nClass != CRVC_OUT) {
bOk = false ;
break ;
@@ -175,7 +178,7 @@ SurfFlatRegion::AddSimpleExtLoop( ICurve* pCrv)
continue ;
IntersCurveCurve ccInt( *pMyCrv, *m_vpLoop[i]) ;
if ( ccInt.GetCrossOrOverlapIntersCount() == 0 &&
ccInt.GetCurveClassification( 0, ccClass) &&
ccInt.GetCurveClassification( 0, EPS_SMALL, ccClass) &&
! ccClass.empty() && ccClass[0].nClass == CRVC_OUT) {
bOk = true ;
break ;
@@ -295,7 +298,7 @@ SurfFlatRegion::AddSimpleIntLoop( ICurve* pCrv)
IntersCurveCurve ccInt( *pMyCrv, *m_vpLoop[m_vExtInd[i]]) ;
CRVCVECTOR ccClass ;
if ( ccInt.GetCrossOrOverlapIntersCount() > 0 ||
! ccInt.GetCurveClassification( 0, ccClass) ||
! ccInt.GetCurveClassification( 0, EPS_SMALL, ccClass) ||
ccClass.empty() || ccClass[0].nClass != CRVC_IN)
continue ;
// verifica rispetto ai loop interni
@@ -306,7 +309,7 @@ SurfFlatRegion::AddSimpleIntLoop( ICurve* pCrv)
IntersCurveCurve ccInt2( *pMyCrv, *m_vpLoop[k]) ;
CRVCVECTOR ccClass2 ;
if ( ccInt2.GetCrossOrOverlapIntersCount() > 0 ||
! ccInt2.GetCurveClassification( 0, ccClass2) ||
! ccInt2.GetCurveClassification( 0, EPS_SMALL, ccClass2) ||
ccClass2.empty() || ccClass2[0].nClass != CRVC_IN) {
bOk = false ;
break ;
@@ -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()) ;
}
@@ -1146,7 +1150,7 @@ SurfFlatRegion::CloneChunk( int nChunk) const
//----------------------------------------------------------------------------
bool
SurfFlatRegion::MyGetCurveClassification( const ICurve& Crv, CRVCVECTOR& ccClass) const
SurfFlatRegion::MyGetCurveClassification( const ICurve& Crv, double dLenMin, CRVCVECTOR& ccClass) const
{
// la curva deve già essere nel riferimento intrinseco della regione
// verifico lo stato
@@ -1175,7 +1179,7 @@ SurfFlatRegion::MyGetCurveClassification( const ICurve& Crv, CRVCVECTOR& ccClass
IntersCurveCurve ccInt( Crv, *pLoop) ;
// classificazione
CRVCVECTOR ccPart ;
if ( ! ccInt.GetCurveClassification( 0, ccPart))
if ( ! ccInt.GetCurveClassification( 0, dLenMin, ccPart))
return false ;
for ( auto& ccOne : ccPart) {
switch ( ccOne.nClass) {
@@ -1268,7 +1272,7 @@ SurfFlatRegion::MyGetCurveClassification( const ICurve& Crv, CRVCVECTOR& ccClass
//----------------------------------------------------------------------------
bool
SurfFlatRegion::GetCurveClassification( const ICurve& Crv, CRVCVECTOR& ccClass) const
SurfFlatRegion::GetCurveClassification( const ICurve& Crv, double dLenMin, CRVCVECTOR& ccClass) const
{
// verifico lo stato
if ( m_nStatus != OK || m_vpLoop.empty())
@@ -1289,7 +1293,7 @@ SurfFlatRegion::GetCurveClassification( const ICurve& Crv, CRVCVECTOR& ccClass)
pCrvLoc = pCopyCrv ;
}
// esecuzione classificazione nel riferimento intrinseco
return MyGetCurveClassification( *pCrvLoc, ccClass) ;
return MyGetCurveClassification( *pCrvLoc, dLenMin, ccClass) ;
}
//----------------------------------------------------------------------------
+8 -7
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
@@ -91,7 +92,7 @@ class SurfFlatRegion : public ISurfFlatRegion, public IGeoObjRW
const SurfTriMesh* GetAuxSurf( void) const override ;
SurfFlatRegion* CloneChunk( int nChunk) const override ;
bool GetChunkCentroid( int nChunk, Point3d& ptCen) const override ;
bool GetCurveClassification( const ICurve& Crv, CRVCVECTOR& ccClass) const override ;
bool GetCurveClassification( const ICurve& Crv, double dLenMin, CRVCVECTOR& ccClass) const override ;
int GetChunkSimpleClassification( int nChunk, const ISurfFlatRegion& Other, int nOthChunk) const override ; // compare only outsides
public : // IGeoObjRW
@@ -130,7 +131,7 @@ class SurfFlatRegion : public ISurfFlatRegion, public IGeoObjRW
ICurve* GetMyLoop( int nChunk, int nLoop) const ; // nChunk 0-based, nLoop 0-based (1°esterno, successivi interni)
void ResetAuxSurf( void) const ;
bool ConvertArcsToBezierCurves( void) ;
bool MyGetCurveClassification( const ICurve& Crv, CRVCVECTOR& ccClass) const ;
bool MyGetCurveClassification( const ICurve& Crv, double dLenMin, CRVCVECTOR& ccClass) const ;
static bool MySelectCurves( const PCRV_DEQUE& vpLoop, const SurfFlatRegion& Other,
int nType1, bool bInvert1, int nType2, bool bInvert2, PCRV_DEQUE& vpCurve) ;
static bool MyChainCurves( PCRV_DEQUE& vpCurve, PCRV_DEQUE& vpLoop) ;
@@ -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
} ;
//-----------------------------------------------------------------------------
+2 -2
View File
@@ -289,7 +289,7 @@ SurfFlatRegion::MySelectCurves( const PCRV_DEQUE& vpLoop, const SurfFlatRegion&
for ( auto& pLoop : vpLoop) {
// eseguo classificazione
CRVCVECTOR ccClass ;
if ( ! Other.MyGetCurveClassification( *pLoop, ccClass))
if ( ! Other.MyGetCurveClassification( *pLoop, EPS_SMALL, ccClass))
return false ;
// creo intervalli validi, tenendo classificazioni ricevute
Intervals inOk1( EPS_PARAM), inOk2( EPS_PARAM) ;
@@ -441,7 +441,7 @@ SurfFlatRegion::MyNewSurfFromLoops( PCRV_DEQUE& vpLoop)
CRVCVECTOR ccClass ;
IntersCurveCurve ccInt( *vpLoop[l], *pExtLoop) ;
if ( ccInt.GetCrossOrOverlapIntersCount() > 0 ||
! ccInt.GetCurveClassification( 0, ccClass) ||
! ccInt.GetCurveClassification( 0, EPS_SMALL, ccClass) ||
ccClass.empty() || ccClass[0].nClass != CRVC_IN)
continue ;
// lo inserisco
+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))
+185 -46
View File
@@ -41,10 +41,12 @@ GEOOBJ_REGISTER( SRF_TRIMESH, NGE_S_TRM, SurfTriMesh) ;
SurfTriMesh::SurfTriMesh( void)
: m_nStatus( TO_VERIFY), m_dLinTol( STM_STD_LIN_TOL), m_dBoundaryAng( STM_STD_BOUNDARY_ANG),
m_dSmoothAng( STM_STD_SMOOTH_ANG), m_bOriented( false), m_bClosed( false), m_bFaceted( false),
m_nTimeStamp( 0), m_nTempProp( 0), m_nMaxTFlag( 0), m_nParts( -1), m_pHGrd3d( nullptr)
m_nTimeStamp( 0), m_nMaxTFlag( 0), m_nParts( -1), m_pHGrd3d( nullptr)
{
m_dCosBndAng = cos( m_dBoundaryAng * DEGTORAD) ;
m_dCosSmAng = cos( m_dSmoothAng * DEGTORAD) ;
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
}
//----------------------------------------------------------------------------
@@ -989,7 +991,7 @@ SurfTriMesh::MarchOneTria( int& nT, int& nV, int nTimeStamp,
//----------------------------------------------------------------------------
bool
SurfTriMesh::GetSilhouette( const Vector3d& vtDir, POLYLINEVECTOR& vPL) const
SurfTriMesh::GetSilhouette( const Vector3d& vtDir, double dTol, POLYLINEVECTOR& vPL) const
{
// Verifico lo stato
if ( m_nStatus != OK)
@@ -1000,6 +1002,19 @@ SurfTriMesh::GetSilhouette( const Vector3d& vtDir, POLYLINEVECTOR& vPL) const
if ( ! vtVers.Normalize())
return false ;
// Controlli su tolleranza
dTol = max( dTol, 100 * EPS_SMALL) ;
// Determino il riferimento di proiezione
Frame3d frOCS ; frOCS.Set( ORIG, vtVers) ;
Frame3d frBox = frOCS ; frBox.Invert() ;
BBox3d b3Box ;
GetBBox( frBox, b3Box) ;
frOCS.Translate( b3Box.GetMin().z * frOCS.VersZ()) ;
#if 0
// *** 1° Sfruttando le adiacenze ***
// Non funziona perchè genera loop con anelli
// Copio la superficie
PtrOwner<SurfTriMesh> pStm( Clone()) ;
if ( IsNull( pStm))
@@ -1011,14 +1026,100 @@ SurfTriMesh::GetSilhouette( const Vector3d& vtDir, POLYLINEVECTOR& vPL) const
if ( pStm->m_vTria[i].nIdVert[0] == SVT_DEL)
continue ;
// verifico la normale
if ( pStm->m_vTria[i].vtN * vtVers < - EPS_ZERO)
if ( pStm->m_vTria[i].vtN * vtVers < EPS_ZERO)
pStm->RemoveTriangle( i) ;
}
// dichiaro facce non calcolate
pStm->m_bFaceted = false ;
// Proietto la superficie
pStm->Scale( frOCS, 1, 1, 0) ;
// Recupero i loop della nuova superficie
return pStm->GetLoops( vPL) ;
POLYLINEVECTOR vMyPL ;
if ( pStm->GetLoops( vMyPL)) {
// calcolo la regione della superficie proiettata
bool bOk = true ;
PtrOwner<ISurfFlatRegion> pSfr ;
for ( int i = 0 ; i < int( vMyPL.size()) && bOk ; ++ i) {
// Regione di un loop
PtrOwner<ISurfFlatRegion> pSfrPart( GetSurfFlatRegionFromPolyLine( vMyPL[i])) ;
if ( ! IsNull( pSfrPart)) {
pSfrPart->Offset( dTol, ICurve::OFF_FILLET) ;
if ( IsNull( pSfr))
if ( pSfrPart->GetNormVersor() * vtVers > 0)
bOk = pSfr.Set( Release( pSfrPart)) ;
else
bOk = false ;
else {
if ( pSfrPart->GetNormVersor() * vtVers > 0)
bOk = pSfr->Add( *pSfrPart) ;
else {
pSfrPart->Invert() ;
bOk = pSfr->Subtract( *pSfrPart) ;
}
}
}
else
bOk = false ;
}
// Verifico esistenza della regione
if ( bOk && ! IsNull( pSfr)) {
// Effettuo contro-offset
pSfr->Offset( -dTol, ICurve::OFF_EXTEND) ;
// Recupero i contorni della regione
for ( int i = 0 ; i < pSfr->GetChunkCount() ; ++ i) {
for ( int j = 0 ; j < pSfr->GetLoopCount( i) ; ++ j) {
PolyLine PL ;
if ( pSfr->ApproxLoopWithLines( i, j, LIN_TOL_STD, ANG_TOL_STD_DEG, ICurve::APL_STD, PL))
vPL.emplace_back( PL) ;
}
}
return true ;
}
}
vPL.clear() ;
#endif
// *** 2° Mediante unione delle regioni dei triangoli proiettati ***
// calcolo la regione dei triangoli proiettati
PtrOwner<ISurfFlatRegion> pSfr ;
Triangle3d Tria ;
int nT = GetFirstTriangle( Tria) ;
while ( nT != SVT_NULL) {
// verifico la normale e il triangolo proiettato
if ( Tria.GetN() * vtVers > EPS_ZERO &&
Tria.Scale( frOCS, 1, 1, 0) && Tria.GetSqMinHeight() > SQ_EPS_SMALL) {
PtrOwner<ISurfFlatRegion> pSfrTria( GetSurfFlatRegionFromTriangle( Tria)) ;
if ( ! IsNull( pSfrTria)) {
pSfrTria->Offset( dTol, ICurve::OFF_FILLET) ;
if ( IsNull( pSfr))
pSfr.Set( Release( pSfrTria)) ;
else
pSfr->Add( *pSfrTria) ;
}
}
// passo al successivo
nT = GetNextTriangle( nT, Tria) ;
}
// Se non esiste la regione
if ( IsNull( pSfr))
return false ;
// Effettuo contro-offset
pSfr->Offset( -dTol, ICurve::OFF_EXTEND) ;
// Recupero i contorni della regione
for ( int i = 0 ; i < pSfr->GetChunkCount() ; ++ i) {
for ( int j = 0 ; j < pSfr->GetLoopCount( i) ; ++ j) {
PolyLine PL ;
if ( pSfr->ApproxLoopWithLines( i, j, LIN_TOL_STD, ANG_TOL_STD_DEG, ICurve::APL_STD, PL))
vPL.emplace_back( PL) ;
}
}
return true ;
}
//----------------------------------------------------------------------------
@@ -1068,7 +1169,8 @@ SurfTriMesh::CopyFrom( const SurfTriMesh& stmSrc)
m_vTria = stmSrc.m_vTria ;
m_vFacet = stmSrc.m_vFacet ;
m_nTimeStamp = stmSrc.m_nTimeStamp ;
m_nTempProp = stmSrc.m_nTempProp ;
m_nTempProp[0] = stmSrc.m_nTempProp[0] ;
m_nTempProp[1] = stmSrc.m_nTempProp[1] ;
m_nMaxTFlag = stmSrc.m_nMaxTFlag ;
m_nParts = stmSrc.m_nParts ;
return true ;
@@ -2828,7 +2930,7 @@ SurfTriMesh::DoCompacting( double dTol)
//----------------------------------------------------------------------------
bool
SurfTriMesh::DoSewing( const ISurfTriMesh& stmOther, const Frame3d& frOther)
SurfTriMesh::DoSewing( const ISurfTriMesh& stmOther, const Frame3d& frOther, double dTol)
{
// recupero l'altra superficie
const SurfTriMesh* pOther = dynamic_cast<const SurfTriMesh*>( &stmOther) ;
@@ -2870,7 +2972,7 @@ SurfTriMesh::DoSewing( const ISurfTriMesh& stmOther, const Frame3d& frOther)
ptOP.ToGlob( frOther) ;
// se non c'è già un vertice con la stessa posizione lo inserisco
int nNewId ;
if ( ! VertGrid.Find( ptOP, 2 * EPS_SMALL, nNewId)) {
if ( ! VertGrid.Find( ptOP, dTol, nNewId)) {
if ( ( nNewId = AddVertex( ptOP)) == SVT_NULL)
return false ;
VertGrid.InsertPoint( ptOP, nNewId) ;
@@ -3299,11 +3401,9 @@ SurfTriMesh::Invert( void)
//----------------------------------------------------------------------------
bool
SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
SurfTriMesh::CutByTriangles( const Plane3d& plPlane, bool bSaveOnEq, bool& bModif)
{
#define UseTria 1
#if UseTria
// la superficie deve essere validata
// la superficie deve essere validata
if ( m_nStatus != OK)
return false ;
@@ -3328,7 +3428,6 @@ SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
++ m_nTimeStamp ;
// sistemo i triangoli (eventualmente li elimino)
bool bModif = false ;
for ( int i = 0 ; i < GetTriangleSize() ; ++ i) {
// salto i triangoli cancellati e quelli aggiunti
if ( m_vTria[i].nIdVert[0] == SVT_DEL || m_vTria[i].nTemp == m_nTimeStamp)
@@ -3507,43 +3606,40 @@ SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
}
}
// se effettuate modifiche
if ( bModif) {
// aggiorno tutto
if ( ! AdjustVertices() || ! DoCompacting())
return false ;
}
return true ;
}
#else
bool bModif = false ;
// Setto i triangoli come né fuori né dentro.
int nTriaNum = GetTriangleSize() ;
for ( int nT = 0 ; nT < nTriaNum ; ++ nT) {
//----------------------------------------------------------------------------
bool
SurfTriMesh::CutByFacets( const Plane3d& plPlane, bool bSaveOnEq, bool& bModif)
{
// Setto posizione triangoli non definita
for ( int nT = 0 ; nT < GetTriangleSize() ; ++ nT)
m_vTria[nT].nTempPart = 0 ;
}
INTERSCHAINMAP IntersLineMap ;
// Ciclo su tutte le facce.
int nFacetNum = GetFacetCount() ;
for ( int nF = 0 ; nF < nFacetNum ; ++ nF) {
for ( int nF = 0 ; nF < GetFacetCount() ; ++ nF) {
// Dati della faccia
POLYLINEVECTOR vLoopVec ;
GetFacetLoops( nF, vLoopVec) ;
if ( vLoopVec.empty())
continue ;
PtrOwner<SurfFlatRegion> pReg( GetBasicSurfFlatRegion( GetSurfFlatRegionFromPolyLineVector( vLoopVec))) ;
if ( IsNull( pReg))
return false ;
// Verifico la posizione del loop esterno
int nIntType = VerifyLoopPlane( vLoopVec[0], plPlane) ;
// Se interseca il piano di taglio, calcolo la divisione della faccia
LineFacetClassVector IntersLinePart ;
int nIntType = IntersFacetPlane( *pReg, vLoopVec[0], plPlane, IntersLinePart) ;
if ( nIntType == FacetPlaneIntersType::FPI_CUT) {
if ( nIntType == FPI_CUT) {
PtrOwner<SurfFlatRegion> pReg( GetBasicSurfFlatRegion( GetSurfFlatRegionFromPolyLineVector( vLoopVec))) ;
if ( IsNull( pReg) || ! pReg->IsValid())
return false ;
nIntType = IntersFacetPlane( *pReg, plPlane, IntersLinePart) ;
}
// Gestione dei risultati
if ( nIntType == FPI_CUT) {
for ( int nPart = 0 ; nPart < int( IntersLinePart.size()) ; ++ nPart) {
// Salvo intersezione per la faccia.
// Salvo intersezione per la faccia.
auto it = IntersLineMap.find( nF) ;
if ( it != IntersLineMap.end()) {
it->second.emplace_back( IntersInnSeg( IntersLinePart[nPart].ptSt, IntersLinePart[nPart].ptEn)) ;
@@ -3553,26 +3649,28 @@ SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
}
}
}
else if ( nIntType == FacetPlaneIntersType::FPI_ON) {
else if ( nIntType == FPI_ON) {
INTVECTOR vT ;
GetAllTriaInFacet( nF, vT) ;
Vector3d vtNf ;
GetFacetNormal( nF, vtNf) ;
for ( auto& nT : vT)
m_vTria[nT].nTempPart = pReg->GetNormVersor() * plPlane.GetVersN() > 0. ? 2 : - 2 ;
m_vTria[nT].nTempPart = ( vtNf * plPlane.GetVersN() > 0 ? 2 : -2) ;
}
else if ( nIntType == FacetPlaneIntersType::FPI_INN) {
else if ( nIntType == FPI_IN) {
INTVECTOR vT ;
GetAllTriaInFacet( nF, vT) ;
for ( auto& nT : vT)
m_vTria[nT].nTempPart = 1 ;
}
else if ( nIntType == FacetPlaneIntersType::FPI_OUT) {
else if ( nIntType == FPI_OUT) {
INTVECTOR vT ;
GetAllTriaInFacet( nF, vT) ;
for ( auto& nT : vT)
m_vTria[nT].nTempPart = - 1 ;
m_vTria[nT].nTempPart = -1 ;
}
else
;
return false ;
}
// Divido le facce.
@@ -3581,13 +3679,54 @@ SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
INTERSEDGEMAP EdgeInterLineMap, EdgeEdgeLineMap ;
RetriangulateFacetPieces( NewFacet, EdgeInterLineMap, EdgeEdgeLineMap) ;
int nNumTria = GetTriangleSize() ;
for ( int nT = 0 ; nT < nNumTria ; ++ nT)
if ( m_vTria[nT].nTempPart == - 1 || m_vTria[nT].nTempPart == - 2 || ( ! bSaveOnEq && m_vTria[nT].nTempPart == 2))
// Elimino i triangoli superflui
for ( int nT = 0 ; nT < GetTriangleSize() ; ++ nT) {
if ( m_vTria[nT].nTempPart == 0 ||
m_vTria[nT].nTempPart == -1 ||
m_vTria[nT].nTempPart == -2 ||
( ! bSaveOnEq && m_vTria[nT].nTempPart == 2)) {
RemoveTriangle( nT) ;
bModif = true ;
}
}
return AdjustVertices() && DoCompacting() ;
#endif
return true ;
}
//----------------------------------------------------------------------------
bool
SurfTriMesh::Cut( const Plane3d& plPlane, bool bSaveOnEq)
{
// la superficie deve essere validata
if ( m_nStatus != OK)
return false ;
// recupero il numero originale di triangoli e di facce
int nTriaOriCnt = GetTriangleCount() ;
int nFacetOriCnt = GetFacetCount() ;
// eseguo il taglio con il metodo delle faccette o dei triangoli (per ora solo coi triangoli)
bool bModif = false ;
if ( true || ! CutByFacets( plPlane, bSaveOnEq, bModif)) {
bModif = false ;
if ( ! CutByTriangles( plPlane, bSaveOnEq, bModif))
return false ;
}
// se effettuate modifiche
if ( bModif) {
// aggiorno tutto
if ( ! AdjustVertices() || ! DoCompacting())
return false ;
}
// se superficie originale a facce, cerco di semplificarle in ogni caso
if ( nFacetOriCnt < 200 || double( nTriaOriCnt) / nFacetOriCnt > 4) {
if ( ! SimplifyFacets( 500.0))
LOG_ERROR( GetEGkLogger(), "Error in SimplifyFacets of Stm::Cut")
}
return true ;
}
//----------------------------------------------------------------------------
+19 -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.
//
//
@@ -121,7 +121,7 @@ struct LineFacetClass {
nTypeA = 0 ;
nTypeB = 0 ;
}
LineFacetClass( const Point3d& ptS, const Point3d ptE, int nTpA, int nTpB) {
LineFacetClass( const Point3d& ptS, const Point3d& ptE, int nTpA, int nTpB) {
ptSt = ptS ;
ptEn = ptE ;
nTypeA = nTpA ;
@@ -131,7 +131,7 @@ struct LineFacetClass {
typedef std::vector<LineFacetClass> LineFacetClassVector ;
//----------------------------------------------------------------------------
enum FacetPlaneIntersType { FPI_ERROR = 0, FPI_CUT = 1, FPI_INN = 2, FPI_OUT = 3, FPI_ON = 4 } ;
enum FacetPlaneIntersType { FPI_ERROR = 0, FPI_CUT = 1, FPI_IN = 2, FPI_OUT = 3, FPI_ON = 4 } ;
//----------------------------------------------------------------------------
// Definizione strutture e contenitori
@@ -206,10 +206,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
@@ -248,7 +249,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 +278,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()) ; }
@@ -380,19 +381,23 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
void ResetHashGrids3d( void) const ;
bool VerifyHashGrids3d( void) const ;
bool VerifyConnection( void) const ;
bool CutByTriangles( const Plane3d& plPlane, bool bSaveOnEq, bool& bModif) ;
bool CutByFacets( const Plane3d& plPlane, bool bSaveOnEq, bool& bModif) ;
bool DecomposeLoop( CHAINVECTOR& cvOpenChain, INTVECTOR& vnDegVec, PNTMATRIX& cvBoundClosedLoopVec, BOOLVECTOR& vbInOut) ;
bool RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECTORMAP& Ambiguos, SurfTriMesh& Surf, bool& bModif) ;
bool AmbiguosTriangleManager( TRIA3DVECTORMAP& Ambiguos, SurfTriMesh& Surf) ;
bool IntersectTriMeshTriangle( SurfTriMesh& Other) ;
int IntersFacetPlane( const SurfFlatRegion& Region, const PolyLine& ExtLoop, const Plane3d& plCutPlane,
LineFacetClassVector& IntersLinePart) ;
int VerifyLoopPlane( const PolyLine& ExtLoop, const Plane3d& plCutPlane) ;
int IntersFacetPlane( const SurfFlatRegion& Region, 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) ;
bool SimplifyFacets( double dMaxEdgeLen) ;
bool EdgeInteriorContactManager( const SurfTriMesh& OthSurf,
const INTERSCHAINMAP& InterInterLineMap,
const INTERSEDGEMAP& EdgeInterLineMap) ;
@@ -422,7 +427,7 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
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
+498 -901
View File
File diff suppressed because it is too large Load Diff
+250
View File
@@ -0,0 +1,250 @@
//----------------------------------------------------------------------------
// EgalTech 2021-2021
//----------------------------------------------------------------------------
// File : SurfTriMeshUtilities.cpp Data : 01.11.21 Versione : 2.3k1
// Contenuto : Implementazione funzioni di utilità di Superfici TriMesh.
//
//
//
// Modifiche : 25.10.21 LM Creazione modulo.
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "Triangulate.h"
#include "SurfTriMesh.h"
#include "DistPointLine.h"
#include <unordered_map>
using namespace std ;
//----------------------------------------------------------------------------
static bool
IsVertex( PNTULIST& PointList, PNTULIST::const_iterator itCurr)
{
// recupero il punto precedente
PNTULIST::const_iterator itPrev ;
if ( itCurr == PointList.begin())
itPrev = prev( PointList.end(), 2) ;
else
itPrev = prev( itCurr) ;
// recupero il punto successivo
auto itNext = next( itCurr) ;
if ( itNext == PointList.end())
itNext = next( PointList.begin()) ;
// se cambia faccia adiacente tra prima e dopo, va bene
if ( itPrev->second != itCurr->second)
return true ;
// se lati aperti e cambia direzione tra prima e dopo, va bene
if ( itPrev->second == -1) {
DistPointLine PointLineDistCalc( itCurr->first, itPrev->first, itNext->first) ;
double dDist ;
if ( PointLineDistCalc.GetDist( dDist) && dDist > EPS_SMALL)
return true ;
}
// altrimenti non va bene
return false ;
}
//----------------------------------------------------------------------------
static bool
ChooseGoodStartPoint( PNTULIST& PointList)
{
// se il punto iniziale è un vertice, non devo fare alcunché
if ( IsVertex( PointList, PointList.begin()))
return true ;
// altrimenti cerco il vertice più vicino
for ( auto it = next( PointList.begin()) ; it != PointList.end() ; ++it) {
if ( IsVertex( PointList, it)) {
// cancello ultimo punto ( coincide con primo)
PointList.pop_back() ;
// sposto la parte iniziale dei punti alla fine
PointList.splice( PointList.end(), PointList, PointList.begin(), it) ;
// aggiungo punto finale come copia dell'iniziale
PointList.push_back( PointList.front()) ;
// ho finito
return true ;
}
}
return false ;
}
//----------------------------------------------------------------------------
static bool
AdjustLoop( PNTULIST& PointList, double dMaxEdgeLen, bool& bModif)
{
// Ciclo sui punti del loop
auto itLast = PointList.begin() ;
for ( auto it = next( itLast) ; it != PointList.end() ; ++ it) {
// Se dal punto corrente inizia un segmento adiacente a un'altra faccia
if ( itLast->second != it->second) {
// Elimino i punti interni
auto itNextToLast = next( itLast) ;
for ( auto itInn = itNextToLast ; itInn != it ; ) {
itInn = PointList.erase( itInn) ;
bModif = true ;
}
// Se la lunghezza del segmento supera il limite imposto
double dSegLen = Dist( it->first, itLast->first) ;
if ( dSegLen > dMaxEdgeLen) {
// determino il numero di step
double dRatio = dSegLen / dMaxEdgeLen ;
int nStepCount = int( dRatio) + 1 ;
// inserisco i punti
auto itAdd = it ;
for ( int nP = 1 ; nP < nStepCount ; ++ nP) {
double dCoeff = double( nP) / nStepCount ;
itAdd = PointList.insert( itAdd, POINTU( Media( itLast->first, it->first, 1 - dCoeff), itLast->second)) ;
bModif = true ;
}
}
// Nuovo punto di riferimento
itLast = it ;
}
// Se sono due segmenti liberi non allineati
else if ( itLast->second == - 1) {
// Calcolo se i punti compresi fra gli estremi sono allineati
bool bAreAligned = true ;
auto itNextToLast = next( itLast) ;
for ( auto itInn = itNextToLast ; itInn != it && bAreAligned ; ++ itInn) {
DistPointLine PointLineDistCalc( itInn->first, itLast->first, it->first) ;
double dDist ;
if ( PointLineDistCalc.GetDist( dDist))
bAreAligned = ( dDist < EPS_SMALL) ;
}
// Se i punti sono allineati
if ( bAreAligned) {
// Verifico se il successivo punto non è più allineato
auto itNextToCurr = next( it) ;
if ( itNextToCurr != PointList.end()) {
for ( auto itInn = itNextToLast ; itInn != itNextToCurr && bAreAligned ; ++ itInn) {
DistPointLine PointLineDistCalc( itInn->first, itLast->first, itNextToCurr->first) ;
double dDist ;
if ( PointLineDistCalc.GetDist( dDist))
bAreAligned = ( dDist < EPS_SMALL) ;
}
}
// Se ho trovato un insieme massimale di punti allineati li processo
if ( ! bAreAligned || itNextToCurr == PointList.end()) {
// Elimino i punti interni
for ( auto itInn = itNextToLast ; itInn != it ; ) {
itInn = PointList.erase( itInn) ;
bModif = true ;
}
// Se la lunghezza del segmento supera il limite imposto
double dSegLen = Dist( it->first, itLast->first) ;
if ( dSegLen > dMaxEdgeLen) {
// determino il numero di step
double dRatio = dSegLen / dMaxEdgeLen ;
int nStepCount = int( dRatio) + 1 ;
// inserisco i punti
auto itAdd = it ;
for ( int nP = 1 ; nP < nStepCount ; ++ nP) {
double dCoeff = double( nP) / nStepCount ;
itAdd = PointList.insert( itAdd, POINTU( Media( itLast->first, it->first, 1 - dCoeff), itLast->second)) ;
bModif = true ;
}
}
// Nuovo punto di riferimento
itLast = it ;
}
}
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
SurfTriMesh::SimplifyFacets( double dMaxEdgeLen)
{
// La trimesh deve essere valida
if ( ! IsValid())
return false ;
// Se la lunghezza massima del lato del triangolo sul bordo della faccia è nulla, non devo fare alcunché
if ( dMaxEdgeLen < EPS_SMALL)
return true ;
// Recupero il numero delle facce (esegue anche una verifica delle stesse)
int nFacetCnt = GetFacetCount() ;
// Ciclo sulle facce della mesh per trovare quelle da ritriangolare
unordered_map< int, pair< PNTVECTOR, INTVECTOR>> FacetMap ;
for ( int nF = 0 ; nF < nFacetCnt ; ++ nF) {
// Recupero i loop della faccia (il parametro indica la faccia adiacente)
POLYLINEVECTOR LoopVec ;
GetFacetLoops( nF, LoopVec) ;
// Ciclo sui loop della faccia
bool bToRetriangulate = false ;
for ( int nL = 0 ; nL < int( LoopVec.size()) ; ++ nL) {
// Lista dei punti del loop
PNTULIST& PointList = LoopVec[nL].GetUPointList() ;
// Mi assicuro che il punto iniziale/finale non sia all'interno di un possibile segmento
if ( ! ChooseGoodStartPoint( PointList))
return false ;
// Sistemo il loop
bool bModif = false ;
if ( ! AdjustLoop( PointList, dMaxEdgeLen, bModif))
return false ;
if ( bModif)
bToRetriangulate = true ;
}
// Se da ritriangolare,
if ( bToRetriangulate) {
// Eseguo la ritriangolazione della faccia
PNTVECTOR vPt ;
INTVECTOR vTr ;
if ( Triangulate().Make( LoopVec, vPt, vTr)) {
FacetMap.emplace( nF, make_pair( vPt, vTr)) ;
}
// Se non riesco a triangolare anche solo questa faccia, interrompo tutto
else
return false ;
}
}
// Ciclo sulle facce da ritriangolare per eliminare i triangoli (nel contempo salvo flag colore)
unordered_map< int, int> ColorMap ;
for ( auto itF = FacetMap.begin() ; itF != FacetMap.end() ; ++ itF) {
// Recupero i triangoli della faccia
INTVECTOR vFacetTria ;
GetAllTriaInFacet( itF->first, vFacetTria) ;
// Salvo il colore della faccia da flag di un suo triangolo
ColorMap.emplace( itF->first, m_vTria[m_vFacet[itF->first]].nTFlag) ;
// Cancello i triangoli della faccia.
for ( int nT : vFacetTria)
RemoveTriangle( nT) ;
}
// Applico le nuove triangolazioni delle facce
for ( auto itFac = FacetMap.begin() ; itFac != FacetMap.end() ; ++ itFac) {
const PNTVECTOR& vPt = itFac->second.first ;
const INTVECTOR& vTr = itFac->second.second ;
// Inserisco i nuovi triangoli
for ( int n = 0 ; n < int( vTr.size()) - 2 ; n += 3) {
int nNewId[3] = { AddVertex( vPt[vTr[n]]),
AddVertex( vPt[vTr[n + 1]]),
AddVertex( vPt[vTr[n + 2]])} ;
auto itCol = ColorMap.find( itFac->first) ;
int nTFlag = ( itCol != ColorMap.end() ? itCol->second : 0) ;
int nNewTriaId = AddTriangle( nNewId, nTFlag) ;
}
}
// dichiaro necessità ricalcolo della grafica e di hashgrids3d
m_OGrMgr.Reset() ;
ResetHashGrids3d() ;
// Eseguo aggiustamenti
return ( AdjustVertices() && DoCompacting()) ;
}
+3 -3
View File
@@ -27,9 +27,9 @@ 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)
{
}
+8 -5
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_Tool( true)
{
for ( int i = 0 ; i < N_MAPS ; ++ i) {
m_nNx[i] = 0 ;
@@ -45,6 +45,8 @@ VolZmap::VolZmap(void)
m_dMaxZ[i] = 0 ;
m_nFracLin[i] = 0 ;
}
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
m_Tool.SetTolerances( LIN_TOL_STD, ANG_TOL_APPROX_DEG) ;
}
@@ -72,7 +74,8 @@ VolZmap::Clear( void)
m_Values[i].clear() ;
}
m_dStep = EPS_SMALL ;
m_nTempProp = 0 ;
m_nTempProp[0] = 0 ;
m_nTempProp[1] = 0 ;
m_Tool.Clear() ;
// 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 ;
+6 -5
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 ;
@@ -401,7 +402,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
+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) {
+2 -2
View File
@@ -220,7 +220,7 @@ VolZmap::CreateFromFlatRegion( const ISurfFlatRegion& Surf, double dDimZ, double
// Determino le intersezioni della retta con la regione
CRVCVECTOR IntersectionResults ;
Surf.GetCurveClassification( GridLine, IntersectionResults) ;
Surf.GetCurveClassification( GridLine, EPS_SMALL, IntersectionResults) ;
// Analizzo le parti in cui la retta è stata divisa
int nPart = int( IntersectionResults.size()) ;
@@ -327,7 +327,7 @@ VolZmap::CreateFromFlatRegion( const ISurfFlatRegion& Surf, double dDimZ, double
// Determino le intersezioni della retta con la regione
CRVCVECTOR IntersectionResults ;
Surf.GetCurveClassification( GridLine, IntersectionResults) ;
Surf.GetCurveClassification( GridLine, EPS_SMALL, IntersectionResults) ;
// Analizzo le parti
int nPart = int( IntersectionResults.size()) ;
+7 -7
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.
//
//----------------------------------------------------------------------------
@@ -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) ;
}