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