Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtGeomKernel
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "GeoObjFactory.h"
|
||||
#include "NgeWriter.h"
|
||||
#include "NgeReader.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkAngle.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||
|
||||
+3
-2
@@ -18,7 +18,8 @@
|
||||
#include "DllMain.h"
|
||||
#include "GeoObjRW.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkVoronoi.h"
|
||||
|
||||
class Voronoi ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class CurveArc : public ICurveArc, public IGeoObjRW
|
||||
@@ -129,7 +130,6 @@ class CurveArc : public ICurveArc, public IGeoObjRW
|
||||
bool TrimEndAtLen( double dLenTrim) override ;
|
||||
bool ExtendStartByLen( double dLenExt) override ;
|
||||
bool ExtendEndByLen( double dLenExt) override ;
|
||||
Voronoi* GetVoronoiObject( void) const override ;
|
||||
|
||||
public : // ICurveArc
|
||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||
@@ -199,6 +199,7 @@ class CurveArc : public ICurveArc, public IGeoObjRW
|
||||
return *this ; }
|
||||
bool MyExtendedOffset( double dDist, bool bAll, int nType = OFF_FILLET) ;
|
||||
bool MyCalcPointParamPosiz( const Point3d& ptP, double& dU, int& nPos, double dLinTol) const ;
|
||||
Voronoi* GetVoronoiObject( void) const ;
|
||||
|
||||
private :
|
||||
bool CopyFrom( const CurveArc& caSrc) ;
|
||||
|
||||
+17
-4
@@ -19,11 +19,11 @@
|
||||
#include "CurveArc.h"
|
||||
#include "CurveBezier.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EGkVoronoi.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -1041,11 +1041,24 @@ AdjustCurveSlope( ICurveComposite* pCrv, double dNini, double dNfin)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Voronoi*
|
||||
GetCurveVoronoi( const ICurve& crvC)
|
||||
{
|
||||
switch ( crvC.GetType()) {
|
||||
case CRV_LINE : return GetBasicCurveLine( &crvC)->GetVoronoiObject() ;
|
||||
case CRV_ARC : return GetBasicCurveArc( &crvC)->GetVoronoiObject() ;
|
||||
case CRV_BEZIER : return GetBasicCurveBezier( &crvC)->GetVoronoiObject() ;
|
||||
case CRV_COMPO : return GetBasicCurveComposite( &crvC)->GetVoronoiObject() ;
|
||||
}
|
||||
return nullptr ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CalcCurveVoronoiDiagram( const ICurve& crvC, ICURVEPOVECTOR& vCrvs, int nBound)
|
||||
{
|
||||
Voronoi* pVoronoiObj = crvC.GetVoronoiObject() ;
|
||||
Voronoi* pVoronoiObj = GetCurveVoronoi( crvC) ;
|
||||
if ( pVoronoiObj == nullptr)
|
||||
return false ;
|
||||
|
||||
@@ -1056,7 +1069,7 @@ CalcCurveVoronoiDiagram( const ICurve& crvC, ICURVEPOVECTOR& vCrvs, int nBound)
|
||||
bool
|
||||
CalcCurveMedialAxis( const ICurve& crvC, ICURVEPOVECTOR& vCrvs, int nSide)
|
||||
{
|
||||
Voronoi* pVoronoiObj = crvC.GetVoronoiObject() ;
|
||||
Voronoi* pVoronoiObj = GetCurveVoronoi( crvC) ;
|
||||
if ( pVoronoiObj == nullptr)
|
||||
return false ;
|
||||
|
||||
@@ -1067,7 +1080,7 @@ CalcCurveMedialAxis( const ICurve& crvC, ICURVEPOVECTOR& vCrvs, int nSide)
|
||||
bool
|
||||
CalcCurveFatCurve( const ICurve& crvC, ICURVEPOVECTOR& vCrvs, double dRadius, bool bSquareEnds, bool bSquareMids)
|
||||
{
|
||||
Voronoi* pVoronoiObj = crvC.GetVoronoiObject() ;
|
||||
Voronoi* pVoronoiObj = GetCurveVoronoi( crvC) ;
|
||||
if ( pVoronoiObj == nullptr)
|
||||
return false ;
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||
|
||||
class Voronoi ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool IsClosed( const ICurve& crvC) ;
|
||||
bool IsValidParam( const ICurve& crvC, double dPar, ICurve::Side nSide) ;
|
||||
@@ -31,3 +33,4 @@ bool CurveGetArea( const ICurve& crvC, Plane3d& plPlane, double& dArea) ;
|
||||
bool CurveDump( const ICurve& crvC, std::string& sOut, bool bMM, const char* szNewLine) ;
|
||||
bool CopyExtrusion( const ICurve* pSouCrv, ICurve* pDestCrv) ;
|
||||
bool CopyThickness( const ICurve* pSouCrv, ICurve* pDestCrv) ;
|
||||
Voronoi* GetCurveVoronoi( const ICurve& crvC) ;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "PolynomialPoint3d.h"
|
||||
#include "Bernstein.h"
|
||||
#include "deCasteljau.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||
|
||||
+3
-3
@@ -19,8 +19,8 @@
|
||||
#include "DllMain.h"
|
||||
#include "GeoObjRW.h"
|
||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
#include "/EgtDev/Include/EGkVoronoi.h"
|
||||
|
||||
class Voronoi ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
@@ -131,7 +131,6 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
bool TrimEndAtLen( double dLenTrim) override ;
|
||||
bool ExtendStartByLen( double dLenExt) override ;
|
||||
bool ExtendEndByLen( double dLenExt) override ;
|
||||
Voronoi* GetVoronoiObject( void) const override ;
|
||||
|
||||
public : // ICurveBezier
|
||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||
@@ -165,6 +164,7 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
return *this ; }
|
||||
bool ApproxWithLines( int nStep, PolyLine& PL) const ;
|
||||
bool GetApproxLength( double& dLen) const ;
|
||||
Voronoi* GetVoronoiObject( void) const ;
|
||||
|
||||
private :
|
||||
bool CopyFrom( const CurveBezier& cbSrc) ;
|
||||
|
||||
+14
-1
@@ -26,6 +26,7 @@
|
||||
#include "GeoObjFactory.h"
|
||||
#include "NgeWriter.h"
|
||||
#include "NgeReader.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkCurveByApprox.h"
|
||||
#include "/EgtDev/Include/EGkArcSpecial.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
@@ -266,7 +267,7 @@ CurveComposite::AddSimpleCurve( ICurve* pSmplCrv, bool bEndOrStart, double dLinT
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
return true ;
|
||||
return Validate() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -855,6 +856,18 @@ CurveComposite::Validate( void)
|
||||
m_nStatus = ( nCount > 0 ? OK : TO_VERIFY) ;
|
||||
}
|
||||
|
||||
// verifico chiusura
|
||||
if ( IsClosed()) {
|
||||
Point3d ptStart ; m_CrvSmplS.front()->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; m_CrvSmplS.back()->GetEndPoint( ptEnd) ;
|
||||
// se distanza superiore al limite ridotto forzo i punti a coincidere
|
||||
if ( ! AreSamePointEpsilon( ptStart, ptEnd, 0.01 * EPS_SMALL)) {
|
||||
Point3d ptM = Media( ptStart, ptEnd) ;
|
||||
m_CrvSmplS.front()->ModifyEnd( ptM) ;
|
||||
m_CrvSmplS.back()->ModifyStart( ptM) ;
|
||||
}
|
||||
}
|
||||
|
||||
return ( m_nStatus == OK) ;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -19,9 +19,10 @@
|
||||
#include "DllMain.h"
|
||||
#include "GeoObjRW.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkVoronoi.h"
|
||||
#include <deque>
|
||||
|
||||
class Voronoi ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
{
|
||||
@@ -126,7 +127,6 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
bool TrimEndAtLen( double dLenTrim) override ;
|
||||
bool ExtendStartByLen( double dLenExt) override ;
|
||||
bool ExtendEndByLen( double dLenExt) override ;
|
||||
Voronoi* GetVoronoiObject( void) const override ;
|
||||
|
||||
public : // ICurveComposite
|
||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||
@@ -194,6 +194,7 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
return *this ; }
|
||||
bool RelocateFrom( CurveComposite& ccSrc) ;
|
||||
bool GetApproxLength( double& dLen) const ;
|
||||
Voronoi* GetVoronoiObject( void) const ;
|
||||
|
||||
private :
|
||||
bool CopyFrom( const CurveComposite& ccSrc) ;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "GeoObjFactory.h"
|
||||
#include "NgeWriter.h"
|
||||
#include "NgeReader.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
+3
-2
@@ -18,7 +18,8 @@
|
||||
#include "DllMain.h"
|
||||
#include "GeoObjRW.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkVoronoi.h"
|
||||
|
||||
class Voronoi ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class CurveLine : public ICurveLine, public IGeoObjRW
|
||||
@@ -130,7 +131,6 @@ class CurveLine : public ICurveLine, public IGeoObjRW
|
||||
bool TrimEndAtLen( double dLenTrim) override ;
|
||||
bool ExtendStartByLen( double dLenExt) override ;
|
||||
bool ExtendEndByLen( double dLenExt) override ;
|
||||
Voronoi* GetVoronoiObject( void) const override ;
|
||||
|
||||
public : // ICurveLine
|
||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||
@@ -157,6 +157,7 @@ class CurveLine : public ICurveLine, public IGeoObjRW
|
||||
{ if ( ! CopyFrom( clSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveLine : copy error")
|
||||
return *this ; }
|
||||
Voronoi* GetVoronoiObject( void) const ;
|
||||
|
||||
private :
|
||||
bool CopyFrom( const CurveLine& clSrc) ;
|
||||
|
||||
Binary file not shown.
@@ -109,7 +109,7 @@
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EGK;NVRONI;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EGK;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
@@ -145,7 +145,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EGK;NVRONI;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EGK;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
@@ -183,7 +183,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EGK;NVRONI;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EGK;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
@@ -232,7 +232,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EGK;NVRONI;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EGK;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
@@ -449,6 +449,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="VolZmapGraphics.cpp" />
|
||||
<ClCompile Include="VolZmapVolume.cpp" />
|
||||
<ClCompile Include="VolZmap.cpp" />
|
||||
<ClInclude Include="Voronoi.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Include\EGkAngle.h" />
|
||||
|
||||
@@ -1166,6 +1166,9 @@
|
||||
<ClInclude Include="..\Include\EGkSubtractProjectedFacesOnStmFace.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Voronoi.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtGeomKernel.rc">
|
||||
|
||||
+10
-10
@@ -21,6 +21,7 @@
|
||||
#include "CurveComposite.h"
|
||||
#include "RemoveCurveDefects.h"
|
||||
#include "OffsetAux.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
@@ -66,11 +67,7 @@ OffsetCurve::Reset( void)
|
||||
bool
|
||||
OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
{
|
||||
// imposto metodo di calcolo
|
||||
bool bUseVoronoi = false ;
|
||||
#ifdef _VRONI
|
||||
bUseVoronoi = true ;
|
||||
#endif // _VRONI
|
||||
// metodo di calcolo impostato da USE_VORONOI
|
||||
|
||||
// pulisco tutto
|
||||
Reset() ;
|
||||
@@ -126,8 +123,8 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
return true ;
|
||||
}
|
||||
|
||||
// determino se necessario cambiare riferimento ( dal vettore estrusione)
|
||||
bool bNeedRef = ( ! vtExtr.IsZplus()) ;
|
||||
// determino se necessario cambiare riferimento ( dal vettore estrusione) e mai con Voronoi
|
||||
bool bNeedRef = ( ! vtExtr.IsZplus() && ! USE_VORONOI) ;
|
||||
|
||||
// determino se necessario effettuare scalatura
|
||||
bool bNeedScale = ( abs( dExtrOnN) < cos( 0.1 * DEGTORAD)) ;
|
||||
@@ -168,7 +165,7 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
bool bChangeStart = true ;
|
||||
|
||||
// -------------------- OFFSET STANDARD ---------------------------------
|
||||
if ( ! bUseVoronoi) {
|
||||
if ( ! USE_VORONOI) {
|
||||
|
||||
// verifico che la curva sia fatta solo da rette e archi che giacciono nel piano XY (VtExtr è ora Z+)
|
||||
if ( ! ccCopy.ArcsBezierCurvesToArcsPerpExtr( m_dLinTol, ANG_TOL_STD_DEG))
|
||||
@@ -692,7 +689,7 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
if ( bNeedRef || bNeedScale)
|
||||
voronoiObj = ccCopy.GetVoronoiObject() ;
|
||||
else
|
||||
voronoiObj = pCrv->GetVoronoiObject() ;
|
||||
voronoiObj = GetCurveVoronoi( *pCrv) ;
|
||||
|
||||
if ( voronoiObj == nullptr)
|
||||
return false ;
|
||||
@@ -733,10 +730,13 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
pCrv->ToGlob( frCopy) ;
|
||||
}
|
||||
|
||||
// assegno estrusione e spessore come curva originale
|
||||
// assegno estrusione e spessore come curva originale e unisco parti allineate
|
||||
for ( auto pCrv : m_CrvLst) {
|
||||
pCrv->SetExtrusion( vtExtr) ;
|
||||
pCrv->SetThickness( dThick) ;
|
||||
// unisco eventuali parti allineate (tranne gli estremi)
|
||||
if ( pCrv->GetType() == CRV_COMPO)
|
||||
GetBasicCurveComposite( pCrv)->MergeCurves( 10 * EPS_SMALL, ANG_TOL_STD_DEG, false) ;
|
||||
}
|
||||
|
||||
// ordino le curve in ordine decrescente di lunghezza
|
||||
|
||||
@@ -645,6 +645,12 @@ PolyLine::GetAreaXY( double& dArea) const
|
||||
for ( bool bFound = GetFirstLine( ptIni, ptFin) ; bFound ; bFound = GetNextLine( ptIni, ptFin)) {
|
||||
dArea += ( ptIni.x - ptFin.x) * ( ptIni.y + ptFin.y) ; // projection on xy
|
||||
}
|
||||
// considero anche la linea tra l'ultimo e il primo punto perchè in alcuni casi potrebbero definire area
|
||||
// significativa anche se sono coincidenti per le nostre tolleranze
|
||||
ptIni = ptFin ;
|
||||
GetFirstPoint( ptFin) ;
|
||||
if ( ! AreSamePointExact( ptIni, ptFin))
|
||||
dArea += ( ptIni.x - ptFin.x) * ( ptIni.y + ptFin.y) ;
|
||||
dArea = 0.5 * dArea ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+3
-6
@@ -19,6 +19,7 @@
|
||||
#include "SurfFlatRegion.h"
|
||||
#include "AdjustLoops.h"
|
||||
#include "GeoConst.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkPolyLine.h"
|
||||
#include "/EgtDev/Include/EGkBiArcs.h"
|
||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||
@@ -116,11 +117,7 @@ GetSurfFlatRegionDisk( double dRadius)
|
||||
ISurfFlatRegion*
|
||||
GetSurfFlatRegionFromFatCurve( ICurve* pCrv, double dRadius, bool bSquareEnds, bool bSquareMids, double dOffsLinTol)
|
||||
{
|
||||
// imposto metodo di calcolo
|
||||
bool bUseVoronoi = false ;
|
||||
#ifdef _VRONI
|
||||
bUseVoronoi = true ;
|
||||
#endif // _VRONI
|
||||
// metodo di calcolo impostato da USE_VORONOI
|
||||
|
||||
// mi impossesso della curva
|
||||
PtrOwner<ICurve> pCurve( pCrv) ;
|
||||
@@ -132,7 +129,7 @@ GetSurfFlatRegionFromFatCurve( ICurve* pCrv, double dRadius, bool bSquareEnds, b
|
||||
vtExtr = Z_AX ;
|
||||
|
||||
// ----------------- CALCOLO STANDARD --------------------------------
|
||||
if ( ! bUseVoronoi) {
|
||||
if ( ! USE_VORONOI) {
|
||||
PtrOwner<CurveComposite> pCompo1 ;
|
||||
if ( ! pCompo1.Set( ConvertCurveToBasicComposite( Release( pCurve))))
|
||||
return nullptr ;
|
||||
|
||||
+3
-8
@@ -18,6 +18,7 @@
|
||||
#include "CurveArc.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "SurfTriMesh.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
@@ -345,8 +346,6 @@ GetSurfTriMeshSharpRectSwept( double dDimH, double dDimV, const ICurve* pGuide,
|
||||
PtrOwner<ICurve> pCrvL( OffsCrvL.GetLongerCurve()) ;
|
||||
if ( IsNull( pCrvL))
|
||||
return nullptr ;
|
||||
PtrOwner<ICurve> pCrvRb ;
|
||||
PtrOwner<ICurve> pCrvLb ;
|
||||
// costruisco le parti di superficie
|
||||
PtrOwner<ISurfTriMesh> pSrfTop( GetSurfTriMeshRuled( pCrvR, pCrvL, ISurfTriMesh::RLT_MINDIST, dLinTol)) ;
|
||||
if ( IsNull( pSrfTop))
|
||||
@@ -440,11 +439,7 @@ GetSurfTriMeshSharpRectSwept( double dDimH, double dDimV, const ICurve* pGuide,
|
||||
static ISurfTriMesh*
|
||||
GetSurfTriMeshBeveledRectSwept( double dDimH, double dDimV, double dBevelH, double dBevelV, const ICurve* pGuide, int nCapType, double dLinTol)
|
||||
{
|
||||
// imposto metodo di calcolo
|
||||
bool bUseVoronoi = false ;
|
||||
#ifdef _VRONI
|
||||
bUseVoronoi = true ;
|
||||
#endif // _VRONI
|
||||
// metodo di calcolo impostato da USE_VORONOI
|
||||
|
||||
// verifico che la linea guida sia piana
|
||||
Plane3d plGuide ;
|
||||
@@ -463,7 +458,7 @@ GetSurfTriMeshBeveledRectSwept( double dDimH, double dDimV, double dBevelH, doub
|
||||
OffsetCurve vOffsCrv[NUM_OFFS] ;
|
||||
double vDist[NUM_OFFS] = { dDimH / 2 - dBevelH, -dDimH / 2 + dBevelH, dDimH / 2, -dDimH / 2} ;
|
||||
bool bOk = true ;
|
||||
if ( ! bUseVoronoi) {
|
||||
if ( ! USE_VORONOI) {
|
||||
future<bool> vRes[NUM_OFFS] ;
|
||||
for ( int i = 0 ; i < NUM_OFFS ; ++ i)
|
||||
vRes[i] = async( launch::async, &OffsetCurve::Make, &vOffsCrv[i], pGuide, vDist[i], ICurve::OFF_FILLET) ;
|
||||
|
||||
+1
-15
@@ -22,6 +22,7 @@
|
||||
#include "CurveLine.h"
|
||||
#include "AdjustLoops.h"
|
||||
#include "GeoConst.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||
#include "/EgtDev/Include/EGkIntervals.h"
|
||||
@@ -1439,21 +1440,6 @@ SurfFlatRegion::CalcVoronoiObject() const
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Voronoi*
|
||||
SurfFlatRegion::GetVoronoiObject() const
|
||||
{
|
||||
if ( m_nStatus != OK)
|
||||
return nullptr ;
|
||||
|
||||
// se non è stato calcolato, lo calcolo
|
||||
if ( m_pVoronoiObj == nullptr)
|
||||
CalcVoronoiObject() ;
|
||||
|
||||
// restituisco Voronoi
|
||||
return m_pVoronoiObj ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
SurfFlatRegion::ResetVoronoiObject() const
|
||||
|
||||
+3
-2
@@ -22,6 +22,8 @@
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include <deque>
|
||||
|
||||
class Voronoi ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class SurfFlatRegion : public ISurfFlatRegion, public IGeoObjRW
|
||||
{
|
||||
@@ -101,8 +103,7 @@ class SurfFlatRegion : public ISurfFlatRegion, public IGeoObjRW
|
||||
bool GetChunkCentroid( int nChunk, Point3d& ptCen) const override ;
|
||||
bool GetCurveClassification( const ICurve& Crv, double dLenMin, CRVCVECTOR& ccClass) const override ;
|
||||
int GetChunkSimpleClassification( int nChunk, const ISurfFlatRegion& Other, int nOthChunk) const override ; // compare only outsides
|
||||
Voronoi* GetVoronoiObject( void) const override ;
|
||||
bool CalcVoronoiDiagram( ICURVEPOVECTOR& vCrvs, int nBound = VORONOI_STD_BOUND) const override ;
|
||||
bool CalcVoronoiDiagram( ICURVEPOVECTOR& vCrvs, int nBound = 3) const override ;
|
||||
bool CalcMedialAxis( ICURVEPOVECTOR& vCrvs, int nSide) const override ;
|
||||
|
||||
public : // IGeoObjRW
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "GeoConst.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "SurfFlatRegion.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
@@ -28,11 +29,7 @@ SurfFlatRegion::CreateOffsetSurf( double dDist, int nType) const
|
||||
{
|
||||
// restituisce la superficie offsettata senza modificare la superficie corrente. In caso di errore restituisce nullptr
|
||||
|
||||
// imposto metodo di calcolo
|
||||
bool bUseVoronoi = false ;
|
||||
#ifdef _VRONI
|
||||
bUseVoronoi = true ;
|
||||
#endif // _VRONI
|
||||
// metodo di calcolo impostato da USE_VORONOI
|
||||
|
||||
// recupero il numero dei chunk
|
||||
int nChunk = GetChunkCount() ;
|
||||
@@ -49,7 +46,7 @@ SurfFlatRegion::CreateOffsetSurf( double dDist, int nType) const
|
||||
return nullptr ;
|
||||
|
||||
// -------------------- OFFSET STANDARD -------------------------------------
|
||||
if ( ! bUseVoronoi) {
|
||||
if ( ! USE_VORONOI) {
|
||||
bool bFirstRegion = true ;
|
||||
// ciclo sui chunk
|
||||
for ( int i = 0 ; i < nChunk ; ++ i) {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
#include "SurfFlatRegion.h"
|
||||
#include "OffsetAux.h"
|
||||
#include "RemoveCurveDefects.h"
|
||||
#include "/EgtDev/Include/EGkVoronoi.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Voronoi.h Data : 23.11.23 Versione : 2.5k5
|
||||
// Contenuto : Dichiarazione della classe Voronoi con libreria VRONI
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 23.11.23 SP Creazione modulo.
|
||||
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EGkFrame3d.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Extern/vroni/Include/vroni_object.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const bool USE_VORONOI = true ;
|
||||
static const int VORONOI_STD_BOUND = 3 ;
|
||||
static const double VRONI_OFFS_TOL = 1e-14 ;
|
||||
|
||||
//-------------------------- Forward Definitions -------------------------------
|
||||
class ISurfFlatRegion ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Voronoi
|
||||
{
|
||||
public :
|
||||
// costanti per il lato del medial axis
|
||||
enum WMATSide { WMAT_BOTHSIDES = 0,
|
||||
WMAT_LEFT = 1,
|
||||
WMAT_RIGHT = 2} ;
|
||||
public :
|
||||
Voronoi( void)
|
||||
: m_vroni( nullptr), m_nBound( VORONOI_STD_BOUND), m_bVDComputed( false), m_bAllowAdd( true) {} ;
|
||||
Voronoi( const ICurve* pCrv, bool bAllowAdd) ;
|
||||
Voronoi( const ISurfFlatRegion* pSfr, bool bAllowAdd) ;
|
||||
~Voronoi( void) ;
|
||||
|
||||
public :
|
||||
bool AddCurve( const ICurve* pCrv) ;
|
||||
bool AddSurfFlatRegion( const ISurfFlatRegion* pSfr) ;
|
||||
ICurve* GetCurve( int nId) const ;
|
||||
int GetCurveCount( void) const
|
||||
{ return m_vpCrvs.size() ; } ;
|
||||
bool CalcVoronoiDiagram( ICURVEPOVECTOR& vCrvs, int nBound = VORONOI_STD_BOUND) ;
|
||||
bool CalcOffset( ICURVEPOVECTOR& vOffs, double dOffs, int nType) ;
|
||||
bool CalcFatCurve( ICURVEPOVECTOR& vOffs, double dOffs, bool bSquareEnds, bool bSquareMids) ;
|
||||
bool CalcMedialAxis( ICURVEPOVECTOR& vCrvs, int nSide) ;
|
||||
|
||||
private :
|
||||
bool Clear( void) ;
|
||||
bool IsValid( void) const
|
||||
{ return m_vroni != nullptr ; } ;
|
||||
bool AddCurveToVroni( const ICurve * pCrv) ;
|
||||
bool AddLineToVroni( const ICurveLine* pLine, int& nVroniCrv, int nLoopId, int nCrvId = 0, Point3d ptForcedEnd = P_INVALID) ;
|
||||
bool AddArcToVroni( const ICurveArc* pArc, int& nVroniCrv, int nLoopId, int nCrvId = 0, Point3d ptForcedEnd = P_INVALID) ;
|
||||
bool AddCompoToVroni( const ICurveComposite* pCompo, int& nCrv, int nLoopId) ;
|
||||
bool AddBezierToVroni( const ICurveBezier* pBezier, int& nVroniCrv, int nLoopId) ;
|
||||
|
||||
bool CalcVoronoi( int nBound = VORONOI_STD_BOUND) ;
|
||||
bool CalcVroniOffset( ICRVCOMPOPLIST& vOffs, double dOffs, bool bRightOffs, bool bLeftOffs) ;
|
||||
bool UpdateVoronoi( double dOffs) ;
|
||||
bool VerifyCurvesValidityForOffset( void) ;
|
||||
bool AdjustOpenOffsetCurve( ICurveComposite& pCompo, double dOffs) ;
|
||||
bool AdjustOffsetStart( ICurveComposite& pCompo) ;
|
||||
int GetOffsetCurveSide( const ICurveComposite& pOffs, int nCrv) ;
|
||||
ICurve* GetBisectorCurve( int i) ;
|
||||
|
||||
private :
|
||||
vroniObject* m_vroni ; // oggetto base della libreria vroni
|
||||
Frame3d m_Frame ; // frame in cui è espresso l'oggetto vroni
|
||||
int m_nBound ; // bound associato al diagramma di Voronoi corrente
|
||||
CICURVEPVECTOR m_vpCrvs ; // curve associate al Voronoi ( espresse rispetto a m_Frame)
|
||||
BBox3d m_bBox ; // box degli oggetti associati al Voronoi
|
||||
bool m_bVDComputed ; // indica se il diagramma di Voronoi è stato calcolato
|
||||
bool m_bAllowAdd ; // indica se possibile aggiungere altre curve/superifici dopo aver creato l'oggetto Voronoi
|
||||
} ;
|
||||
Reference in New Issue
Block a user