Merge commit '47e79756d17ae312d89d3617289bccabcb4bcf66' into BoolStm
This commit is contained in:
+19
-28
@@ -81,8 +81,7 @@ Attribs::Dump( const GeomDB& GDB, string& sOut, bool bMM, const char* szNewLine)
|
||||
}
|
||||
sOut += szNewLine ;
|
||||
// eventuali nome e stringhe informative
|
||||
STRLIST::const_iterator iIter ;
|
||||
for ( iIter = m_slInfo.begin() ; iIter != m_slInfo.end() ; ++ iIter)
|
||||
for ( auto iIter = m_slInfo.cbegin() ; iIter != m_slInfo.cend() ; ++ iIter)
|
||||
sOut += *iIter + szNewLine ;
|
||||
|
||||
return true ;
|
||||
@@ -101,7 +100,7 @@ Attribs::Save( NgeWriter& ngeOut) const
|
||||
// modo
|
||||
if ( ! ngeOut.WriteUchar( m_Data[MODE], ","))
|
||||
return false ;
|
||||
// stato (se SEL � convertito in ON)
|
||||
// stato (se SEL è convertito in ON)
|
||||
int nStat = (( m_Data[STATUS] > GDB_ST_ON) ? GDB_ST_ON : m_Data[STATUS]) ;
|
||||
if ( ! ngeOut.WriteUchar( nStat, ","))
|
||||
return false ;
|
||||
@@ -118,8 +117,7 @@ Attribs::Save( NgeWriter& ngeOut) const
|
||||
if ( ! ngeOut.WriteInt( int( m_slInfo.size()), ";", true))
|
||||
return false ;
|
||||
// stringhe di info
|
||||
STRLIST::const_iterator iIter ;
|
||||
for ( iIter = m_slInfo.begin() ; iIter != m_slInfo.end() ; ++ iIter) {
|
||||
for ( auto iIter = m_slInfo.cbegin() ; iIter != m_slInfo.cend() ; ++ iIter) {
|
||||
if ( ! ngeOut.WriteString( *iIter, nullptr, true))
|
||||
return false ;
|
||||
}
|
||||
@@ -141,7 +139,7 @@ Attribs::Load( NgeReader& ngeIn)
|
||||
if ( ! ngeIn.ReadUchar( ucMode, ","))
|
||||
return false ;
|
||||
m_Data[MODE] = CLIP( ucMode, GDB_MD_STD, GDB_MD_HIDDEN) ;
|
||||
// stato (se SEL � convertito in ON)
|
||||
// stato (se SEL è convertito in ON)
|
||||
unsigned char ucStat ;
|
||||
if ( ! ngeIn.ReadUchar( ucStat, ","))
|
||||
return false ;
|
||||
@@ -177,7 +175,7 @@ Attribs::Load( NgeReader& ngeIn)
|
||||
bool
|
||||
Attribs::DataFromString( const string& sParam)
|
||||
{
|
||||
// il primo parametro � diviso in 4 parti
|
||||
// il primo parametro è diviso in 4 parti
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam, ",", vsParams) ;
|
||||
// 4 parti
|
||||
@@ -215,10 +213,9 @@ Attribs::SetName( const string& sName)
|
||||
if ( sName.empty() || ! IsValidVal( sName))
|
||||
return false ;
|
||||
|
||||
// pu� essere solo la prima stringa
|
||||
STRLIST::iterator iIter ;
|
||||
if ( ( iIter = m_slInfo.begin()) != m_slInfo.end() &&
|
||||
FindKey( *iIter, NAME)) {
|
||||
// può essere solo la prima stringa
|
||||
auto iIter = m_slInfo.begin() ;
|
||||
if ( iIter != m_slInfo.end() && FindKey( *iIter, NAME)) {
|
||||
*iIter = NAME + EQUAL + sName ;
|
||||
return true ;
|
||||
}
|
||||
@@ -237,10 +234,9 @@ Attribs::SetName( const string& sName)
|
||||
bool
|
||||
Attribs::GetName( string& sName) const
|
||||
{
|
||||
// pu� essere solo la prima stringa
|
||||
STRLIST::const_iterator iIter ;
|
||||
if ( ( iIter = m_slInfo.begin()) != m_slInfo.end() &&
|
||||
FindKey( *iIter, NAME)) {
|
||||
// può essere solo la prima stringa
|
||||
const auto iIter = m_slInfo.cbegin() ;
|
||||
if ( iIter != m_slInfo.cend() && FindKey( *iIter, NAME)) {
|
||||
sName = iIter->substr( NAME.length() + 1) ;
|
||||
return true ;
|
||||
}
|
||||
@@ -252,23 +248,18 @@ Attribs::GetName( string& sName) const
|
||||
bool
|
||||
Attribs::ExistsName( void) const
|
||||
{
|
||||
// pu� essere solo la prima stringa
|
||||
STRLIST::const_iterator iIter ;
|
||||
if ( ( iIter = m_slInfo.begin()) != m_slInfo.end() &&
|
||||
FindKey( *iIter, NAME))
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
// può essere solo la prima stringa
|
||||
const auto iIter = m_slInfo.cbegin() ;
|
||||
return ( iIter != m_slInfo.cend() && FindKey( *iIter, NAME)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Attribs::RemoveName( void)
|
||||
{
|
||||
// pu� essere solo la prima stringa
|
||||
STRLIST::const_iterator iIter ;
|
||||
if ( ( iIter = m_slInfo.begin()) != m_slInfo.end() &&
|
||||
FindKey( *iIter, NAME)) {
|
||||
// può essere solo la prima stringa
|
||||
const auto iIter = m_slInfo.cbegin() ;
|
||||
if ( iIter != m_slInfo.cend() && FindKey( *iIter, NAME)) {
|
||||
m_slInfo.pop_front() ;
|
||||
return true ;
|
||||
}
|
||||
@@ -285,11 +276,11 @@ Attribs::SetInfo( const string& sKey, const string& sVal)
|
||||
if ( ! IsValidKey( sKey) || sVal.empty() || ! IsValidVal( sVal))
|
||||
return false ;
|
||||
|
||||
// se � il nome
|
||||
// se è il nome
|
||||
if ( sKey == NAME)
|
||||
return SetName( sVal) ;
|
||||
|
||||
// se esiste gi� una stringa con quella chiave la sostituisco
|
||||
// se esiste già una stringa con quella chiave la sostituisco
|
||||
for ( auto iIter = m_slInfo.begin() ; iIter != m_slInfo.end() ; ++ iIter) {
|
||||
if ( FindKey( *iIter, sKey)) {
|
||||
*iIter = sKey + EQUAL + sVal ;
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2018-2018
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CAToolSurfTm.cpp Data : 08.05.18 Versione : 1.9e2
|
||||
// Contenuto : Implementazione della classe CAToolSurfTm.
|
||||
// File : CAvToolSurfTm.cpp Data : 08.05.18 Versione : 1.9e2
|
||||
// Contenuto : Implementazione della classe CAvToolSurfTm.
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
||||
const Triangle3d& trTria, const Vector3d& vtMove)
|
||||
{
|
||||
// Non ha senso che il movimento sia in direzione "opposta" a quella dell'asse utensile
|
||||
if ( vtMove * vtToolAx < - EPS_ZERO)
|
||||
if ( vtMove * vtToolAx < - 10 * EPS_ZERO)
|
||||
return -1. ;
|
||||
// Se avvicinamento non devo fare nulla
|
||||
if ( vtMove * trTria.GetN() < - EPS_ZERO)
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ GetTwoGreater( int nVal0, int nVal1, int nVal2, int& nFirstMaxPos, int& nSecondM
|
||||
}
|
||||
else {
|
||||
nFirstMaxPos = 2 ;
|
||||
nSecondMaxPos = 1 ;
|
||||
nSecondMaxPos = 0 ;
|
||||
}
|
||||
}
|
||||
else if ( nVal0 > nVal2) {
|
||||
@@ -168,7 +168,7 @@ CDeTriaTria( const Triangle3d& trTriaA, const Triangle3d& trTriaB)
|
||||
Vector3d vtSegSecondB = trTriaB.GetP( ( nSecondMaxPosB + 1) % 3) - trTriaB.GetP( nSecondMaxPosB) ;
|
||||
double dSegLenSecondB = vtSegSecondB.Len() ;
|
||||
vtSegSecondB /= dSegLenSecondB ;
|
||||
DistLineLine LineLineDistCalcSecondB( ptLineP, vtLineV, 100., trTriaB.GetP( nSecondMaxPosA), vtSegSecondB, dSegLenSecondB, false) ;
|
||||
DistLineLine LineLineDistCalcSecondB( ptLineP, vtLineV, 100., trTriaB.GetP( nSecondMaxPosB), vtSegSecondB, dSegLenSecondB, false) ;
|
||||
double dIntParEnB, dOtherParSecondB ;
|
||||
LineLineDistCalcSecondB.GetPositionsAtMinDistPoints( dIntParEnB, dOtherParSecondB) ;
|
||||
// Ordino i parametri lungo la retta di intersezione fra i piani
|
||||
|
||||
+14
-14
@@ -13,22 +13,21 @@
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "DllMain.h"
|
||||
#include "GeoConst.h"
|
||||
#include "CurveLine.h"
|
||||
#include "CurveArc.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "BiArcs.h"
|
||||
#include "SurfFlatRegion.h"
|
||||
#include "GeoConst.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||
#include "/EgtDev/Include/EGkCalcPocketing.h"
|
||||
#include "EgtDev/Include/EGkFilletChamfer.h"
|
||||
#include "EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "EgtDev/Include/EGkCurveLocal.h"
|
||||
#include "EgtDev/Include/EGkMedialAxis.h"
|
||||
#include "EgtDev/Include/EGkLinePntTgCurve.h"
|
||||
#include "/EgtDev/Include/EGkFilletChamfer.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkCurveLocal.h"
|
||||
#include "/EgtDev/Include/EGkMedialAxis.h"
|
||||
#include "/EgtDev/Include/EGkLinePntTgCurve.h"
|
||||
#include <array>
|
||||
|
||||
using namespace std ;
|
||||
@@ -1896,7 +1895,7 @@ CalcSpiral( const ISurfFlatRegion* pSrfPock, double dRad, double dStep, bool bSm
|
||||
if ( IsNull( pSrfAct) || pSrfAct->GetChunkCount() == 0)
|
||||
return false ;
|
||||
|
||||
double dOffsPrec = dOffs ;
|
||||
double dOffsPrec = 0. ;
|
||||
while ( nIter < MAX_ITER) {
|
||||
// ricavo la regione piana da VRONI
|
||||
PtrOwner<ISurfFlatRegion> pSfrOffsVR( pSrfAct->CreateOffsetSurf( - dOffs, ICurve::OFF_FILLET)) ;
|
||||
@@ -1940,16 +1939,17 @@ CalcSpiral( const ISurfFlatRegion* pSrfPock, double dRad, double dStep, bool bSm
|
||||
}
|
||||
|
||||
// controllo se serve un raggio più piccolo di svuotatura
|
||||
bool bSmallRad = ( nIter == 0 ? dOffs - dOffsPrec < dRad + EPS_ZERO : dOffs - dOffsPrec < dRad + EPS_ZERO) ;
|
||||
// memorizzo il valore di Offset per l'iterazione successiva
|
||||
dOffsPrec = dOffs ;
|
||||
bool bSmallRad = ( nIter == 0 ? dOffs < dRad + EPS_ZERO : dOffs - dOffsPrec < dRad + EPS_ZERO) ;
|
||||
|
||||
// se ho trovato dei chunk, allora aggiorno l'Offset per la passata successiva
|
||||
if ( nChunks > 0)
|
||||
if ( nChunks > 0) {
|
||||
// memorizzo il valore di Offset per l'iterazione successiva
|
||||
dOffsPrec = dOffs ;
|
||||
dOffs += dStep ;
|
||||
}
|
||||
// se devo usare un Offset più piccolo...
|
||||
else if ( ! bSmallRad)
|
||||
dOffs += dRad ;
|
||||
dOffs = dOffsPrec + ( nIter == 0 ? dRad : dRad) ; // superfluo, effettivamente non ho l'offset radiale
|
||||
// altrimenti ho finito la regione da svuotare...
|
||||
else
|
||||
break ;
|
||||
|
||||
@@ -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) ;
|
||||
|
||||
+36
-12
@@ -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"
|
||||
@@ -37,6 +38,9 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const double EPS_CONNECT = 0.01 * EPS_SMALL ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
GEOOBJ_REGISTER( CRV_COMPO, NGE_C_CMP, CurveComposite) ;
|
||||
|
||||
@@ -214,7 +218,7 @@ CurveComposite::AddSimpleCurve( ICurve* pSmplCrv, bool bEndOrStart, double dLinT
|
||||
// verifico sia in continuità con il finale attuale
|
||||
Point3d ptEnd ;
|
||||
GetEndPoint( ptEnd) ;
|
||||
if ( ! AreSamePointEpsilon( ptCrvStart, ptEnd, 0.01 * EPS_SMALL)) {
|
||||
if ( ! AreSamePointEpsilon( ptCrvStart, ptEnd, EPS_CONNECT)) {
|
||||
// se in tolleranza, modifico l'inizio dell'entità
|
||||
if ( SqDist( ptCrvStart, ptEnd) < ( dLinTol * dLinTol)) {
|
||||
// lunghezza della curva originale
|
||||
@@ -236,7 +240,7 @@ CurveComposite::AddSimpleCurve( ICurve* pSmplCrv, bool bEndOrStart, double dLinT
|
||||
// verifico sia in continuità con l'iniziale attuale
|
||||
Point3d ptStart ;
|
||||
GetStartPoint( ptStart) ;
|
||||
if ( ! AreSamePointEpsilon( ptCrvEnd, ptStart, 0.01 * EPS_SMALL)) {
|
||||
if ( ! AreSamePointEpsilon( ptCrvEnd, ptStart, EPS_CONNECT)) {
|
||||
// se in tolleranza, modifico la fine dell'entità
|
||||
if ( SqDist( ptCrvEnd, ptStart) < ( dLinTol * dLinTol)) {
|
||||
// lunghezza della curva originale
|
||||
@@ -266,7 +270,8 @@ CurveComposite::AddSimpleCurve( ICurve* pSmplCrv, bool bEndOrStart, double dLinT
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
return true ;
|
||||
|
||||
return TestClosure() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -282,7 +287,7 @@ CurveComposite::Close( void)
|
||||
! GetEndPoint( ptEnd))
|
||||
return false ;
|
||||
// se distanza inferiore al limite ridotto, non faccio alcunché
|
||||
if ( AreSamePointEpsilon( ptStart, ptEnd, EPS_SMALL / 10))
|
||||
if ( AreSamePointEpsilon( ptStart, ptEnd, EPS_CONNECT))
|
||||
return true ;
|
||||
// se molto vicini li modifico
|
||||
if ( AreSamePointEpsilon( ptStart, ptEnd, 10 * EPS_SMALL)) {
|
||||
@@ -832,8 +837,7 @@ CurveComposite::Validate( void)
|
||||
Point3d ptStart ;
|
||||
// ciclo su tutte le curve
|
||||
int nCount = 0 ;
|
||||
PCSD_CONST_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter) {
|
||||
for ( auto Iter = m_CrvSmplS.cbegin() ; Iter != m_CrvSmplS.cend() ; ++Iter) {
|
||||
// verifico validità della curva e sua semplicità
|
||||
if ( ! (*Iter)->IsValid() || (*Iter)->GetType() == CRV_COMPO) {
|
||||
m_nStatus = ERR ;
|
||||
@@ -856,9 +860,32 @@ CurveComposite::Validate( void)
|
||||
m_nStatus = ( nCount > 0 ? OK : TO_VERIFY) ;
|
||||
}
|
||||
|
||||
// verifico chiusura
|
||||
TestClosure() ;
|
||||
|
||||
return ( m_nStatus == OK) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::TestClosure( void)
|
||||
{
|
||||
// se non è chiusa, esco subito
|
||||
if ( ! IsClosed())
|
||||
return true ;
|
||||
// verifico ed eventualmente aggiusto coincidenza punti estremi
|
||||
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, EPS_CONNECT)) {
|
||||
Point3d ptM = Media( ptStart, ptEnd) ;
|
||||
if ( ! m_CrvSmplS.front()->ModifyStart( ptM) ||
|
||||
! m_CrvSmplS.back()->ModifyEnd( ptM))
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::IsFlat( Plane3d& plPlane, bool bUseExtrusion, double dToler) const
|
||||
@@ -1188,8 +1215,7 @@ CurveComposite::GetLength( double& dLen) const
|
||||
|
||||
// ciclo di calcolo
|
||||
dLen = 0 ;
|
||||
PCSD_CONST_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter) {
|
||||
for ( auto Iter = m_CrvSmplS.cbegin() ; Iter != m_CrvSmplS.cend() ; ++Iter) {
|
||||
double dLenCrvSmpl ;
|
||||
if ( (*Iter)->GetLength( dLenCrvSmpl))
|
||||
dLen += dLenCrvSmpl ;
|
||||
@@ -1215,8 +1241,7 @@ CurveComposite::GetLengthAtParam( double dU, double& dLen) const
|
||||
// ciclo di calcolo
|
||||
dLen = 0 ;
|
||||
double dUToGo = dU ;
|
||||
PCSD_CONST_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter) {
|
||||
for ( auto Iter = m_CrvSmplS.cbegin() ; Iter != m_CrvSmplS.cend() ; ++Iter) {
|
||||
// dominio parametrico della curva semplice
|
||||
double dParStart, dParEnd ;
|
||||
(*Iter)->GetDomain( dParStart, dParEnd) ;
|
||||
@@ -1264,8 +1289,7 @@ CurveComposite::GetParamAtLength( double dLen, double& dU) const
|
||||
// ciclo di calcolo
|
||||
dU = 0 ;
|
||||
double dLenToGo = dLen ;
|
||||
PCSD_CONST_ITER Iter ;
|
||||
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter) {
|
||||
for ( auto Iter = m_CrvSmplS.cbegin() ; Iter != m_CrvSmplS.cend() ; ++Iter) {
|
||||
// lunghezza della curva semplice
|
||||
double dCrvLen ;
|
||||
if ( ! (*Iter)->GetLength( dCrvLen))
|
||||
|
||||
+4
-3
@@ -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,10 +194,12 @@ 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) ;
|
||||
bool Validate( void) ;
|
||||
bool TestClosure( void) ;
|
||||
bool AddCurveByRelocate( CurveComposite& ccSrc, bool bEndOrStart = true, double dLinTol = EPS_SMALL) ;
|
||||
bool AddSimpleCurve( ICurve* pSmplCrv, bool bEndOrStart = true, double dLinTol = EPS_SMALL) ;
|
||||
bool GetIndSCurveAndLocPar( double dU, Side nS, int& nSCrv, double& dLocU) const ;
|
||||
@@ -211,7 +213,6 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
|
||||
private :
|
||||
typedef std::deque<ICurve*> PCRVSMPL_DEQUE ;
|
||||
typedef PCRVSMPL_DEQUE::iterator PCSD_ITER ;
|
||||
typedef PCRVSMPL_DEQUE::const_iterator PCSD_CONST_ITER ;
|
||||
|
||||
private :
|
||||
|
||||
@@ -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) ;
|
||||
|
||||
+4
-4
@@ -59,7 +59,7 @@ DistLineLine::DistLineLine( const Point3d& ptSt1, const Vector3d& vtD1, double d
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistLineLine::GetSqDist( double& dSqDist)
|
||||
DistLineLine::GetSqDist( double& dSqDist) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
@@ -70,7 +70,7 @@ DistLineLine::GetSqDist( double& dSqDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistLineLine::GetDist( double& dDist)
|
||||
DistLineLine::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
@@ -83,7 +83,7 @@ DistLineLine::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistLineLine::GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2)
|
||||
DistLineLine::GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
@@ -94,7 +94,7 @@ DistLineLine::GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistLineLine::GetPositionsAtMinDistPoints( double& dPos1, double& dPos2)
|
||||
DistLineLine::GetPositionsAtMinDistPoints( double& dPos1, double& dPos2) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
|
||||
+11
-11
@@ -28,16 +28,16 @@ class DistLineLine
|
||||
bool bIsSegment1 = true, bool bIsSegment2 = true) ;
|
||||
|
||||
public :
|
||||
bool GetSqDist( double& dSqDist) ;
|
||||
bool GetDist( double& dDist) ;
|
||||
bool IsEpsilon( double dTol) {
|
||||
double dSqDist ;
|
||||
return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ;
|
||||
}
|
||||
bool IsSmall( void) { return IsEpsilon( EPS_SMALL) ; }
|
||||
bool IsZero( void) { return IsEpsilon( EPS_ZERO) ; }
|
||||
bool GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2) ;
|
||||
bool GetPositionsAtMinDistPoints( double& dPos1, double& dPos2) ;
|
||||
bool GetSqDist( double& dSqDist) const ;
|
||||
bool GetDist( double& dDist) const ;
|
||||
bool IsEpsilon( double dTol) const
|
||||
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
||||
bool IsSmall( void) const
|
||||
{ return IsEpsilon( EPS_SMALL) ; }
|
||||
bool IsZero( void) const
|
||||
{ return IsEpsilon( EPS_ZERO) ; }
|
||||
bool GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2) const ;
|
||||
bool GetPositionsAtMinDistPoints( double& dPos1, double& dPos2) const ;
|
||||
|
||||
private :
|
||||
void Calculate( const Point3d& ptSt1, const Vector3d& vtD1, double dLen1,
|
||||
@@ -45,7 +45,7 @@ class DistLineLine
|
||||
bool bIsSegment1, bool bIsSegment2) ;
|
||||
private:
|
||||
double m_dSqDist ;
|
||||
double m_dDist ;
|
||||
mutable double m_dDist ;
|
||||
double m_dPos1 ;
|
||||
double m_dPos2 ;
|
||||
Point3d m_ptMinDist1 ;
|
||||
|
||||
+5
-6
@@ -122,14 +122,13 @@ DistPointArc::DistPointHelix( const Point3d& ptP, const ICurveArc& arArc)
|
||||
|
||||
// cerco la minima distanza per la polilinea
|
||||
MDCVECTOR vApproxMin ;
|
||||
MDCVECTOR::iterator Iter ;
|
||||
if ( ! CalcMinDistPointPolyLine( ptP, PL, dLinTol, vApproxMin))
|
||||
return ;
|
||||
|
||||
// raffino i punti trovati
|
||||
double dPolishedPar ;
|
||||
Point3d ptPolishedQ ;
|
||||
for ( Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
for ( auto Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
// eseguo raffinamento
|
||||
if ( PolishMinDistPointCurve( ptP, arArc, *Iter, dPolishedPar, ptPolishedQ)) {
|
||||
(*Iter).dDist = Dist( ptP, ptPolishedQ) ;
|
||||
@@ -148,7 +147,7 @@ DistPointArc::DistPointHelix( const Point3d& ptP, const ICurveArc& arArc)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointArc::GetSqDist( double& dSqDist)
|
||||
DistPointArc::GetSqDist( double& dSqDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -159,7 +158,7 @@ DistPointArc::GetSqDist( double& dSqDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointArc::GetDist( double& dDist)
|
||||
DistPointArc::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -170,7 +169,7 @@ DistPointArc::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointArc::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
DistPointArc::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -185,7 +184,7 @@ DistPointArc::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointArc::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
||||
DistPointArc::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
|
||||
+9
-8
@@ -27,17 +27,18 @@ class DistPointArc
|
||||
DistPointArc( const Point3d& ptP, const ICurveArc& arArc) ;
|
||||
|
||||
public :
|
||||
bool GetSqDist( double& dSqDist) ;
|
||||
bool GetDist( double& dDist) ;
|
||||
bool IsEpsilon( double dTol)
|
||||
bool GetSqDist( double& dSqDist) const ;
|
||||
bool GetDist( double& dDist) const ;
|
||||
bool IsEpsilon( double dTol) const
|
||||
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
||||
bool IsSmall( void)
|
||||
bool IsSmall( void) const
|
||||
{ return IsEpsilon( EPS_SMALL) ; }
|
||||
bool IsZero( void)
|
||||
bool IsZero( void) const
|
||||
{ return IsEpsilon( EPS_ZERO) ; }
|
||||
int GetNbrMinDist( void) { return (int) m_Info.size() ; }
|
||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) ;
|
||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) ;
|
||||
int GetNbrMinDist( void) const
|
||||
{ return (int) m_Info.size() ; }
|
||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const ;
|
||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const ;
|
||||
|
||||
private :
|
||||
DistPointArc( void) ;
|
||||
|
||||
+1
-4
@@ -156,13 +156,10 @@ bool
|
||||
FilterMinDistPointCurve( const Point3d& ptP, const ICurve& cCurve,
|
||||
const MDCVECTOR& vApproxMin, double& dMinDist, MDPCIVECTOR& Info)
|
||||
{
|
||||
MDCVECTOR::const_iterator Iter ;
|
||||
|
||||
|
||||
// determino i minimi raffinati da tenere
|
||||
bool bFound = false ;
|
||||
bool bLastOnEnd = false ; // flag per ultimo punto su fine del suo intervallo
|
||||
for ( Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
for ( auto Iter = vApproxMin.cbegin() ; Iter != vApproxMin.cend() ; ++Iter) {
|
||||
// altro punto con la stessa minima distanza
|
||||
if ( bFound && abs( (*Iter).dDist - dMinDist) < EPS_SMALL) {
|
||||
// se abbastanza lontano e non su bordi intervallino lo aggiungo
|
||||
|
||||
@@ -44,7 +44,6 @@ DistPointCrvBezier::DistPointCrvBezier( const Point3d& ptP, const ICurveBezier&
|
||||
|
||||
// cerco la minima distanza per la polilinea
|
||||
MDCVECTOR vApproxMin ;
|
||||
MDCVECTOR::iterator Iter ;
|
||||
if ( ! CalcMinDistPointPolyLine( ptP, PL, dLinTol, vApproxMin))
|
||||
return ;
|
||||
|
||||
@@ -52,7 +51,7 @@ DistPointCrvBezier::DistPointCrvBezier( const Point3d& ptP, const ICurveBezier&
|
||||
double dSingP ;
|
||||
if ( CrvBez.GetSingularParam( dSingP) == 0)
|
||||
dSingP = - 1 ;
|
||||
for ( Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
for ( auto Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
// imposto flag per singolarità agli estremi
|
||||
(*Iter).bParMinSing = abs( (*Iter).dParMin - dSingP) < EPS_SMALL ;
|
||||
(*Iter).bParMaxSing = abs( (*Iter).dParMax - dSingP) < EPS_SMALL ;
|
||||
@@ -61,7 +60,7 @@ DistPointCrvBezier::DistPointCrvBezier( const Point3d& ptP, const ICurveBezier&
|
||||
// raffino i punti trovati
|
||||
double dPolishedPar ;
|
||||
Point3d ptPolishedQ ;
|
||||
for ( Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
for ( auto Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
// eseguo raffinamento
|
||||
if ( PolishMinDistPointCurve( ptP, CrvBez, *Iter, dPolishedPar, ptPolishedQ)) {
|
||||
(*Iter).dDist = Dist( ptP, ptPolishedQ) ;
|
||||
@@ -80,7 +79,7 @@ DistPointCrvBezier::DistPointCrvBezier( const Point3d& ptP, const ICurveBezier&
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvBezier::GetSqDist( double& dSqDist)
|
||||
DistPointCrvBezier::GetSqDist( double& dSqDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -91,7 +90,7 @@ DistPointCrvBezier::GetSqDist( double& dSqDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvBezier::GetDist( double& dDist)
|
||||
DistPointCrvBezier::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -102,7 +101,7 @@ DistPointCrvBezier::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvBezier::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
DistPointCrvBezier::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -117,7 +116,7 @@ DistPointCrvBezier::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvBezier::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
||||
DistPointCrvBezier::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
|
||||
@@ -27,17 +27,18 @@ class DistPointCrvBezier
|
||||
DistPointCrvBezier( const Point3d& ptP, const ICurveBezier& CrvBez) ;
|
||||
|
||||
public :
|
||||
bool GetSqDist( double& dSqDist) ;
|
||||
bool GetDist( double& dDist) ;
|
||||
bool IsEpsilon( double dTol)
|
||||
bool GetSqDist( double& dSqDist) const ;
|
||||
bool GetDist( double& dDist) const ;
|
||||
bool IsEpsilon( double dTol) const
|
||||
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
||||
bool IsSmall( void)
|
||||
bool IsSmall( void) const
|
||||
{ return IsEpsilon( EPS_SMALL) ; }
|
||||
bool IsZero( void)
|
||||
bool IsZero( void) const
|
||||
{ return IsEpsilon( EPS_ZERO) ; }
|
||||
int GetNbrMinDist( void) { return (int) m_Info.size() ; }
|
||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) ;
|
||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) ;
|
||||
int GetNbrMinDist( void) const
|
||||
{ return (int) m_Info.size() ; }
|
||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const ;
|
||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const ;
|
||||
|
||||
private :
|
||||
DistPointCrvBezier( void) ;
|
||||
|
||||
@@ -129,7 +129,7 @@ DistPointCrvComposite::DistPointCrvComposite( const Point3d& ptP, const ICurveCo
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvComposite::GetSqDist( double& dSqDist)
|
||||
DistPointCrvComposite::GetSqDist( double& dSqDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -140,7 +140,7 @@ DistPointCrvComposite::GetSqDist( double& dSqDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvComposite::GetDist( double& dDist)
|
||||
DistPointCrvComposite::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -151,7 +151,7 @@ DistPointCrvComposite::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvComposite::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
DistPointCrvComposite::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -166,7 +166,7 @@ DistPointCrvComposite::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvComposite::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
||||
DistPointCrvComposite::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
|
||||
@@ -26,17 +26,18 @@ class DistPointCrvComposite
|
||||
DistPointCrvComposite( const Point3d& ptP, const ICurveComposite& CrvCompo) ;
|
||||
|
||||
public :
|
||||
bool GetSqDist( double& dSqDist) ;
|
||||
bool GetDist( double& dDist) ;
|
||||
bool IsEpsilon( double dTol)
|
||||
bool GetSqDist( double& dSqDist) const ;
|
||||
bool GetDist( double& dDist) const ;
|
||||
bool IsEpsilon( double dTol) const
|
||||
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
||||
bool IsSmall( void)
|
||||
bool IsSmall( void) const
|
||||
{ return IsEpsilon( EPS_SMALL) ; }
|
||||
bool IsZero( void)
|
||||
bool IsZero( void) const
|
||||
{ return IsEpsilon( EPS_ZERO) ; }
|
||||
int GetNbrMinDist( void) { return (int) m_Info.size() ; }
|
||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) ;
|
||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) ;
|
||||
int GetNbrMinDist( void) const
|
||||
{ return (int) m_Info.size() ; }
|
||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const ;
|
||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const ;
|
||||
|
||||
private :
|
||||
DistPointCrvComposite( void) ;
|
||||
|
||||
+9
-9
@@ -98,7 +98,7 @@ DistPointCurve::CrvCompositeCalculate( const Point3d& ptP, const ICurve& Curve)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetSqDist( double& dSqDist)
|
||||
DistPointCurve::GetSqDist( double& dSqDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -109,7 +109,7 @@ DistPointCurve::GetSqDist( double& dSqDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetDist( double& dDist)
|
||||
DistPointCurve::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -120,7 +120,7 @@ DistPointCurve::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
DistPointCurve::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
@@ -132,7 +132,7 @@ DistPointCurve::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetMinDistPoint( double dNearParam, Point3d& ptMinDist, int& nFlag)
|
||||
DistPointCurve::GetMinDistPoint( double dNearParam, Point3d& ptMinDist, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0 || m_Info.empty())
|
||||
return false ;
|
||||
@@ -166,7 +166,7 @@ DistPointCurve::GetMinDistPoint( double dNearParam, Point3d& ptMinDist, int& nFl
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
||||
DistPointCurve::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
@@ -178,7 +178,7 @@ DistPointCurve::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetParamAtMinDistPoint( double dNearParam, double& dParam, int& nFlag)
|
||||
DistPointCurve::GetParamAtMinDistPoint( double dNearParam, double& dParam, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0 || m_Info.empty())
|
||||
return false ;
|
||||
@@ -209,7 +209,7 @@ DistPointCurve::GetParamAtMinDistPoint( double dNearParam, double& dParam, int&
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide)
|
||||
DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide) const
|
||||
{
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
@@ -257,7 +257,7 @@ DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetSideAtMinDistPoint( double dNearParam, const Vector3d& vtN, int& nSide)
|
||||
DistPointCurve::GetSideAtMinDistPoint( double dNearParam, const Vector3d& vtN, int& nSide) const
|
||||
{
|
||||
if ( m_dDist < 0 || m_Info.empty())
|
||||
return false ;
|
||||
@@ -278,7 +278,7 @@ DistPointCurve::GetSideAtMinDistPoint( double dNearParam, const Vector3d& vtN, i
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetMinDistInfo( int nInd, MinDistPCInfo& aInfo)
|
||||
DistPointCurve::GetMinDistInfo( int nInd, MinDistPCInfo& aInfo) const
|
||||
{
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
|
||||
+4
-4
@@ -95,7 +95,7 @@ DistPointLine::Calculate( const Point3d& ptP,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointLine::GetSqDist( double& dSqDist)
|
||||
DistPointLine::GetSqDist( double& dSqDist) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
@@ -106,7 +106,7 @@ DistPointLine::GetSqDist( double& dSqDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointLine::GetDist( double& dDist)
|
||||
DistPointLine::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
@@ -119,7 +119,7 @@ DistPointLine::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointLine::GetMinDistPoint( Point3d& ptMinDist)
|
||||
DistPointLine::GetMinDistPoint( Point3d& ptMinDist) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
@@ -130,7 +130,7 @@ DistPointLine::GetMinDistPoint( Point3d& ptMinDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointLine::GetParamAtMinDistPoint( double& dParam)
|
||||
DistPointLine::GetParamAtMinDistPoint( double& dParam) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
|
||||
+9
-9
@@ -31,18 +31,18 @@ class DistPointLine
|
||||
const Point3d& ptIni, const Vector3d& vtDir, double dLen, bool bIsSegment = true) ;
|
||||
|
||||
public :
|
||||
bool GetSqDist( double& dSqDist) ;
|
||||
bool GetDist( double& dDist) ;
|
||||
bool IsEpsilon( double dTol)
|
||||
bool GetSqDist( double& dSqDist) const ;
|
||||
bool GetDist( double& dDist) const ;
|
||||
bool IsEpsilon( double dTol) const
|
||||
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
||||
bool IsSmall( void)
|
||||
bool IsSmall( void) const
|
||||
{ return IsEpsilon( EPS_SMALL) ; }
|
||||
bool IsZero( void)
|
||||
bool IsZero( void) const
|
||||
{ return IsEpsilon( EPS_ZERO) ; }
|
||||
int GetNbrMinDist( void)
|
||||
int GetNbrMinDist( void) const
|
||||
{ return (( m_dSqDist < 0) ? 0 : 1) ; }
|
||||
bool GetMinDistPoint( Point3d& ptMinDist) ;
|
||||
bool GetParamAtMinDistPoint( double& dParam) ;
|
||||
bool GetMinDistPoint( Point3d& ptMinDist) const ;
|
||||
bool GetParamAtMinDistPoint( double& dParam) const ;
|
||||
|
||||
private :
|
||||
DistPointLine( void) ;
|
||||
@@ -51,7 +51,7 @@ class DistPointLine
|
||||
|
||||
private :
|
||||
double m_dSqDist ;
|
||||
double m_dDist ;
|
||||
mutable double m_dDist ;
|
||||
double m_dParam ;
|
||||
Point3d m_ptMinDist ;
|
||||
} ;
|
||||
|
||||
+3
-3
@@ -176,7 +176,7 @@ DistPointSurfTm::Calculate( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfTm::GetDist( double& dDist)
|
||||
DistPointSurfTm::GetDist( double& dDist) const
|
||||
{
|
||||
// Distanza non valida
|
||||
if ( m_dDist < -EPS_ZERO)
|
||||
@@ -188,7 +188,7 @@ DistPointSurfTm::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfTm::GetMinDistPoint( Point3d& ptMinDistPoint)
|
||||
DistPointSurfTm::GetMinDistPoint( Point3d& ptMinDistPoint) const
|
||||
{
|
||||
// Distanza non valida
|
||||
if ( m_dDist < -EPS_ZERO)
|
||||
@@ -200,7 +200,7 @@ DistPointSurfTm::GetMinDistPoint( Point3d& ptMinDistPoint)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfTm::GetMinDistTriaIndex( int& nMinDistIndex)
|
||||
DistPointSurfTm::GetMinDistTriaIndex( int& nMinDistIndex) const
|
||||
{
|
||||
// Distanza non valida
|
||||
if ( m_dDist < -EPS_ZERO)
|
||||
|
||||
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">
|
||||
|
||||
+293
-285
@@ -2,7 +2,7 @@
|
||||
// EgalTech 2019-2019
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ExtDimension.cpp Data : 27.12.19 Versione : 2.2a1
|
||||
// Contenuto : Implementazione della classe Dimension (quota).
|
||||
// Contenuto : Implementazione della classe Dimension ( quota).
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -63,7 +63,7 @@ ExtDimension::~ExtDimension( void)
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExtDimension::SetStyle( double dExtLineLen, double dArrowLen, double dTextDist, bool bLenIsMM,
|
||||
int nDecDigit, const string& sFont, double dTextHeight)
|
||||
int nDecDigit, const string& sFont, double dTextHeight)
|
||||
{
|
||||
m_dExtLineLen = max( dExtLineLen, MIN_EXTLINELEN) ;
|
||||
m_dArrowLen = max( dArrowLen, MIN_ARROWLEN) ;
|
||||
@@ -93,7 +93,7 @@ ExtDimension::SetLinear( const Point3d& ptP1, const Point3d& ptP2, const Point3d
|
||||
// verifico che i punti di misura non siano coincidenti
|
||||
if ( AreSamePointApprox( m_ptP1, m_ptP2))
|
||||
return false ;
|
||||
// direzione di riferimento (nel piano perpendicolare a vtN)
|
||||
// direzione di riferimento ( nel piano perpendicolare a vtN)
|
||||
m_vtDir = vtDir ;
|
||||
if ( m_vtDir.IsSmall())
|
||||
m_vtDir = m_ptP2 - m_ptP1 ;
|
||||
@@ -137,7 +137,7 @@ ExtDimension::SetLinear( const Point3d& ptP1, const Point3d& ptP2, const Point3d
|
||||
bool
|
||||
ExtDimension::SetRadial( const Point3d& ptCen, const Point3d& ptPos,
|
||||
const Vector3d& vtN, const string& sText)
|
||||
{
|
||||
{ // il punto m_ptP6 viene utilizzato per il centro
|
||||
// dichiaro quota non ancora determinata
|
||||
m_nType = DT_NONE ;
|
||||
// verifico la definizione del versore normale e del versore X
|
||||
@@ -145,25 +145,20 @@ ExtDimension::SetRadial( const Point3d& ptCen, const Point3d& ptPos,
|
||||
m_vtDir = ptPos - ptCen ;
|
||||
if ( ! m_vtN.Normalize() || ! m_vtDir.Normalize())
|
||||
return false ;
|
||||
|
||||
// porto i punti nel piano definito da ptCen e vtN
|
||||
m_ptP6 = ptCen ;
|
||||
m_ptPos = ptPos - ( ptPos - m_ptP6) * m_vtN * m_vtN ;
|
||||
m_ptP1 = ptCen ;
|
||||
m_ptPos = ptPos - ( ptPos - m_ptP5) * m_vtN * m_vtN ;
|
||||
m_ptP3 = m_ptP1 ;
|
||||
m_ptP5 = m_ptP1 ;
|
||||
m_ptP2 = m_ptPos ;
|
||||
m_ptP4 = m_ptPos ;
|
||||
m_ptP6 = m_ptPos ;
|
||||
|
||||
// verifico che i punti di misura non siano coincidenti
|
||||
if ( AreSamePointApprox( m_ptP5, m_ptPos))
|
||||
if ( AreSamePointApprox( m_ptP6, m_ptPos))
|
||||
return false ;
|
||||
|
||||
// assegnazione del testo
|
||||
// assegnazione del testo
|
||||
m_sText = sText ;
|
||||
// assegno il tipo
|
||||
// assegno il tipo
|
||||
m_nType = DT_RADIAL ;
|
||||
// imposto da calcolare
|
||||
// imposto da calcolare
|
||||
m_bToCalc = true ;
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -174,7 +169,7 @@ ExtDimension::SetRadial( const Point3d& ptCen, const Point3d& ptPos,
|
||||
bool
|
||||
ExtDimension::SetDiametral( const Point3d& ptCen, const Point3d& ptPos,
|
||||
const Vector3d& vtN, const string& sText)
|
||||
{
|
||||
{ // il punto m_ptP6 viene utilizzato per il centro
|
||||
// dichiaro quota non ancora determinata
|
||||
m_nType = DT_NONE ;
|
||||
// verifico la definizione del versore normale e del versore X
|
||||
@@ -182,26 +177,21 @@ ExtDimension::SetDiametral( const Point3d& ptCen, const Point3d& ptPos,
|
||||
m_vtDir = ptPos - ptCen ;
|
||||
if ( ! m_vtN.Normalize() || ! m_vtDir.Normalize())
|
||||
return false ;
|
||||
|
||||
// porto i punti nel piano definito da ptP1 e vtN
|
||||
m_ptPos = ptPos - ( ptPos - ptCen) * m_vtN * m_vtN ;
|
||||
// porto i punti nel piano definito da ptP6 e vtN
|
||||
m_ptP6 = ptCen ;
|
||||
m_ptPos = ptPos - ( ptPos - m_ptP6) * m_vtN * m_vtN ;
|
||||
m_ptP2 = m_ptPos ;
|
||||
m_ptP6 = m_ptPos ;
|
||||
m_ptP4 = m_ptPos ;
|
||||
// ottengo il punto diametralmente opposto a ptPos
|
||||
m_ptP1 = ptCen - ( m_ptPos - ptCen) ;
|
||||
m_ptP5 = m_ptP1 ;
|
||||
m_ptP3 = m_ptP1 ;
|
||||
|
||||
// verifico che i punti di misura non siano coincidenti
|
||||
if ( AreSamePointApprox( m_ptP5, m_ptPos))
|
||||
return false ;
|
||||
|
||||
// assegnazione del testo
|
||||
// assegnazione del testo
|
||||
m_sText = sText ;
|
||||
// assegno il tipo
|
||||
// assegno il tipo
|
||||
m_nType = DT_DIAMETRAL ;
|
||||
// imposto da calcolare
|
||||
// imposto da calcolare
|
||||
m_bToCalc = true ;
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -210,7 +200,7 @@ ExtDimension::SetDiametral( const Point3d& ptCen, const Point3d& ptPos,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExtDimension::SetAngular( const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptV, const Point3d& ptPos,
|
||||
ExtDimension::SetAngular( const Point3d& ptP1, const Point3d& ptV, const Point3d& ptP2, const Point3d& ptPos,
|
||||
const Vector3d& vtN, const string& sText)
|
||||
{
|
||||
// dichiaro quota non ancora determinata
|
||||
@@ -222,32 +212,25 @@ ExtDimension::SetAngular( const Point3d& ptP1, const Point3d& ptP2, const Point3
|
||||
// porto i punti nel piano definito da P1 e N
|
||||
m_ptP1 = ptP1 ;
|
||||
m_ptP2 = ptP2 - ( ptP2 - m_ptP1) * m_vtN * m_vtN ;
|
||||
m_ptP5 = ptV - ( ptV - m_ptP1) * m_vtN * m_vtN ;
|
||||
m_ptP6 = ptV - ( ptV - m_ptP1) * m_vtN * m_vtN ;
|
||||
m_ptPos = ptPos - ( ptPos - m_ptP1) * m_vtN * m_vtN ;
|
||||
// verifico che i punti di misura non siano coincidenti
|
||||
if ( AreSamePointApprox( m_ptP1, m_ptP2) || AreSamePointApprox( m_ptP1, m_ptP5) || AreSamePointApprox( m_ptP2, m_ptP5))
|
||||
if ( AreSamePointApprox( m_ptP1, m_ptP2) || AreSamePointApprox( m_ptP1, m_ptP6) || AreSamePointApprox( m_ptP2, m_ptP5))
|
||||
return false ;
|
||||
// calcolo le direzioni su cui giacciono i due lati dell'angolo
|
||||
Vector3d vtLine1 = m_ptP1 - m_ptP5 ;
|
||||
Vector3d vtLine2 = m_ptP2 - m_ptP5 ;
|
||||
double dLen1 = vtLine1.Len() ;
|
||||
double dLen2 = vtLine2.Len() ;
|
||||
if ( ! vtLine1.Normalize() || ! vtLine2.Normalize())
|
||||
return false ;
|
||||
// direzione di riferimento (nel piano perpendicolare a vtN)
|
||||
m_vtDir = m_ptPos - m_ptP5 ;
|
||||
// direzione di riferimento ( nel piano perpendicolare a vtN)
|
||||
m_vtDir = m_ptPos - m_ptP6 ;
|
||||
double dLenDir = m_vtDir.Len() ;
|
||||
|
||||
|
||||
// controllo se è testo o se è la misura
|
||||
double dHalfDist ;
|
||||
double dFactor ;
|
||||
if ( m_sCalcText.find( IS_MEASURE) != string::npos) {
|
||||
dHalfDist = GetTextHalfDist( m_ptPos) ;
|
||||
m_sCalcText = "300.00" ;
|
||||
double dHalfDist = GetTextHalfDist( m_ptPos) ;
|
||||
dFactor = 2.5 * dHalfDist ;
|
||||
m_sCalcText = "" ;
|
||||
}
|
||||
else {
|
||||
dHalfDist = GetTextHalfDist( m_ptPos) ;
|
||||
double dHalfDist = GetTextHalfDist( m_ptPos) ;
|
||||
dFactor = 2.5 * dHalfDist ;
|
||||
}
|
||||
// allungo m_vtDir se è troppo vicino al centro
|
||||
@@ -255,24 +238,26 @@ ExtDimension::SetAngular( const Point3d& ptP1, const Point3d& ptP2, const Point3
|
||||
Vector3d vtDir_n = m_vtDir ;
|
||||
if ( ! vtDir_n.Normalize())
|
||||
return false ;
|
||||
m_ptPos = m_ptP5 + dFactor * vtDir_n ;
|
||||
m_ptPos = m_ptP6 + dFactor * vtDir_n ;
|
||||
// ricalcolo m_vtDir
|
||||
m_vtDir = m_ptPos - m_ptP5 ;
|
||||
m_vtDir = m_ptPos - m_ptP6 ;
|
||||
dLenDir = m_vtDir.Len() ;
|
||||
}
|
||||
|
||||
// calcolo le direzioni su cui giacciono i due lati dell'angolo
|
||||
Vector3d vtLine1 = m_ptP1 - m_ptP6 ;
|
||||
Vector3d vtLine2 = m_ptP2 - m_ptP6 ;
|
||||
double dLen1 = vtLine1.Len() ;
|
||||
double dLen2 = vtLine2.Len() ;
|
||||
if ( ! vtLine1.Normalize() || ! vtLine2.Normalize())
|
||||
return false ;
|
||||
// segnalo se i punti che definiscono i lati sono più lontani dal centro di ptPos
|
||||
bool bPt1Close = false ;
|
||||
bool bPt2Close = false ;
|
||||
if ( dLenDir < dLen1)
|
||||
bPt1Close = true ;
|
||||
if ( dLenDir < dLen2)
|
||||
bPt2Close = true ;
|
||||
bool bPt1Close = ( dLenDir < dLen1 ? true : false) ;
|
||||
bool bPt2Close = ( dLenDir < dLen2 ? true : false) ;
|
||||
m_ptP5 = m_ptP1 + ( dLenDir - dLen1) * vtLine1 ;
|
||||
m_ptP6 = m_ptP2 + ( dLenDir - dLen2) * vtLine2 ;
|
||||
Point3d ptP5_bis = m_ptP2 + ( dLenDir - dLen2) * vtLine2 ;
|
||||
m_ptP3 = m_ptP5 + ( bPt1Close ? - vtLine1 : vtLine1) * m_dExtLineLen ;
|
||||
m_ptP4 = m_ptP6 + ( bPt2Close ? - vtLine2 : vtLine2) * m_dExtLineLen ;
|
||||
|
||||
m_ptP4 = ptP5_bis + ( bPt2Close ? - vtLine2 : vtLine2) * m_dExtLineLen ;
|
||||
|
||||
// assegnazione del testo
|
||||
m_sText = sText ;
|
||||
// assegno il tipo
|
||||
@@ -332,6 +317,7 @@ ExtDimension::CopyFrom( const ExtDimension& clSrc)
|
||||
m_sCalcText = clSrc.m_sCalcText ;
|
||||
m_ptCalcPos = clSrc.m_ptCalcPos ;
|
||||
m_bCalcArrowIn = clSrc.m_bCalcArrowIn ;
|
||||
m_bCalcTextOn = clSrc.m_bCalcTextOn ;
|
||||
m_ptCalcP7 = clSrc.m_ptCalcP7 ;
|
||||
m_ptCalcP8 = clSrc.m_ptCalcP8 ;
|
||||
m_dExtLineLen = clSrc.m_dExtLineLen ;
|
||||
@@ -380,15 +366,15 @@ ExtDimension::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
||||
{
|
||||
// parametri
|
||||
sOut += GetSubType() + szNewLine ;
|
||||
sOut += "VN(" + ToString( m_vtN, 3) + ") " + szNewLine ;
|
||||
sOut += "VD(" + ToString( m_vtDir, 3) + ") " + szNewLine ;
|
||||
sOut += "P1(" + ToString( GetInUiUnits( m_ptP1, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "P2(" + ToString( GetInUiUnits( m_ptP2, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "P3(" + ToString( GetInUiUnits( m_ptP3, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "P4(" + ToString( GetInUiUnits( m_ptP4, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "P5(" + ToString( GetInUiUnits( m_ptP5, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "P6(" + ToString( GetInUiUnits( m_ptP6, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "Pos(" + ToString( GetInUiUnits( m_ptPos, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "VN( " + ToString( m_vtN, 3) + ") " + szNewLine ;
|
||||
sOut += "VD( " + ToString( m_vtDir, 3) + ") " + szNewLine ;
|
||||
sOut += "P1( " + ToString( GetInUiUnits( m_ptP1, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "P2( " + ToString( GetInUiUnits( m_ptP2, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "P3( " + ToString( GetInUiUnits( m_ptP3, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "P4( " + ToString( GetInUiUnits( m_ptP4, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "P5( " + ToString( GetInUiUnits( m_ptP5, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "P6( " + ToString( GetInUiUnits( m_ptP6, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "Pos( " + ToString( GetInUiUnits( m_ptPos, bMM), 3) + ") " + szNewLine ;
|
||||
sOut += "Txt=" + m_sText + szNewLine ;
|
||||
sOut += "El=" + ToString( GetInUiUnits( m_dExtLineLen, bMM), 3) +
|
||||
" Al=" + ToString( GetInUiUnits( m_dArrowLen, bMM), 3) +
|
||||
@@ -529,7 +515,7 @@ ExtDimension::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
|
||||
return true ;
|
||||
}
|
||||
else if ( m_nType == DT_RADIAL) {
|
||||
b3Loc.Set( m_ptP5) ;
|
||||
b3Loc.Set( m_ptP6) ;
|
||||
b3Loc.Add( m_ptPos) ;
|
||||
// ingombro del testo
|
||||
BBox3d b3Text ;
|
||||
@@ -538,7 +524,7 @@ ExtDimension::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
|
||||
return true ;
|
||||
}
|
||||
else if ( m_nType == DT_DIAMETRAL) {
|
||||
b3Loc.Set( m_ptP5) ;
|
||||
b3Loc.Set( m_ptP6) ;
|
||||
b3Loc.Add( m_ptPos) ;
|
||||
// ingombro del testo
|
||||
BBox3d b3Text ;
|
||||
@@ -552,6 +538,7 @@ ExtDimension::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
|
||||
b3Loc.Add( m_ptP3) ;
|
||||
b3Loc.Add( m_ptP4) ;
|
||||
b3Loc.Set( m_ptP5) ;
|
||||
b3Loc.Set( m_ptP6) ;
|
||||
b3Loc.Add( m_ptCalcP7) ;
|
||||
b3Loc.Add( m_ptCalcP8) ;
|
||||
// ingombro del testo
|
||||
@@ -575,7 +562,7 @@ ExtDimension::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
Update() ;
|
||||
// se valido
|
||||
if ( m_nType == DT_LINEAR) {
|
||||
// ingombro dei punti (portati nel riferimento passato)
|
||||
// ingombro dei punti ( portati nel riferimento passato)
|
||||
Point3d ptFrP1 = m_ptP1 ;
|
||||
ptFrP1.ToGlob( frRef) ;
|
||||
b3Ref.Set( ptFrP1) ;
|
||||
@@ -601,8 +588,8 @@ ExtDimension::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
return true ;
|
||||
}
|
||||
else if ( m_nType == DT_RADIAL) {
|
||||
// ingombro dei punti (portati nel riferimento passato)
|
||||
Point3d ptFrP5 = m_ptP5 ;
|
||||
// ingombro dei punti ( portati nel riferimento passato)
|
||||
Point3d ptFrP5 = m_ptP6 ;
|
||||
ptFrP5.ToGlob( frRef) ;
|
||||
b3Ref.Set( ptFrP5) ;
|
||||
Point3d ptFrPos = m_ptPos ;
|
||||
@@ -615,8 +602,8 @@ ExtDimension::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
return true ;
|
||||
}
|
||||
else if ( m_nType == DT_DIAMETRAL) {
|
||||
// ingombro dei punti (portati nel riferimento passato)
|
||||
Point3d ptFrP5 = m_ptP5 ;
|
||||
// ingombro dei punti ( portati nel riferimento passato)
|
||||
Point3d ptFrP5 = m_ptP6 ;
|
||||
ptFrP5.ToGlob( frRef) ;
|
||||
b3Ref.Set( ptFrP5) ;
|
||||
Point3d ptFrPos = m_ptPos ;
|
||||
@@ -629,9 +616,6 @@ ExtDimension::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
return true ;
|
||||
}
|
||||
else if ( m_nType == DT_ANGULAR) {
|
||||
Point3d ptFrP5 = m_ptP5 ;
|
||||
ptFrP5.ToGlob( frRef) ;
|
||||
b3Ref.Set( ptFrP5) ;
|
||||
Point3d ptFrP1 = m_ptP1 ;
|
||||
ptFrP1.ToGlob( frRef) ;
|
||||
b3Ref.Add( ptFrP1) ;
|
||||
@@ -644,6 +628,12 @@ ExtDimension::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
Point3d ptFrP4 = m_ptP4 ;
|
||||
ptFrP4.ToGlob( frRef) ;
|
||||
b3Ref.Add( ptFrP4) ;
|
||||
Point3d ptFrP5 = m_ptP5 ;
|
||||
ptFrP5.ToGlob( frRef) ;
|
||||
b3Ref.Set( ptFrP5) ;
|
||||
Point3d ptFrP6 = m_ptP6 ;
|
||||
ptFrP6.ToGlob( frRef) ;
|
||||
b3Ref.Set( ptFrP6) ;
|
||||
Point3d ptFrP7 = m_ptCalcP7 ;
|
||||
ptFrP7.ToGlob( frRef) ;
|
||||
b3Ref.Add( ptFrP7) ;
|
||||
@@ -698,14 +688,14 @@ ExtDimension::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng,
|
||||
// se valido
|
||||
if ( m_nType >= DT_LINEAR && m_nType <= DT_ANGULAR) {
|
||||
return ( m_vtN.Rotate( vtAx, dCosAng, dSinAng) &&
|
||||
m_vtDir.Rotate( vtAx, dCosAng, dSinAng) &&
|
||||
m_ptP1.Rotate( ptAx, vtAx, dCosAng, dSinAng) &&
|
||||
m_ptP2.Rotate( ptAx, vtAx, dCosAng, dSinAng) &&
|
||||
m_ptP3.Rotate( ptAx, vtAx, dCosAng, dSinAng) &&
|
||||
m_ptP4.Rotate( ptAx, vtAx, dCosAng, dSinAng) &&
|
||||
m_ptP5.Rotate( ptAx, vtAx, dCosAng, dSinAng) &&
|
||||
m_ptP6.Rotate( ptAx, vtAx, dCosAng, dSinAng) &&
|
||||
m_ptPos.Rotate( ptAx, vtAx, dCosAng, dSinAng)) ;
|
||||
m_vtDir.Rotate( vtAx, dCosAng, dSinAng) &&
|
||||
m_ptP1.Rotate( ptAx, vtAx, dCosAng, dSinAng) &&
|
||||
m_ptP2.Rotate( ptAx, vtAx, dCosAng, dSinAng) &&
|
||||
m_ptP3.Rotate( ptAx, vtAx, dCosAng, dSinAng) &&
|
||||
m_ptP4.Rotate( ptAx, vtAx, dCosAng, dSinAng) &&
|
||||
m_ptP5.Rotate( ptAx, vtAx, dCosAng, dSinAng) &&
|
||||
m_ptP6.Rotate( ptAx, vtAx, dCosAng, dSinAng) &&
|
||||
m_ptPos.Rotate( ptAx, vtAx, dCosAng, dSinAng)) ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
@@ -739,6 +729,8 @@ ExtDimension::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, doubl
|
||||
return false ;
|
||||
if ( ! m_ptP2.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ))
|
||||
return false ;
|
||||
if ( ! m_ptP6.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ))
|
||||
return false ;
|
||||
if ( ! m_ptPos.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ))
|
||||
return false ;
|
||||
// ricalcolo completamente la quota
|
||||
@@ -746,11 +738,11 @@ ExtDimension::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, doubl
|
||||
case DT_LINEAR :
|
||||
return SetLinear( m_ptP1, m_ptP2, m_ptPos, m_vtN, m_vtDir, m_sText) ;
|
||||
case DT_RADIAL :
|
||||
return SetRadial( m_ptP5, m_ptPos, m_vtN, m_sText) ;
|
||||
return SetRadial( m_ptP6, m_ptPos, m_vtN, m_sText) ;
|
||||
case DT_DIAMETRAL :
|
||||
return SetDiametral( m_ptP5, m_ptPos, m_vtN, m_sText) ;
|
||||
return SetDiametral( m_ptP6, m_ptPos, m_vtN, m_sText) ;
|
||||
case DT_ANGULAR :
|
||||
return SetAngular( m_ptP5, m_ptP1, m_ptP2, m_ptPos, m_vtN, m_sText) ;
|
||||
return SetAngular( m_ptP1, m_ptP6, m_ptP2, m_ptPos, m_vtN, m_sText) ;
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
@@ -773,12 +765,12 @@ ExtDimension::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
|
||||
// se valido
|
||||
if ( m_nType >= DT_LINEAR && m_nType <= DT_ANGULAR) {
|
||||
// eseguo il mirror dei versori
|
||||
// eseguo il mirror dei versori
|
||||
if ( ! m_vtN.Mirror( vtNorm))
|
||||
return false ;
|
||||
if ( ! m_vtDir.Mirror( vtNorm))
|
||||
return false ;
|
||||
// eseguo il mirror dei punti
|
||||
// eseguo il mirror dei punti
|
||||
if ( ! m_ptP1.Mirror( ptOn, vtNorm))
|
||||
return false ;
|
||||
if ( ! m_ptP2.Mirror( ptOn, vtNorm))
|
||||
@@ -827,6 +819,8 @@ ExtDimension::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d
|
||||
return false ;
|
||||
if ( ! m_ptP2.Shear( ptOn, vtNorm, vtDir, dCoeff))
|
||||
return false ;
|
||||
if ( ! m_ptP6.Shear( ptOn, vtNorm, vtDir, dCoeff))
|
||||
return false ;
|
||||
if ( ! m_ptPos.Shear( ptOn, vtNorm, vtDir, dCoeff))
|
||||
return false ;
|
||||
// ricalcolo completamente la quota
|
||||
@@ -834,11 +828,11 @@ ExtDimension::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d
|
||||
case DT_LINEAR :
|
||||
return SetLinear( m_ptP1, m_ptP2, m_ptPos, m_vtN, m_vtDir, m_sText) ;
|
||||
case DT_RADIAL :
|
||||
return SetRadial( m_ptP5, m_ptPos, m_vtN, m_sText) ;
|
||||
return SetRadial( m_ptP6, m_ptPos, m_vtN, m_sText) ;
|
||||
case DT_DIAMETRAL :
|
||||
return SetDiametral( m_ptP5, m_ptPos, m_vtN, m_sText) ;
|
||||
return SetDiametral( m_ptP6, m_ptPos, m_vtN, m_sText) ;
|
||||
case DT_ANGULAR :
|
||||
return SetAngular( m_ptP5, m_ptP1, m_ptP2, m_ptPos, m_vtN, m_sText) ;
|
||||
return SetAngular( m_ptP1, m_ptP6, m_ptP2, m_ptPos, m_vtN, m_sText) ;
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
@@ -865,16 +859,16 @@ ExtDimension::ToGlob( const Frame3d& frRef)
|
||||
|
||||
// se valido
|
||||
if ( m_nType >= DT_LINEAR && m_nType <= DT_ANGULAR) {
|
||||
// trasformo punto e versori
|
||||
// trasformo punto e versori
|
||||
return ( m_vtN.ToGlob( frRef) &&
|
||||
m_vtDir.ToGlob( frRef) &&
|
||||
m_ptP1.ToGlob( frRef) &&
|
||||
m_ptP2.ToGlob( frRef) &&
|
||||
m_ptP3.ToGlob( frRef) &&
|
||||
m_ptP4.ToGlob( frRef) &&
|
||||
m_ptP5.ToGlob( frRef) &&
|
||||
m_ptP6.ToGlob( frRef) &&
|
||||
m_ptPos.ToGlob( frRef)) ;
|
||||
m_vtDir.ToGlob( frRef) &&
|
||||
m_ptP1.ToGlob( frRef) &&
|
||||
m_ptP2.ToGlob( frRef) &&
|
||||
m_ptP3.ToGlob( frRef) &&
|
||||
m_ptP4.ToGlob( frRef) &&
|
||||
m_ptP5.ToGlob( frRef) &&
|
||||
m_ptP6.ToGlob( frRef) &&
|
||||
m_ptPos.ToGlob( frRef)) ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
@@ -898,16 +892,16 @@ ExtDimension::ToLoc( const Frame3d& frRef)
|
||||
|
||||
// se valido
|
||||
if ( m_nType >= DT_LINEAR && m_nType <= DT_ANGULAR) {
|
||||
// trasformo punto e versori
|
||||
// trasformo punto e versori
|
||||
return ( m_vtN.ToLoc( frRef) &&
|
||||
m_vtDir.ToLoc( frRef) &&
|
||||
m_ptP1.ToLoc( frRef) &&
|
||||
m_ptP2.ToLoc( frRef) &&
|
||||
m_ptP3.ToLoc( frRef) &&
|
||||
m_ptP4.ToLoc( frRef) &&
|
||||
m_ptP5.ToLoc( frRef) &&
|
||||
m_ptP6.ToLoc( frRef) &&
|
||||
m_ptPos.ToLoc( frRef)) ;
|
||||
m_vtDir.ToLoc( frRef) &&
|
||||
m_ptP1.ToLoc( frRef) &&
|
||||
m_ptP2.ToLoc( frRef) &&
|
||||
m_ptP3.ToLoc( frRef) &&
|
||||
m_ptP4.ToLoc( frRef) &&
|
||||
m_ptP5.ToLoc( frRef) &&
|
||||
m_ptP6.ToLoc( frRef) &&
|
||||
m_ptPos.ToLoc( frRef)) ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
@@ -933,14 +927,14 @@ ExtDimension::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
if ( m_nType >= DT_LINEAR && m_nType <= DT_ANGULAR) {
|
||||
// trasformo punto e versori
|
||||
return ( m_vtN.ToGlob( frOri) && m_vtN.ToLoc( frDest) &&
|
||||
m_vtDir.ToGlob( frOri) && m_vtDir.ToLoc( frDest) &&
|
||||
m_ptP1.ToGlob( frOri) && m_ptP1.ToLoc( frDest) &&
|
||||
m_ptP2.ToGlob( frOri) && m_ptP2.ToLoc( frDest) &&
|
||||
m_ptP3.ToGlob( frOri) && m_ptP3.ToLoc( frDest) &&
|
||||
m_ptP4.ToGlob( frOri) && m_ptP4.ToLoc( frDest) &&
|
||||
m_ptP5.ToGlob( frOri) && m_ptP5.ToLoc( frDest) &&
|
||||
m_ptP6.ToGlob( frOri) && m_ptP6.ToLoc( frDest) &&
|
||||
m_ptPos.ToGlob( frOri) && m_ptPos.ToLoc( frDest)) ;
|
||||
m_vtDir.ToGlob( frOri) && m_vtDir.ToLoc( frDest) &&
|
||||
m_ptP1.ToGlob( frOri) && m_ptP1.ToLoc( frDest) &&
|
||||
m_ptP2.ToGlob( frOri) && m_ptP2.ToLoc( frDest) &&
|
||||
m_ptP3.ToGlob( frOri) && m_ptP3.ToLoc( frDest) &&
|
||||
m_ptP4.ToGlob( frOri) && m_ptP4.ToLoc( frDest) &&
|
||||
m_ptP5.ToGlob( frOri) && m_ptP5.ToLoc( frDest) &&
|
||||
m_ptP6.ToGlob( frOri) && m_ptP6.ToLoc( frDest) &&
|
||||
m_ptPos.ToGlob( frOri) && m_ptPos.ToLoc( frDest)) ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
@@ -993,7 +987,7 @@ ExtDimension::Update( void) const
|
||||
else
|
||||
m_ptCalcPos = m_ptCalcP8 + m_vtDir * dHalfDist ;
|
||||
}
|
||||
// dichiaro ricalcolo eseguito
|
||||
// dichiaro ricalcolo eseguito
|
||||
m_bToCalc = false ;
|
||||
return true ;
|
||||
}
|
||||
@@ -1012,21 +1006,27 @@ ExtDimension::Update( void) const
|
||||
ReplaceString( m_sCalcText, IS_MEASURE, sVal) ;
|
||||
}
|
||||
// punto di inserimento del testo
|
||||
m_ptCalcPos = ( m_ptP5 + m_ptP6) / 2 ;
|
||||
m_ptCalcPos = ( m_ptP5 + m_ptP2) / 2 ;
|
||||
// alzo il testo dalla linea di misura
|
||||
BBox3d b3Text ;
|
||||
if ( ! GetTextMyBBox( b3Text) && ! b3Text.IsEmpty())
|
||||
return false ;
|
||||
double dHeight = b3Text.GetMax().y - b3Text.GetMin().y ;
|
||||
Vector3d vtPerpDir = m_ptPos - m_ptP5 ;
|
||||
vtPerpDir.Normalize() ;
|
||||
if ( ! vtPerpDir.Rotate( m_vtN, 90))
|
||||
Vector3d vtPerpDir = m_ptPos - m_ptP6 ;
|
||||
if ( ! vtPerpDir.Normalize())
|
||||
return false ;
|
||||
// calcolo il frame dell'arco per valutare la posizione del testo
|
||||
Frame3d frRef ;
|
||||
if ( ! frRef.Set( m_ptP6, m_vtN))
|
||||
return false ;
|
||||
double dAngDeg = 0 ;
|
||||
if ( ! m_vtDir.GetAngle( frRef.VersX(), dAngDeg) || ! vtPerpDir.Rotate( m_vtN, ( dAngDeg < 90 ? 90 : -90)))
|
||||
return false ;
|
||||
m_ptCalcPos = m_ptCalcPos + 0.6 * dHeight * vtPerpDir ;
|
||||
// semidistanza di interruzione
|
||||
double dHalfDist = GetTextHalfDist( m_ptCalcPos) ;
|
||||
// lunghezza della linea di misura
|
||||
double dLen = ( m_ptP6 - m_ptP5).Len() ;
|
||||
double dLen = Dist( m_ptP1, m_ptP2) ;
|
||||
// determino come orientare le frecce e dove mettere il testo
|
||||
if ( dLen - 2 * m_dArrowLen >= 2 * dHalfDist) {
|
||||
m_bCalcArrowIn = true ;
|
||||
@@ -1039,7 +1039,7 @@ ExtDimension::Update( void) const
|
||||
m_bCalcArrowIn = false ;
|
||||
m_bCalcTextOn = true ;
|
||||
m_ptCalcP7 = m_ptP5 - m_vtDir * 2 * m_dArrowLen ;
|
||||
m_ptCalcP8 = m_ptP6 + m_vtDir * 2 * m_dArrowLen ;
|
||||
m_ptCalcP8 = m_ptP2 + m_vtDir * 2 * m_dArrowLen ;
|
||||
}
|
||||
// stanno fuori sia le frecce sia il testo
|
||||
else {
|
||||
@@ -1047,7 +1047,8 @@ ExtDimension::Update( void) const
|
||||
m_bCalcTextOn = false ;
|
||||
// metto la quotatura dal lato di ptPos
|
||||
Vector3d vtRad = m_ptPos - m_ptP5 ;
|
||||
vtRad.Normalize() ;
|
||||
if ( ! vtRad.Normalize())
|
||||
return false ;
|
||||
m_ptCalcPos = m_ptPos + vtRad * ( dHalfDist + 2 * m_dArrowLen) ;
|
||||
}
|
||||
// dichiaro ricalcolo eseguito
|
||||
@@ -1057,9 +1058,11 @@ ExtDimension::Update( void) const
|
||||
case DT_ANGULAR : {
|
||||
// angolo
|
||||
double dAngDeg, dAngDeg1, dAngDeg2 = 0 ;
|
||||
Vector3d vtLine1 = m_ptP1 - m_ptP5 ;
|
||||
Vector3d vtLine2 = m_ptP2 - m_ptP5 ;
|
||||
Vector3d vtLine3 = m_ptPos - m_ptP5 ;
|
||||
Vector3d vtLine1 = m_ptP1 - m_ptP6 ;
|
||||
Vector3d vtLine2 = m_ptP2 - m_ptP6 ;
|
||||
Vector3d vtLine3 = m_ptPos - m_ptP6 ;
|
||||
// calcolo gli angoli tra m_ptPos e i due punti che identificano i lati dell'angolo
|
||||
// per capire se sto calcolando l'angolo interno o esterno
|
||||
if ( ! vtLine1.GetAngle( vtLine2, dAngDeg) || ! vtLine1.GetAngle( vtLine3, dAngDeg1) || ! vtLine2.GetAngle( vtLine3, dAngDeg2))
|
||||
return false ;
|
||||
if ( dAngDeg < dAngDeg1 + dAngDeg2 - EPS_SMALL || dAngDeg > dAngDeg1 + dAngDeg2 + EPS_SMALL)
|
||||
@@ -1067,14 +1070,17 @@ ExtDimension::Update( void) const
|
||||
// testo
|
||||
m_sCalcText = m_sText ;
|
||||
if ( m_sCalcText.find( IS_MEASURE) != string::npos) {
|
||||
// calcolo gli angoli tra m_ptPos e i due punti che identificano i lati dell'angolo
|
||||
// per capire se sto calcolando l'angolo interno o esterno
|
||||
string sAngDeg = ToString( dAngDeg, m_nDecDigit) ;
|
||||
ReplaceString( m_sCalcText, IS_MEASURE, sAngDeg + "°") ;
|
||||
}
|
||||
// calcolo ptP5_bis
|
||||
double dLen2 = vtLine2.Len() ;
|
||||
if ( ! vtLine2.Normalize())
|
||||
return false ;
|
||||
Point3d ptP5_bis = m_ptP2 + ( m_vtDir.Len() - dLen2) * vtLine2 ;
|
||||
// calcolo l'arco su cui metterò la misura
|
||||
PtrOwner<CurveArc> pCrvPos( CreateBasicCurveArc()) ;
|
||||
if ( IsNull( pCrvPos) || ! pCrvPos->Set3P( m_ptP6, m_ptPos, m_ptP5, false))
|
||||
if ( IsNull( pCrvPos) || ! pCrvPos->Set3P( ptP5_bis, m_ptPos, m_ptP5, false))
|
||||
return false ;
|
||||
// punto di inserimento del testo
|
||||
pCrvPos->GetMidPoint( m_ptCalcPos) ;
|
||||
@@ -1085,15 +1091,14 @@ ExtDimension::Update( void) const
|
||||
if ( ! pCrvPos->GetLength( dLen))
|
||||
return false ;
|
||||
// calcolo anche lo spazio ad una distanza dal centro maggiorata
|
||||
double dLenPos = 0 ;
|
||||
double dDist = Dist( m_ptCalcPos, m_ptP5) ;
|
||||
dLenPos = dDist * dAngDeg * DEGTORAD ;
|
||||
// determino come orientare le frecce e dove mettere il testo
|
||||
double dU ;
|
||||
double dDist = Dist( m_ptCalcPos, m_ptP6) ;
|
||||
double dLenPos = dDist * dAngDeg * DEGTORAD ;
|
||||
// determino come orientare le frecce e dove mettere il testo
|
||||
// frecce e testo dentro
|
||||
if ( dLen - 2 * m_dArrowLen >= 2 * dHalfDist) {
|
||||
m_bCalcArrowIn = true ;
|
||||
m_bCalcTextOn = true ;
|
||||
double dU ;
|
||||
pCrvPos->GetParamAtLength( dLen / 2. + dHalfDist, dU) ;
|
||||
pCrvPos->GetPointD1D2( dU, ICurve::FROM_MINUS, m_ptCalcP7) ;
|
||||
pCrvPos->GetParamAtLength( dLen / 2. - dHalfDist, dU) ;
|
||||
@@ -1104,12 +1109,11 @@ ExtDimension::Update( void) const
|
||||
else if ( dLen > 2 * dHalfDist || ( dLen < 2 * dHalfDist && dLenPos > 2 * dHalfDist)) {
|
||||
m_bCalcArrowIn = false ;
|
||||
m_bCalcTextOn = true ;
|
||||
double dU ;
|
||||
pCrvPos->GetParamAtLength( dLen / 2. + dHalfDist, dU) ;
|
||||
pCrvPos->GetPointD1D2( dU, ICurve::FROM_MINUS, m_ptCalcP7) ;
|
||||
pCrvPos->GetParamAtLength( dLen / 2. - dHalfDist, dU) ;
|
||||
pCrvPos->GetPointD1D2( dU, ICurve::FROM_MINUS, m_ptCalcP8) ;
|
||||
//pCrvPosExt->GetStartPoint( m_ptCalcP8) ;
|
||||
//pCrvPosExt->GetEndPoint( m_ptCalcP7) ;
|
||||
if ( dLen < 2 * dHalfDist) {
|
||||
m_ptCalcPos += ( m_ptCalcPos - m_ptP5) ;
|
||||
m_bCalcTextOn = false ;
|
||||
@@ -1119,11 +1123,9 @@ ExtDimension::Update( void) const
|
||||
else {
|
||||
m_bCalcArrowIn = false ;
|
||||
m_bCalcTextOn = false ;
|
||||
//pCrvPosExt->GetStartPoint( m_ptCalcP8) ;
|
||||
//pCrvPosExt->GetEndPoint( m_ptCalcP7) ;
|
||||
vtLine1.Normalize() ;
|
||||
vtLine2.Normalize() ;
|
||||
if ( Dist( m_ptPos, m_ptP5) < Dist( m_ptPos, m_ptP6)) {
|
||||
if ( Dist( m_ptPos, m_ptP5) < Dist( m_ptPos, ptP5_bis)) {
|
||||
Vector3d vtDirEnd ;
|
||||
pCrvPos->GetEndDir( vtDirEnd) ;
|
||||
m_ptCalcPos = m_ptP5 + dHalfDist * ( vtDirEnd + vtLine1) ;
|
||||
@@ -1131,7 +1133,7 @@ ExtDimension::Update( void) const
|
||||
else {
|
||||
Vector3d vtDirStart ;
|
||||
pCrvPos->GetStartDir( vtDirStart) ;
|
||||
m_ptCalcPos = m_ptP6 + dHalfDist * ( - vtDirStart + vtLine2) ;
|
||||
m_ptCalcPos = ptP5_bis + dHalfDist * ( - vtDirStart + vtLine2) ;
|
||||
}
|
||||
}
|
||||
// dichiaro ricalcolo eseguito
|
||||
@@ -1156,12 +1158,18 @@ ExtDimension::GetMidPoint( Point3d& ptMid) const
|
||||
ptMid = ( m_ptP1 + m_ptP2) / 2;
|
||||
return true ;
|
||||
case DT_ANGULAR :
|
||||
{ PtrOwner<CurveArc> pCrvPos( CreateBasicCurveArc()) ;
|
||||
if ( ! pCrvPos->Set3P( m_ptP6, m_ptPos, m_ptP5, false))
|
||||
return false ;
|
||||
pCrvPos->GetMidPoint( ptMid) ;
|
||||
return true ;
|
||||
}
|
||||
{ // calcolo ptP5_bis
|
||||
Vector3d vtLine2 = m_ptP2 - m_ptP6 ;
|
||||
double dLen2 = vtLine2.Len() ;
|
||||
if ( ! vtLine2.Normalize())
|
||||
return false ;
|
||||
Point3d ptP5_bis = m_ptP2 + ( m_vtDir.Len() - dLen2) * vtLine2 ;
|
||||
Vector3d vtMid = ( ptP5_bis + m_ptP5) / 2 - m_ptP6 ;
|
||||
if ( ! vtMid.Normalize())
|
||||
return false ;
|
||||
ptMid = m_ptP6 + vtMid * m_vtDir.Len() ;
|
||||
return true;
|
||||
}
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
@@ -1181,7 +1189,7 @@ ExtDimension::GetCenterPoint( Point3d& ptCen) const
|
||||
case DT_RADIAL :
|
||||
case DT_DIAMETRAL :
|
||||
case DT_ANGULAR :
|
||||
ptCen = m_ptP5 ;
|
||||
ptCen = m_ptP6 ;
|
||||
return true ;
|
||||
default :
|
||||
return false ;
|
||||
@@ -1196,153 +1204,154 @@ ExtDimension::ApproxWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST&
|
||||
Update() ;
|
||||
// se quota valida
|
||||
switch ( m_nType) {
|
||||
case DT_LINEAR : {
|
||||
// prima linea di riferimento
|
||||
case DT_LINEAR : {
|
||||
// prima linea di riferimento
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint( 0, m_ptP1) ;
|
||||
lstPL.back().AddUPoint( 1, m_ptP3) ;
|
||||
// seconda linea di riferimento
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint( 0, m_ptP2) ;
|
||||
lstPL.back().AddUPoint( 1, m_ptP4) ;
|
||||
// se non c'è testo, linea di misura intera
|
||||
if ( IsEmptyOrSpaces( m_sCalcText)) {
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint(0, m_ptP1) ;
|
||||
lstPL.back().AddUPoint(1, m_ptP3) ;
|
||||
// seconda linea di riferimento
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint(0, m_ptP2) ;
|
||||
lstPL.back().AddUPoint(1, m_ptP4) ;
|
||||
// se non c'è testo, linea di misura intera
|
||||
if ( IsEmptyOrSpaces(m_sCalcText)) {
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint(0, m_ptP5) ;
|
||||
lstPL.back().AddUPoint(1, m_ptP6) ;
|
||||
}
|
||||
// altrimenti, linea di misura divisa in due parti
|
||||
else {
|
||||
// prima parte
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint(0, m_ptP5) ;
|
||||
lstPL.back().AddUPoint(1, m_ptCalcP7) ;
|
||||
// seconda parte
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint(0, m_ptP6) ;
|
||||
lstPL.back().AddUPoint(1, m_ptCalcP8) ;
|
||||
}
|
||||
// frecce
|
||||
lstPL.emplace_back() ;
|
||||
GetArrowHead(m_ptP5, ( m_bCalcArrowIn ? -m_vtDir : m_vtDir), lstPL.back()) ;
|
||||
lstPL.emplace_back() ;
|
||||
GetArrowHead(m_ptP6, ( m_bCalcArrowIn ? m_vtDir : -m_vtDir), lstPL.back()) ;
|
||||
// testo
|
||||
POLYLINELIST lstTxt;
|
||||
if ( ApproxTextWithLines(dLinTol, dAngTolDeg, lstTxt))
|
||||
lstPL.splice(lstPL.end(), lstTxt) ;
|
||||
return true ;
|
||||
lstPL.back().AddUPoint( 0, m_ptP5) ;
|
||||
lstPL.back().AddUPoint( 1, m_ptP6) ;
|
||||
}
|
||||
case DT_RADIAL :
|
||||
case DT_DIAMETRAL : {
|
||||
Vector3d vtRad = m_ptPos - m_ptP5 ;
|
||||
vtRad.Normalize() ;
|
||||
// prima linea di riferimento
|
||||
// altrimenti, linea di misura divisa in due parti
|
||||
else {
|
||||
// prima parte
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint(0, m_ptP1) ;
|
||||
lstPL.back().AddUPoint(1, m_ptP2) ;
|
||||
// freccia
|
||||
lstPL.back().AddUPoint( 0, m_ptP5) ;
|
||||
lstPL.back().AddUPoint( 1, m_ptCalcP7) ;
|
||||
// seconda parte
|
||||
lstPL.emplace_back() ;
|
||||
GetArrowHead(m_ptP6, ( m_bCalcArrowIn ? vtRad : - vtRad), lstPL.back()) ;
|
||||
Point3d ptArrowTail ;
|
||||
if ( ! m_bCalcArrowIn) {
|
||||
lstPL.emplace_back() ;
|
||||
ptArrowTail = m_ptP6 + vtRad * m_dArrowLen * 2 ;
|
||||
lstPL.back().AddUPoint(0, m_ptP6) ;
|
||||
lstPL.back().AddUPoint(1, ptArrowTail) ;
|
||||
}
|
||||
if ( m_nType == DT_DIAMETRAL) {
|
||||
lstPL.emplace_back() ;
|
||||
GetArrowHead(m_ptP5, ( m_bCalcArrowIn ? - vtRad : vtRad), lstPL.back()) ;
|
||||
if ( ! m_bCalcArrowIn) {
|
||||
lstPL.emplace_back() ;
|
||||
ptArrowTail = m_ptP5 - vtRad * m_dArrowLen * 2 ;
|
||||
lstPL.back().AddUPoint(0, m_ptP5) ;
|
||||
lstPL.back().AddUPoint(1, ptArrowTail) ;
|
||||
}
|
||||
}
|
||||
// testo
|
||||
POLYLINELIST lstTxt;
|
||||
if ( ApproxTextWithLines(dLinTol, dAngTolDeg, lstTxt))
|
||||
lstPL.splice(lstPL.end(), lstTxt) ;
|
||||
return true ;
|
||||
lstPL.back().AddUPoint( 0, m_ptP6) ;
|
||||
lstPL.back().AddUPoint( 1, m_ptCalcP8) ;
|
||||
}
|
||||
case DT_ANGULAR : {
|
||||
// approssimerò l'arco con una polyline
|
||||
PolyLine plApprox ;
|
||||
// cerca nel geom kernel delle tolleranze standard
|
||||
double dLinTol = 0.01 ;
|
||||
double dAngTolDeg = 0.01 ;
|
||||
// prima linea di riferimento
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint( 0, m_ptP1) ;
|
||||
lstPL.back().AddUPoint( 1, m_ptP3) ;
|
||||
// seconda linea di riferimento
|
||||
// frecce
|
||||
lstPL.emplace_back() ;
|
||||
GetArrowHead( m_ptP5, ( m_bCalcArrowIn ? -m_vtDir : m_vtDir), lstPL.back()) ;
|
||||
lstPL.emplace_back() ;
|
||||
GetArrowHead( m_ptP6, ( m_bCalcArrowIn ? m_vtDir : -m_vtDir), lstPL.back()) ;
|
||||
// testo
|
||||
POLYLINELIST lstTxt;
|
||||
if ( ApproxTextWithLines( dLinTol, dAngTolDeg, lstTxt))
|
||||
lstPL.splice( lstPL.end(), lstTxt) ;
|
||||
return true ;
|
||||
}
|
||||
case DT_RADIAL :
|
||||
case DT_DIAMETRAL : {
|
||||
// prima linea di riferimento
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint( 0, m_ptP1) ;
|
||||
lstPL.back().AddUPoint( 1, m_ptP2) ;
|
||||
// freccia
|
||||
lstPL.emplace_back() ;
|
||||
Vector3d vtRad = m_ptPos - m_ptP6 ;
|
||||
vtRad.Normalize() ;
|
||||
GetArrowHead( m_ptP2, ( m_bCalcArrowIn ? vtRad : - vtRad), lstPL.back()) ;
|
||||
if ( ! m_bCalcArrowIn) {
|
||||
lstPL.emplace_back() ;
|
||||
Point3d ptArrowTail = m_ptP2 + vtRad * m_dArrowLen * 2 ;
|
||||
lstPL.back().AddUPoint( 0, m_ptP2) ;
|
||||
lstPL.back().AddUPoint( 1, m_ptP4) ;
|
||||
// curva per l'arco
|
||||
PtrOwner<CurveArc> pCrvPos( CreateBasicCurveArc()) ;
|
||||
if ( IsNull( pCrvPos))
|
||||
return false ;
|
||||
//double dHalfDist = GetTextHalfDist( m_ptCalcPos) ;
|
||||
|
||||
// se non ho testo
|
||||
if ( IsEmptyOrSpaces( m_sCalcText)) {
|
||||
if ( ! pCrvPos->SetC2PN( m_ptP5, m_ptP6, m_ptP5, m_vtN) || ! pCrvPos->ApproxWithLines(dLinTol, dAngTolDeg, ICurve::APL_STD, plApprox))
|
||||
return false ;
|
||||
lstPL.emplace_back( plApprox) ;
|
||||
}
|
||||
// altrimenti, linea di misura divisa in due parti
|
||||
else {
|
||||
// prima parte
|
||||
if ( ! pCrvPos->SetC2PN( m_ptP5, m_ptP5, m_ptCalcP7, m_vtN) || ! pCrvPos->ApproxWithLines(dLinTol, dAngTolDeg, ICurve::APL_STD, plApprox))
|
||||
return false ;
|
||||
lstPL.emplace_back( plApprox) ;
|
||||
// seconda parte
|
||||
if ( ! pCrvPos->SetC2PN( m_ptP5, m_ptP6, m_ptCalcP8, m_vtN) || ! pCrvPos->ApproxWithLines(dLinTol, dAngTolDeg, ICurve::APL_STD, plApprox))
|
||||
return false ;
|
||||
lstPL.emplace_back( plApprox) ;
|
||||
}
|
||||
// frecce
|
||||
Vector3d vtStartDir ;
|
||||
Vector3d vtEndDir ;
|
||||
if ( ! pCrvPos->Set3P( m_ptP6, m_ptPos, m_ptP5, false))
|
||||
return false ;
|
||||
pCrvPos->GetStartDir( vtStartDir) ;
|
||||
pCrvPos->GetEndDir( vtEndDir) ;
|
||||
//storto la punta delle frecce su una direzione mediata tra l'arco e la perpendicolare al lato
|
||||
double dFactor = 1 / ( 0.6 * m_vtDir.Len()) ; // questo fattore dipende direttamente dalla distanza di m_ptPos dal centro e smorza lo scostamento
|
||||
Vector3d vtLine1 = m_ptP1 - m_ptP5 ;
|
||||
Vector3d vtLine2 = m_ptP2 - m_ptP5 ;
|
||||
vtLine1.Normalize() ;
|
||||
vtLine2.Normalize() ;
|
||||
// se però le frecce sono fuori non le storto e faccio le code dritte anziché curvilinee
|
||||
lstPL.back().AddUPoint( 1, ptArrowTail) ;
|
||||
}
|
||||
if ( m_nType == DT_DIAMETRAL) {
|
||||
lstPL.emplace_back() ;
|
||||
GetArrowHead( m_ptP5, ( m_bCalcArrowIn ? - vtRad : vtRad), lstPL.back()) ;
|
||||
if ( ! m_bCalcArrowIn) {
|
||||
Point3d ptArrowTail1, ptArrowTail2 ;
|
||||
ptArrowTail1 = m_ptP5 + vtEndDir * m_dArrowLen *2 ;
|
||||
lstPL.emplace_back() ;
|
||||
Point3d ptArrowTail = m_ptP5 - vtRad * m_dArrowLen * 2 ;
|
||||
lstPL.back().AddUPoint( 0, m_ptP5) ;
|
||||
lstPL.back().AddUPoint( 1, ptArrowTail1) ;
|
||||
ptArrowTail2 = m_ptP6 - vtStartDir * m_dArrowLen *2 ;
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint( 0, m_ptP6) ;
|
||||
lstPL.back().AddUPoint( 1, ptArrowTail2) ;
|
||||
dFactor = 0 ;
|
||||
lstPL.back().AddUPoint( 1, ptArrowTail) ;
|
||||
}
|
||||
lstPL.emplace_back() ;
|
||||
GetArrowHead( m_ptP5, ( m_bCalcArrowIn ? vtEndDir : - vtEndDir) + vtLine1 * dFactor, lstPL.back()) ;
|
||||
lstPL.emplace_back() ;
|
||||
GetArrowHead( m_ptP6, ( m_bCalcArrowIn ? - vtStartDir : vtStartDir) + vtLine2 * dFactor, lstPL.back()) ;
|
||||
// testo
|
||||
POLYLINELIST lstTxt ;
|
||||
if ( ApproxTextWithLines( dLinTol, dAngTolDeg, lstTxt))
|
||||
lstPL.splice( lstPL.end(), lstTxt) ;
|
||||
return true ;
|
||||
}
|
||||
default:
|
||||
// testo
|
||||
POLYLINELIST lstTxt;
|
||||
if ( ApproxTextWithLines( dLinTol, dAngTolDeg, lstTxt))
|
||||
lstPL.splice( lstPL.end(), lstTxt) ;
|
||||
return true ;
|
||||
}
|
||||
case DT_ANGULAR : {
|
||||
// prima linea di riferimento
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint( 0, m_ptP1) ;
|
||||
lstPL.back().AddUPoint( 1, m_ptP3) ;
|
||||
// seconda linea di riferimento
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint( 0, m_ptP2) ;
|
||||
lstPL.back().AddUPoint( 1, m_ptP4) ;
|
||||
// curva per l'arco
|
||||
PtrOwner<CurveArc> pCrvPos( CreateBasicCurveArc()) ;
|
||||
if ( IsNull( pCrvPos))
|
||||
return false ;
|
||||
// calcolo ptP5_bis
|
||||
Vector3d vtLine2 = m_ptP2 - m_ptP6 ;
|
||||
double dLen2 = vtLine2.Len() ;
|
||||
if ( ! vtLine2.Normalize())
|
||||
return false ;
|
||||
Point3d ptP5_bis = m_ptP2 + ( m_vtDir.Len() - dLen2) * vtLine2 ;
|
||||
// approssimerò l'arco con una polyline
|
||||
PolyLine plApprox ;
|
||||
double dLinTol = 0.01 ;
|
||||
double dAngTolDeg = 0.01 ;
|
||||
// se non ho testo
|
||||
if ( IsEmptyOrSpaces( m_sCalcText) || ! m_bCalcTextOn) {
|
||||
if ( ! pCrvPos->SetC2PN( m_ptP6, ptP5_bis, m_ptP5, m_vtN) || ! pCrvPos->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, plApprox))
|
||||
return false ;
|
||||
lstPL.emplace_back( plApprox) ;
|
||||
}
|
||||
// altrimenti, linea di misura divisa in due parti
|
||||
else {
|
||||
// prima parte
|
||||
if ( ! pCrvPos->SetC2PN( m_ptP6, m_ptP5, m_ptCalcP7, m_vtN) || ! pCrvPos->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, plApprox))
|
||||
return false ;
|
||||
lstPL.emplace_back( plApprox) ;
|
||||
// seconda parte
|
||||
if ( ! pCrvPos->SetC2PN( m_ptP6, ptP5_bis, m_ptCalcP8, m_vtN) || ! pCrvPos->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, plApprox))
|
||||
return false ;
|
||||
lstPL.emplace_back( plApprox) ;
|
||||
}
|
||||
// frecce
|
||||
if ( ! pCrvPos->Set3P( ptP5_bis, m_ptPos, m_ptP5, false))
|
||||
return false ;
|
||||
Vector3d vtStartDir ;
|
||||
Vector3d vtEndDir ;
|
||||
pCrvPos->GetStartDir( vtStartDir) ;
|
||||
pCrvPos->GetEndDir( vtEndDir) ;
|
||||
//storto la punta delle frecce su una direzione mediata tra l'arco e la perpendicolare al lato
|
||||
double dFactor = 1 / ( 0.6 * m_vtDir.Len()) ;// questo fattore dipende direttamente dalla distanza di m_ptPos dal centro e smorza lo scostamento
|
||||
// se però le frecce sono fuori non le storto e faccio le code dritte anziché curvilinee
|
||||
if ( ! m_bCalcArrowIn) {
|
||||
Point3d ptArrowTail1, ptArrowTail2 ;
|
||||
ptArrowTail1 = m_ptP5 + vtEndDir * m_dArrowLen *2 ;
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint( 0, m_ptP5) ;
|
||||
lstPL.back().AddUPoint( 1, ptArrowTail1) ;
|
||||
ptArrowTail2 = ptP5_bis - vtStartDir * m_dArrowLen *2 ;
|
||||
lstPL.emplace_back() ;
|
||||
lstPL.back().AddUPoint( 0, ptP5_bis) ;
|
||||
lstPL.back().AddUPoint( 1, ptArrowTail2) ;
|
||||
dFactor = 0 ;
|
||||
}
|
||||
lstPL.emplace_back() ;
|
||||
Vector3d vtLine1 = m_ptP1 - m_ptP6 ;
|
||||
if ( ! vtLine1.Normalize())
|
||||
return false ;
|
||||
GetArrowHead( m_ptP5, ( m_bCalcArrowIn ? vtEndDir : - vtEndDir) + vtLine1 * dFactor, lstPL.back()) ;
|
||||
lstPL.emplace_back() ;
|
||||
GetArrowHead( ptP5_bis, ( m_bCalcArrowIn ? - vtStartDir : vtStartDir) + vtLine2 * dFactor, lstPL.back()) ;
|
||||
// testo
|
||||
POLYLINELIST lstTxt ;
|
||||
if ( ApproxTextWithLines( dLinTol, dAngTolDeg, lstTxt))
|
||||
lstPL.splice( lstPL.end(), lstTxt) ;
|
||||
return true ;
|
||||
}
|
||||
default:
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1420,12 +1429,11 @@ ExtDimension::ApproxTextWithLines( double dLinTol, double dAngTolDeg, POLYLINELI
|
||||
Frame3d frRef ;
|
||||
if ( ! frRef.Set( m_ptCalcPos, m_vtN))
|
||||
return false ;
|
||||
|
||||
// oriento il testo con il raggio/diametro, ma solo se il testo è dentro la circonferenza
|
||||
if ( ( m_nType == DT_RADIAL || m_nType == DT_DIAMETRAL) && m_bCalcTextOn) {
|
||||
double dAngDeg = 0 ;
|
||||
Vector3d vtRad = m_ptPos - m_ptP5 ;
|
||||
m_vtDir.GetAngle( vtRad, dAngDeg) ;
|
||||
if ( ! frRef.Set( m_ptCalcPos, m_vtN, ( dAngDeg > 90 ? - vtRad : vtRad)))
|
||||
m_vtDir.GetAngle( frRef.VersX(), dAngDeg) ;
|
||||
if ( ! frRef.Set( m_ptCalcPos, m_vtN, ( dAngDeg > 90 ? - m_vtDir : m_vtDir)))
|
||||
return false ;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -71,7 +71,7 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
||||
const Vector3d& vtN, const std::string& sText) override ;
|
||||
bool SetDiametral( const Point3d& ptCen, const Point3d& ptPos,
|
||||
const Vector3d& vtN, const std::string& sText) override ;
|
||||
bool SetAngular( const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptV, const Point3d& ptPos,
|
||||
bool SetAngular( const Point3d& ptP1, const Point3d& ptV, const Point3d& ptP2, const Point3d& ptPos,
|
||||
const Vector3d& vtN, const std::string& sText) override ;
|
||||
const Vector3d& GetNormVersor( void) const override
|
||||
{ return m_vtN ; }
|
||||
@@ -145,7 +145,7 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
||||
Point3d m_ptP3 ; // terzo punto
|
||||
Point3d m_ptP4 ; // quarto punto
|
||||
Point3d m_ptP5 ; // quinto punto
|
||||
Point3d m_ptP6 ; // sesto punto
|
||||
Point3d m_ptP6 ; // sesto punto; nel caso delle quotature angolari � il centro
|
||||
Point3d m_ptPos ; // posizione ricevuta della quota
|
||||
std::string m_sText ; // testo della quota
|
||||
mutable bool m_bToCalc ; // flag dati effettivi da ricalcolare
|
||||
@@ -162,7 +162,7 @@ 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[2] ; // vettore propriet� temporanee
|
||||
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||
} ;
|
||||
|
||||
|
||||
+5
-8
@@ -298,8 +298,7 @@ OsFont::GetOutline( const string& sText, int nInsPos, ICURVEPLIST& lstPC) const
|
||||
if ( ! GetCharOutline( vCode[i], dAdvance, lstTmpPC))
|
||||
return false ;
|
||||
// lo trasformo opportunamente
|
||||
ICURVEPLIST::iterator iIter ;
|
||||
for ( iIter = lstTmpPC.begin() ; iIter != lstTmpPC.end() ; ++ iIter) {
|
||||
for ( auto iIter = lstTmpPC.begin() ; iIter != lstTmpPC.end() ; ++ iIter) {
|
||||
// trasformazioni
|
||||
(*iIter)->Scale( GLOB_FRM, dScaX, dScaY, dScaZ) ;
|
||||
(*iIter)->Translate( vtMove) ;
|
||||
@@ -464,8 +463,7 @@ OsFont::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, doubl
|
||||
if ( ! GetCharOutline( vCode[i], dAdvance, lstPC))
|
||||
return false ;
|
||||
// lo approssimo con segmenti di retta
|
||||
ICURVEPLIST::iterator iIter ;
|
||||
for ( iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter) {
|
||||
for ( auto iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter) {
|
||||
// trasformazioni
|
||||
(*iIter)->Scale( GLOB_FRM, dScaX, dScaY, dScaZ) ;
|
||||
(*iIter)->Translate( vtMove) ;
|
||||
@@ -478,7 +476,7 @@ OsFont::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, doubl
|
||||
if ( vtMove.x > dMaxW)
|
||||
dMaxW = vtMove.x ;
|
||||
// ciclo di pulizia
|
||||
for ( iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter)
|
||||
for ( auto iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter)
|
||||
delete (*iIter) ;
|
||||
lstPC.clear() ;
|
||||
}
|
||||
@@ -549,8 +547,7 @@ OsFont::ApproxWithArcs( const string& sText, int nInsPos, double dLinTol, double
|
||||
if ( ! GetCharOutline( vCode[i], dAdvance, lstPC))
|
||||
return false ;
|
||||
// lo approssimo con segmenti di arco e retta
|
||||
ICURVEPLIST::iterator iIter ;
|
||||
for ( iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter) {
|
||||
for ( auto iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter) {
|
||||
// trasformazioni
|
||||
(*iIter)->Scale( GLOB_FRM, dScaX, dScaY, dScaZ) ;
|
||||
(*iIter)->Translate( vtMove) ;
|
||||
@@ -563,7 +560,7 @@ OsFont::ApproxWithArcs( const string& sText, int nInsPos, double dLinTol, double
|
||||
if ( vtMove.x > dMaxW)
|
||||
dMaxW = vtMove.x ;
|
||||
// ciclo di pulizia
|
||||
for ( iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter)
|
||||
for ( auto iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter)
|
||||
delete (*iIter) ;
|
||||
lstPC.clear() ;
|
||||
}
|
||||
|
||||
+55
-105
@@ -1423,8 +1423,7 @@ GdbExecutor::CurveArcChangeRadius( const STRVECTOR& vsParams)
|
||||
if ( ! GetLengthParam( vsParams[1], dNewRad))
|
||||
return false ;
|
||||
// esecuzione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero l'arco
|
||||
ICurveArc* pCrvArc = GetCurveArc( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pCrvArc == nullptr)
|
||||
@@ -1452,8 +1451,7 @@ GdbExecutor::CurveArcChangeDeltaN( const STRVECTOR& vsParams)
|
||||
if ( ! GetLengthParam( vsParams[1], dNewDeltaN))
|
||||
return false ;
|
||||
// esecuzione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero l'arco
|
||||
ICurveArc* pCrvArc = GetCurveArc( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pCrvArc == nullptr)
|
||||
@@ -1686,8 +1684,7 @@ GdbExecutor::CurveCompoMake( const STRVECTOR& vsParams)
|
||||
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frDest))
|
||||
return false ;
|
||||
// esecuzione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero la curva
|
||||
int nIdCrv = *Iter ;
|
||||
const ICurve* pCrv = GetCurve( m_pGDB->GetGeoObj( nIdCrv)) ;
|
||||
@@ -1722,7 +1719,7 @@ GdbExecutor::CurveCompoMake( const STRVECTOR& vsParams)
|
||||
if ( AddGeoObj( vsParams[0], vsParams[1], Release( pCrvCompo))) {
|
||||
// se richiesto, cancello le curve originali
|
||||
if ( bErase) {
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->Erase( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -2309,8 +2306,7 @@ GdbExecutor::SurfTriMeshByTriangleSoup( const STRVECTOR& vsParams)
|
||||
if ( ! StmFts.Start())
|
||||
return false ;
|
||||
// Recupero tutti i triangoli delle superfici sorgenti e li inserisco nella nuova
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero la superficie sorgente
|
||||
const ISurfTriMesh* pStmS = GetSurfTriMesh( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pStmS == nullptr)
|
||||
@@ -2340,7 +2336,7 @@ GdbExecutor::SurfTriMeshByTriangleSoup( const STRVECTOR& vsParams)
|
||||
if ( AddGeoObj( vsParams[0], vsParams[1], pSTM)) {
|
||||
// se richiesto, cancello le curve originali
|
||||
if ( bErase) {
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->Erase( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -2534,8 +2530,7 @@ GdbExecutor::SurfTriMeshDoCompacting( const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// opero sui diversi oggetti
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero la superficie
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pStm == nullptr)
|
||||
@@ -2572,8 +2567,7 @@ GdbExecutor::SurfTriMeshDoSewing( const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[1], vnNames))
|
||||
return false ;
|
||||
// esecuzione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero la superficie da cucire
|
||||
const ISurfTriMesh* pStmS = GetSurfTriMesh( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pStmS == nullptr)
|
||||
@@ -2590,7 +2584,7 @@ GdbExecutor::SurfTriMeshDoSewing( const STRVECTOR& vsParams)
|
||||
}
|
||||
// se richiesto, cancello le superfici cucite alla prima
|
||||
if ( bErase) {
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter)
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter)
|
||||
m_pGDB->Erase( *Iter) ;
|
||||
}
|
||||
return true ;
|
||||
@@ -5432,8 +5426,7 @@ GdbExecutor::TextOutline( const STRVECTOR& vsParams)
|
||||
pTXT->GetOutline( lstPCRV) ;
|
||||
// inserisco le curve nel gruppo destinazione dopo aver sistemato il cambio di riferimento
|
||||
bool bOk = true ;
|
||||
ICURVEPLIST::iterator iIter ;
|
||||
for ( iIter = lstPCRV.begin() ; iIter != lstPCRV.end() ; ++ iIter) {
|
||||
for ( auto iIter = lstPCRV.begin() ; iIter != lstPCRV.end() ; ++ iIter) {
|
||||
(*iIter)->LocToLoc( frTXT, frDest) ;
|
||||
if ( m_pGDB->AddGeoObj( GDB_ID_NULL, nIdDest, (*iIter)) == GDB_ID_NULL) {
|
||||
delete (*iIter) ;
|
||||
@@ -5510,8 +5503,7 @@ GdbExecutor::GetNamesParam( const string& sParam, INTVECTOR& vnNames)
|
||||
// converto in interi
|
||||
vnNames.clear() ;
|
||||
vnNames.reserve( vsNames.size()) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsNames.begin() ; Iter != vsNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vsNames.begin() ; Iter != vsNames.end() ; ++Iter) {
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
int nId = GetIdParam( *Iter) ;
|
||||
if ( nId != GDB_ID_SEL) {
|
||||
@@ -5538,8 +5530,7 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
|
||||
// divido in parti
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam, ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// se 2 parti, allora Z = 0
|
||||
if ( vsParams.size() == 2) {
|
||||
@@ -5594,8 +5585,7 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 3, sParam.length()-4), ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
// ci deve essere almeno un parametro
|
||||
if ( vsParams.size() < 1)
|
||||
@@ -5747,8 +5737,7 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
|
||||
// divido in parti
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam, ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// se 2 parti, allora Z = 0
|
||||
if ( vsParams.size() == 2) {
|
||||
@@ -5778,8 +5767,7 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 3, sParam.length()-4), ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
// ci deve essere almeno un parametro
|
||||
if ( vsParams.size() < 1)
|
||||
@@ -5962,8 +5950,7 @@ GdbExecutor::GetPointsParam( const string& sParam, const Frame3d& frPnt, PolyLin
|
||||
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsPoints) ;
|
||||
// converto in punti
|
||||
PL.Clear() ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsPoints.begin() ; Iter != vsPoints.end() ; ++Iter) {
|
||||
for ( auto Iter = vsPoints.begin() ; Iter != vsPoints.end() ; ++Iter) {
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
if ( GetIdParam( *Iter) == GDB_ID_SEL) {
|
||||
int nId = m_pGDB->GetFirstSelectedObj() ;
|
||||
@@ -5997,8 +5984,7 @@ GdbExecutor::GetPointWParam( const string& sParam, const Frame3d& frPnt, Point3d
|
||||
// divido in parti
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
|
||||
// se 4 parti, sono 3 coordinate e un peso
|
||||
@@ -6037,8 +6023,7 @@ GdbExecutor::GetPointWsParam( const string& sParam, const Frame3d& frPnt, PolyAr
|
||||
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsPointWs) ;
|
||||
// converto in punti
|
||||
PA.Clear() ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsPointWs.begin() ; Iter != vsPointWs.end() ; ++Iter) {
|
||||
for ( auto Iter = vsPointWs.begin() ; Iter != vsPointWs.end() ; ++Iter) {
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
Point3d ptP ;
|
||||
double dBulge ;
|
||||
@@ -6059,8 +6044,7 @@ GdbExecutor::GetLengthParam( const string& sParam, double& dLen)
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// ci deve essere almeno un parametro
|
||||
if ( vsParams.size() < 1)
|
||||
@@ -6082,8 +6066,7 @@ GdbExecutor::GetLengthParam( const string& sParam, double& dLen)
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// ci deve essere almeno un parametro
|
||||
if ( vsParams.size() < 1)
|
||||
@@ -6118,8 +6101,7 @@ GdbExecutor::GetDirParam( const string& sParam, const Frame3d& frDir, double& dD
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 3, sParam.length()-4), ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
// ci deve essere almeno un parametro
|
||||
if ( vsParams.size() < 1)
|
||||
@@ -6263,8 +6245,7 @@ GdbExecutor::GetFrameParam( const string& sParam, const Frame3d& frRef, Frame3d&
|
||||
// divido in parti ed elimino spazi iniziali/finali
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sTmp, ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
// verifico siano 4 parti e le converto
|
||||
if ( vsParams.size() != 4)
|
||||
@@ -6291,8 +6272,7 @@ GdbExecutor::GetFrameParam( const string& sParam, const Frame3d& frRef, Frame3d&
|
||||
// divido in parti ed elimino spazi iniziali/finali
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sTmp, ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
// se c'è un parametro è l'origine
|
||||
Point3d ptOrig ;
|
||||
@@ -6358,8 +6338,7 @@ GdbExecutor::GetColorParam( const string& sParam, bool& bByParent, Color& cCol)
|
||||
// divido in parti
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam, ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// devono essere 3 o 4 parametri ( Red, Green, Blue [, Alpha])
|
||||
if ( vsParams.size() != 3 && vsParams.size() != 4)
|
||||
@@ -6387,8 +6366,7 @@ GdbExecutor::GetColorParam( const string& sParam, bool& bByParent, Color& cCol)
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// ci deve essere un parametro
|
||||
if ( vsParams.size() != 1)
|
||||
@@ -6421,8 +6399,7 @@ GdbExecutor::GetMaterialParam( const string& sParam, bool& bByParent, int& nMat)
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// ci deve essere un parametro
|
||||
if ( vsParams.size() != 1)
|
||||
@@ -6479,8 +6456,7 @@ GdbExecutor::ExecuteLevel( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
else
|
||||
return false ;
|
||||
// esecuzione impostazione livello
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SetLevel( *Iter, nLevel))
|
||||
return false ;
|
||||
}
|
||||
@@ -6511,8 +6487,7 @@ GdbExecutor::ExecuteMode( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
else
|
||||
return false ;
|
||||
// esecuzione impostazione modo
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SetMode( *Iter, nMode))
|
||||
return false ;
|
||||
}
|
||||
@@ -6543,8 +6518,7 @@ GdbExecutor::ExecuteStatus( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
else
|
||||
return false ;
|
||||
// esecuzione impostazione stato
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SetStatus( *Iter, nStat))
|
||||
return false ;
|
||||
}
|
||||
@@ -6565,8 +6539,7 @@ GdbExecutor::ExecuteSelect( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione selezione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SelectObj( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -6610,8 +6583,7 @@ GdbExecutor::ExecuteSelect( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
nFilter = EXT_TEXT ;
|
||||
}
|
||||
// esecuzione selezione di tutti gli oggetti di ogni gruppo
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SelectGroupObjs( *Iter, nFilter))
|
||||
return false ;
|
||||
}
|
||||
@@ -6635,8 +6607,7 @@ GdbExecutor::ExecuteDeselect( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione deselezione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->DeselectObj( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -6652,8 +6623,7 @@ GdbExecutor::ExecuteDeselect( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione deselezione di tutti gli oggetti di ogni gruppo
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->DeselectGroupObjs( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -6710,8 +6680,7 @@ GdbExecutor::MaterialColor( const STRVECTOR& vsParams)
|
||||
if ( ! GetColorParam( vsParams[1], bByParent, cCol))
|
||||
return false ;
|
||||
// esecuzione impostazione colore
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( bByParent) {
|
||||
if ( ! m_pGDB->SetMaterial( *Iter, GDB_MT_PARENT))
|
||||
return false ;
|
||||
@@ -6741,8 +6710,7 @@ GdbExecutor::MaterialMaterial( const STRVECTOR& vsParams)
|
||||
if ( ! GetMaterialParam( vsParams[1], bByParent, nMat))
|
||||
return false ;
|
||||
// esecuzione impostazione colore
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( bByParent) {
|
||||
if ( ! m_pGDB->SetMaterial( *Iter, GDB_MT_PARENT))
|
||||
return false ;
|
||||
@@ -6789,8 +6757,7 @@ GdbExecutor::ExecuteName( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetStringParam( vsParams[1], sName))
|
||||
return false ;
|
||||
// eseguo assegnazione nome
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SetName( *Iter, sName))
|
||||
return false ;
|
||||
}
|
||||
@@ -6806,8 +6773,7 @@ GdbExecutor::ExecuteName( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// eseguo rimozione nome
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->RemoveName( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -6839,8 +6805,7 @@ GdbExecutor::ExecuteInfo( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetStringParam( vsParams[2], sInfo))
|
||||
return false ;
|
||||
// eseguo assegnazione Info di data Key
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SetInfo( *Iter, sKey, sInfo))
|
||||
return false ;
|
||||
}
|
||||
@@ -6860,8 +6825,7 @@ GdbExecutor::ExecuteInfo( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetStringParam( vsParams[1], sKey))
|
||||
return false ;
|
||||
// eseguo rimozione nome Info di data Key
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->RemoveInfo( *Iter, sKey))
|
||||
return false ;
|
||||
}
|
||||
@@ -7010,8 +6974,7 @@ GdbExecutor::ExecuteRelocate( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
// recupero flag per globale
|
||||
bool bGlob = ( sCmd2 == "GLOB" || sCmd2 == "G") ;
|
||||
// esecuzione rilocazioni
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( bGlob) {
|
||||
if ( ! m_pGDB->RelocateGlob( *Iter, GetIdParam( vsParams[1]), nSonBeforeAfter))
|
||||
return false ;
|
||||
@@ -7036,8 +6999,7 @@ GdbExecutor::ExecuteErase( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione cancellazioni
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->Erase( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -7079,8 +7041,7 @@ GdbExecutor::ExecuteTranslate( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetVectorParam( vsParams[1], frRef, vtVN))
|
||||
return false ;
|
||||
// esecuzione traslazioni
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
switch ( nTraType) {
|
||||
case TRA_LOC :
|
||||
if ( ! m_pGDB->Translate( *Iter, vtVN))
|
||||
@@ -7144,8 +7105,7 @@ GdbExecutor::ExecuteRotate( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! FromString( vsParams[3], dAngDeg))
|
||||
return false ;
|
||||
// esecuzione rotazioni
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
switch ( nRotType) {
|
||||
case ROT_LOC :
|
||||
if ( ! m_pGDB->Rotate( *Iter, ptPC, vtVN, dAngDeg))
|
||||
@@ -7214,8 +7174,7 @@ GdbExecutor::ExecuteScale( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
! FromString( vsParams[4], dCoeffZ))
|
||||
return false ;
|
||||
// esecuzione scalature
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
switch ( nScaType) {
|
||||
case SCA_LOC :
|
||||
if ( ! m_pGDB->Scale( *Iter, frFrame, dCoeffX, dCoeffY, dCoeffZ))
|
||||
@@ -7273,8 +7232,7 @@ GdbExecutor::ExecuteMirror( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetVectorParam( vsParams[2], frRef, vtVN))
|
||||
return false ;
|
||||
// esecuzione specchiature
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
switch ( nMirType) {
|
||||
case MIR_LOC :
|
||||
if ( ! m_pGDB->Mirror( *Iter, ptPC, vtVN))
|
||||
@@ -7340,8 +7298,7 @@ GdbExecutor::ExecuteShear( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! FromString( vsParams[4], dCoeff))
|
||||
return false ;
|
||||
// esecuzione scorrimenti
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
switch ( nMirType) {
|
||||
case MIR_LOC :
|
||||
if ( ! m_pGDB->Shear( *Iter, ptPC, vtNorm, vtDir, dCoeff))
|
||||
@@ -7400,8 +7357,7 @@ GdbExecutor::CurveModifyInvert( const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione inversione curve
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
ICurve* pCurve = GetCurve( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pCurve == nullptr || ! pCurve->Invert())
|
||||
return false ;
|
||||
@@ -7518,8 +7474,7 @@ GdbExecutor::CurveModifyTrim( const STRVECTOR& vsParams, int nTrimType)
|
||||
if ( ! FromString( vsParams[1], dPar))
|
||||
return false ;
|
||||
// esecuzione trim
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
ICurve* pCurve ;
|
||||
if ( ( pCurve = GetCurve( m_pGDB->GetGeoObj( *Iter))) != nullptr) {
|
||||
switch ( nTrimType) {
|
||||
@@ -7718,8 +7673,7 @@ GdbExecutor::CurveCopyByChain( const STRVECTOR& vsParams)
|
||||
// preparo i dati per il concatenamento
|
||||
ChainCurves chainC ;
|
||||
chainC.Init( bAllowInvert, dToler, int( vnNames.size())) ;
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero la curva e il suo riferimento
|
||||
ICurve* pCrv = GetCurve( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pCrv == nullptr)
|
||||
@@ -7748,10 +7702,9 @@ GdbExecutor::CurveCopyByChain( const STRVECTOR& vsParams)
|
||||
if ( IsNull( pCrvCompo))
|
||||
return false ;
|
||||
// recupero le curve semplici e le inserisco nella curva composita
|
||||
INTVECTOR::iterator Iter2 ;
|
||||
for ( Iter2 = vIds.begin() ; Iter2 != vIds.end() ; ++Iter2) {
|
||||
int nId = abs( *Iter2) ;
|
||||
bool bInvert = ( *Iter2 < 0) ;
|
||||
for ( auto Iter = vIds.cbegin() ; Iter != vIds.cend() ; ++Iter) {
|
||||
int nId = abs( *Iter) ;
|
||||
bool bInvert = ( *Iter < 0) ;
|
||||
// recupero la curva e il suo riferimento
|
||||
ICurve* pCrv = GetCurve( m_pGDB->GetGeoObj( nId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
@@ -7806,8 +7759,7 @@ GdbExecutor::SurfModifyInvert( const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione inversione normale superficie
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
ISurf* pSurf = GetSurf( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pSurf == nullptr || ! pSurf->Invert())
|
||||
return false ;
|
||||
@@ -8049,8 +8001,7 @@ GdbExecutor::ExecuteOutTsc( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero l'oggetto ed eseguo l'output
|
||||
if ( ! OutGroupTsc( *Iter, nFlag))
|
||||
return false ;
|
||||
@@ -8073,8 +8024,7 @@ GdbExecutor::ExecuteOutTsc( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero l'oggetto ed eseguo l'output
|
||||
if ( ! m_OutTsc.PutGeoObj( m_pGDB->GetGeoObj( *Iter), nFlag))
|
||||
return false ;
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ GdbGroup::~GdbGroup( void)
|
||||
// nel sorgente aggiorno lista dei riferimenti
|
||||
INTVECTOR vnList ;
|
||||
pGdbObj->GetInfo( GDB_SI_LIST, vnList) ;
|
||||
INTVECTOR::const_iterator iFind = find( vnList.begin(), vnList.end(), m_nId) ;
|
||||
const auto iFind = find( vnList.begin(), vnList.end(), m_nId) ;
|
||||
if ( iFind != vnList.end())
|
||||
vnList.erase( iFind) ;
|
||||
if ( vnList.empty())
|
||||
|
||||
+2
-1
@@ -1468,7 +1468,8 @@ GdbIterator::SetInfo( const string& sKey, int nInfo)
|
||||
bool
|
||||
GdbIterator::SetInfo( const string& sKey, double dInfo)
|
||||
{
|
||||
return SetInfo( sKey, ToString( dInfo)) ;
|
||||
int nErr ;
|
||||
return ( SetInfo( sKey, ToString( dInfo, 6, &nErr)) && nErr == 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+2
-1
@@ -862,7 +862,8 @@ GdbObj::SetInfo( const string& sKey, int nInfo)
|
||||
bool
|
||||
GdbObj::SetInfo( const string& sKey, double dInfo)
|
||||
{
|
||||
return SetInfo( sKey, ToString( dInfo)) ;
|
||||
int nErr ;
|
||||
return ( SetInfo( sKey, ToString( dInfo, 6, &nErr)) && nErr == 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+2
-1
@@ -2785,7 +2785,8 @@ GeomDB::SetInfo( int nId, const string& sKey, int nInfo)
|
||||
bool
|
||||
GeomDB::SetInfo( int nId, const string& sKey, double dInfo)
|
||||
{
|
||||
return SetInfo( nId, sKey, ToString( dInfo)) ;
|
||||
int nErr ;
|
||||
return ( SetInfo( nId, sKey, ToString( dInfo, 6, &nErr)) && nErr == 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+2
-4
@@ -26,8 +26,7 @@ class IterManager
|
||||
{
|
||||
public :
|
||||
bool IsGdbIteratorInList( GdbIterator* pIter)
|
||||
{ PGDBI_LIST::const_iterator Iter ;
|
||||
for ( Iter = m_IterList.begin() ; Iter != m_IterList.end() ; ++ Iter) {
|
||||
{ for ( auto Iter = m_IterList.cbegin() ; Iter != m_IterList.cend() ; ++ Iter) {
|
||||
if ( *Iter == pIter)
|
||||
return true ;
|
||||
}
|
||||
@@ -41,8 +40,7 @@ class IterManager
|
||||
catch (...) { return false ;}
|
||||
return true ; }
|
||||
bool RemoveGdbIterator( GdbIterator* pIter)
|
||||
{ PGDBI_LIST::iterator Iter ;
|
||||
for ( Iter = m_IterList.begin() ; Iter != m_IterList.end() ; ++ Iter) {
|
||||
{ for ( auto Iter = m_IterList.cbegin() ; Iter != m_IterList.cend() ; ++ Iter) {
|
||||
if ( *Iter == pIter) {
|
||||
m_IterList.erase( Iter) ;
|
||||
return true ;
|
||||
|
||||
+3
-1
@@ -30,7 +30,9 @@ IdentifyFillets( ICurveComposite* pCrvCo, double dDist)
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
if ( IsFillet( pCrv, dDist))
|
||||
pCrvCo->SetCurveTempParam( i, 1.0) ;
|
||||
pCrvCo->SetCurveTempParam( i, 1.0) ;
|
||||
else
|
||||
pCrvCo->SetCurveTempParam( i, 0.0) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
+20
-20
@@ -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() ;
|
||||
@@ -85,7 +82,7 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
else {
|
||||
const CurveComposite* pCompo = GetBasicCurveComposite( pCrv) ;
|
||||
Point3d ptStart, ptEnd ;
|
||||
if ( pCompo != nullptr && pCompo->IsALine( 10 * EPS_SMALL, ptStart, ptEnd))
|
||||
if ( pCompo != nullptr && pCompo->IsALine( m_dLinTol, ptStart, ptEnd))
|
||||
bIsLine = true ;
|
||||
}
|
||||
// verifico che la curva sia piana (per le linee è comunque sempre vero)
|
||||
@@ -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,18 +165,18 @@ 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( 10 * EPS_SMALL, ANG_TOL_STD_DEG))
|
||||
if ( ! ccCopy.ArcsBezierCurvesToArcsPerpExtr( m_dLinTol, ANG_TOL_STD_DEG))
|
||||
return false ;
|
||||
|
||||
// elimino eventuali piccole Z
|
||||
if ( ! RemoveCurveSmallZs( &ccCopy, 10 * EPS_SMALL))
|
||||
if ( ! RemoveCurveSmallZs( &ccCopy, m_dLinTol))
|
||||
return false ;
|
||||
|
||||
// elimino tratti molto corti
|
||||
if ( ! RemoveCurveSmallParts( &ccCopy, 10 * EPS_SMALL))
|
||||
if ( ! RemoveCurveSmallParts( &ccCopy, m_dLinTol))
|
||||
return false ;
|
||||
|
||||
// converto archi diritti in segmenti di retta
|
||||
@@ -187,7 +184,7 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
if ( ! ccCopy.StraightArcsToLines( 2 * EPS_SMALL, ANG_CEN_MAX))
|
||||
return false ;
|
||||
// unisco parti allineate
|
||||
if ( ! ccCopy.MergeCurves( 10 * EPS_SMALL, ANG_TOL_STD_DEG, bClosed))
|
||||
if ( ! ccCopy.MergeCurves( m_dLinTol, ANG_TOL_STD_DEG, bClosed, true))
|
||||
return false ;
|
||||
|
||||
// verifico se il punto iniziale è stato modificato
|
||||
@@ -437,7 +434,7 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
|
||||
// se non rimasto nulla, esco
|
||||
double dLen ;
|
||||
if ( ! pCrvCompo->IsValid() || ! pCrvCompo->GetLength( dLen) || dLen < 10 * EPS_SMALL)
|
||||
if ( ! pCrvCompo->IsValid() || ! pCrvCompo->GetLength( dLen) || dLen < m_dLinTol)
|
||||
return true ;
|
||||
// inserisco la curva nella lista
|
||||
m_CrvLst.push_back( Release( pCrvCompo)) ;
|
||||
@@ -656,14 +653,14 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
pCrvCo2->GetStartPoint( ptStart2) ;
|
||||
pCrvCo2->GetEndPoint( ptEnd2) ;
|
||||
// verifiche di concatenamento
|
||||
if ( AreSamePointEpsilon( ptEnd, ptStart2, 10 * EPS_SMALL)) {
|
||||
if ( pCrvCo->AddCurve( pCrvCo2, true, 10 * EPS_SMALL))
|
||||
if ( AreSamePointEpsilon( ptEnd, ptStart2, m_dLinTol)) {
|
||||
if ( pCrvCo->AddCurve( pCrvCo2, true, m_dLinTol))
|
||||
ptEnd = ptEnd2 ;
|
||||
m_CrvLst.erase( iIter2) ;
|
||||
iIter2 = next( iIter) ;
|
||||
}
|
||||
else if ( AreSamePointEpsilon( ptEnd2, ptStart, 10 * EPS_SMALL)) {
|
||||
if ( pCrvCo->AddCurve( pCrvCo2, false, 10 * EPS_SMALL))
|
||||
else if ( AreSamePointEpsilon( ptEnd2, ptStart, m_dLinTol)) {
|
||||
if ( pCrvCo->AddCurve( pCrvCo2, false, m_dLinTol))
|
||||
ptStart = ptStart2 ;
|
||||
m_CrvLst.erase( iIter2) ;
|
||||
iIter2 = next( iIter) ;
|
||||
@@ -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
|
||||
|
||||
+14
-26
@@ -147,8 +147,7 @@ PolyArc::EraseLastUPoint( void)
|
||||
bool
|
||||
PolyArc::AddOffsetToU( double dOffset)
|
||||
{
|
||||
UPNTBLIST::iterator iter ;
|
||||
for ( iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
iter->dU += dOffset ;
|
||||
|
||||
return true ;
|
||||
@@ -173,8 +172,7 @@ PolyArc::ParamLinearTransform( double dStartU, double dEndU)
|
||||
else
|
||||
return false ;
|
||||
// eseguo la riparametrizzazione
|
||||
UPNTBLIST::iterator iter ;
|
||||
for ( iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
iter->dU = dStartU + dCoeff * ( iter->dU - dOriStartU) ;
|
||||
return true ;
|
||||
}
|
||||
@@ -183,8 +181,7 @@ PolyArc::ParamLinearTransform( double dStartU, double dEndU)
|
||||
bool
|
||||
PolyArc::SetElevation( double dZ)
|
||||
{
|
||||
UPNTBLIST::iterator iter ;
|
||||
for ( iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
iter->ptP.z = dZ ;
|
||||
|
||||
return true ;
|
||||
@@ -194,8 +191,7 @@ PolyArc::SetElevation( double dZ)
|
||||
bool
|
||||
PolyArc::AddElevation( double dZ)
|
||||
{
|
||||
UPNTBLIST::iterator iter ;
|
||||
for ( iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
iter->ptP.z += dZ ;
|
||||
|
||||
return true ;
|
||||
@@ -206,8 +202,7 @@ bool
|
||||
PolyArc::Translate( const Vector3d& vtMove)
|
||||
{
|
||||
// il vettore estrusione non subisce modifiche
|
||||
UPNTBLIST::iterator iter ;
|
||||
for ( iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
iter->ptP.Translate( vtMove) ;
|
||||
|
||||
return true ;
|
||||
@@ -218,8 +213,7 @@ bool
|
||||
PolyArc::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
|
||||
{
|
||||
m_vtExtr.Rotate( vtAx, dCosAng, dSinAng) ;
|
||||
UPNTBLIST::iterator iter ;
|
||||
for ( iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
iter->ptP.Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
|
||||
return true ;
|
||||
@@ -230,8 +224,7 @@ bool
|
||||
PolyArc::Scale( const Frame3d& frRef, double dCoeff)
|
||||
{
|
||||
m_vtExtr.Scale( frRef, dCoeff, dCoeff, dCoeff) ;
|
||||
UPNTBLIST::iterator iter ;
|
||||
for ( iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
iter->ptP.Scale( frRef, dCoeff, dCoeff, dCoeff) ;
|
||||
|
||||
return true ;
|
||||
@@ -242,8 +235,7 @@ bool
|
||||
PolyArc::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
{
|
||||
m_vtExtr.Mirror( vtNorm) ;
|
||||
UPNTBLIST::iterator iter ;
|
||||
for ( iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter) {
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter) {
|
||||
iter->ptP.Mirror( ptOn, vtNorm) ;
|
||||
iter->dB *= - 1 ;
|
||||
}
|
||||
@@ -256,8 +248,7 @@ bool
|
||||
PolyArc::ToGlob( const Frame3d& frRef)
|
||||
{
|
||||
m_vtExtr.ToGlob( frRef) ;
|
||||
UPNTBLIST::iterator iter ;
|
||||
for ( iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
iter->ptP.ToGlob( frRef) ;
|
||||
|
||||
return true ;
|
||||
@@ -268,8 +259,7 @@ bool
|
||||
PolyArc::ToLoc( const Frame3d& frRef)
|
||||
{
|
||||
m_vtExtr.ToLoc( frRef) ;
|
||||
UPNTBLIST::iterator iter ;
|
||||
for ( iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
iter->ptP.ToLoc( frRef) ;
|
||||
|
||||
return true ;
|
||||
@@ -284,8 +274,7 @@ PolyArc::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
return true ;
|
||||
// ciclo sui punti
|
||||
m_vtExtr.LocToLoc( frOri, frDest) ;
|
||||
UPNTBLIST::iterator iter ;
|
||||
for ( iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter)
|
||||
iter->ptP.LocToLoc( frOri, frDest) ;
|
||||
|
||||
return true ;
|
||||
@@ -319,8 +308,7 @@ PolyArc::Split( double dU, PolyArc& PA)
|
||||
// pulisco la polilinea destinazione
|
||||
PA.Clear() ;
|
||||
// ricerca del punto in cui dividere
|
||||
UPNTBLIST::const_iterator iter ;
|
||||
iter = m_lUPointBs.begin() ;
|
||||
auto iter = m_lUPointBs.begin() ;
|
||||
while ( iter != m_lUPointBs.end() && iter->dU < ( dU + EPS_PARAM))
|
||||
++ iter ;
|
||||
if ( iter == m_lUPointBs.end())
|
||||
@@ -585,7 +573,7 @@ PolyArc::Invert( bool bInvertU)
|
||||
// inverto la lista
|
||||
m_lUPointBs.reverse() ;
|
||||
// sposto il bulge all'estremo iniziale di ogni tratto (l'ultimo non conta) e lo inverto
|
||||
for ( UPNTBLIST::iterator iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter) {
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter) {
|
||||
if ( next( iter) != m_lUPointBs.end())
|
||||
iter->dB = - next( iter)->dB ;
|
||||
else
|
||||
@@ -596,7 +584,7 @@ PolyArc::Invert( bool bInvertU)
|
||||
// recupero il primo valore di U che è il vecchio finale ed è il riferimento di inversione
|
||||
double dUfin = m_lUPointBs.front().dU ;
|
||||
// ciclo su tutti gli elementi
|
||||
for ( UPNTBLIST::iterator iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter) {
|
||||
for ( auto iter = m_lUPointBs.begin() ; iter != m_lUPointBs.end() ; ++ iter) {
|
||||
iter->dU = dUfin - iter->dU ;
|
||||
}
|
||||
}
|
||||
|
||||
+16
-19
@@ -139,8 +139,7 @@ PolyLine::EraseLastUPoint( void)
|
||||
bool
|
||||
PolyLine::AddOffsetToU( double dOffset)
|
||||
{
|
||||
PNTULIST::iterator iter ;
|
||||
for ( iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
iter->second += dOffset ;
|
||||
|
||||
return true ;
|
||||
@@ -150,8 +149,7 @@ PolyLine::AddOffsetToU( double dOffset)
|
||||
bool
|
||||
PolyLine::Translate( const Vector3d& vtMove)
|
||||
{
|
||||
PNTULIST::iterator iter ;
|
||||
for ( iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
iter->first.Translate( vtMove) ;
|
||||
|
||||
return true ;
|
||||
@@ -161,8 +159,7 @@ PolyLine::Translate( const Vector3d& vtMove)
|
||||
bool
|
||||
PolyLine::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
|
||||
{
|
||||
PNTULIST::iterator iter ;
|
||||
for ( iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
iter->first.Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
|
||||
return true ;
|
||||
@@ -172,8 +169,7 @@ PolyLine::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, dou
|
||||
bool
|
||||
PolyLine::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
|
||||
{
|
||||
PNTULIST::iterator iter ;
|
||||
for ( iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
iter->first.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
|
||||
return true ;
|
||||
@@ -183,8 +179,7 @@ PolyLine::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dC
|
||||
bool
|
||||
PolyLine::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
{
|
||||
PNTULIST::iterator iter ;
|
||||
for ( iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
iter->first.Mirror( ptOn, vtNorm) ;
|
||||
|
||||
return true ;
|
||||
@@ -194,8 +189,7 @@ PolyLine::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
bool
|
||||
PolyLine::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff)
|
||||
{
|
||||
PNTULIST::iterator iter ;
|
||||
for ( iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
iter->first.Shear( ptOn, vtNorm, vtDir, dCoeff) ;
|
||||
|
||||
return true ;
|
||||
@@ -205,8 +199,7 @@ PolyLine::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vt
|
||||
bool
|
||||
PolyLine::ToGlob( const Frame3d& frRef)
|
||||
{
|
||||
PNTULIST::iterator iter ;
|
||||
for ( iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
iter->first.ToGlob( frRef) ;
|
||||
|
||||
return true ;
|
||||
@@ -216,8 +209,7 @@ PolyLine::ToGlob( const Frame3d& frRef)
|
||||
bool
|
||||
PolyLine::ToLoc( const Frame3d& frRef)
|
||||
{
|
||||
PNTULIST::iterator iter ;
|
||||
for ( iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
iter->first.ToLoc( frRef) ;
|
||||
|
||||
return true ;
|
||||
@@ -231,8 +223,7 @@ PolyLine::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
if ( AreSameFrame( frOri, frDest))
|
||||
return true ;
|
||||
// ciclo sui punti
|
||||
PNTULIST::iterator iter ;
|
||||
for ( iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
for ( auto iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
iter->first.LocToLoc( frOri, frDest) ;
|
||||
|
||||
return true ;
|
||||
@@ -654,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 ;
|
||||
}
|
||||
@@ -683,7 +680,7 @@ PolyLine::GetMaxDistanceFromLine( const Point3d& ptLine, const Vector3d& vtLine,
|
||||
bool
|
||||
PolyLine::AdjustForMaxSegmentLen( double dMaxLen)
|
||||
{
|
||||
PNTULIST::iterator iter = m_lUPoints.begin() ;
|
||||
auto iter = m_lUPoints.begin() ;
|
||||
// se non ci sono punti, esco subito
|
||||
if ( iter == m_lUPoints.end())
|
||||
return false ;
|
||||
|
||||
+15
-12
@@ -149,6 +149,7 @@ RemoveCurveSmallParts( ICurveComposite* pCurve, double dLinTol)
|
||||
int nCrvCount = pCurve->GetCurveCount() ;
|
||||
if ( nCrvCount < 2 || ( nCrvCount < 3 && pCurve->IsClosed()))
|
||||
return true ;
|
||||
|
||||
// se aperta, verifico le due curve agli estremi
|
||||
if ( ! pCurve->IsClosed()) {
|
||||
// curva iniziale
|
||||
@@ -170,6 +171,7 @@ RemoveCurveSmallParts( ICurveComposite* pCurve, double dLinTol)
|
||||
-- nCrvCount ;
|
||||
}
|
||||
}
|
||||
|
||||
// ciclo sulle curve elementari della composita
|
||||
int nStart = pCurve->IsClosed() ? 0 : 1 ;
|
||||
int nEnd = pCurve->IsClosed() ? nCrvCount : nCrvCount - 1 ;
|
||||
@@ -183,22 +185,23 @@ RemoveCurveSmallParts( ICurveComposite* pCurve, double dLinTol)
|
||||
Point3d ptMid ; pCurrCrv->GetMidPoint( ptMid) ;
|
||||
// rimuovo il segmento
|
||||
if ( pCurve->RemoveJoint( i)) {
|
||||
-- nCrvCount ;
|
||||
-- nEnd ;
|
||||
-- i ;
|
||||
// porto il nuovo estremo sul punto medio
|
||||
pCurve->ModifyJoint( i + 1, ptMid) ;
|
||||
pCurve->ModifyJoint( i, ptMid) ;
|
||||
// aggiorno valore di i tenendo conto che ModifyJoint potrebbe modificare la curva precedente
|
||||
// che quindi va ricontrollata
|
||||
i = max( i - 2, nStart - 1) ;
|
||||
// aggiorno valore di nEnd ( ModifyJoint potrebbe aver rimosso la curva precedente e la successiva)
|
||||
nEnd = pCurve->GetCurveCount() - ( pCurve->IsClosed() ? 0 : 1) ;
|
||||
}
|
||||
// altrimenti devo rimuovere anche il successivo
|
||||
else if ( pCurve->RemoveJoint( i + 1) && pCurve->RemoveJoint( i)) {
|
||||
nCrvCount -= 2 ;
|
||||
nEnd -= 2 ;
|
||||
-- i ;
|
||||
// porto il nuovo estremo sul punto medio
|
||||
pCurve->ModifyJoint( i + 1, ptMid) ;
|
||||
// altrimenti rimuovo anche il successivo
|
||||
else if ( pCurve->RemoveJoint( i + 1)) {
|
||||
pCurve->RemoveJoint( i) ;
|
||||
pCurve->ModifyJoint( i, ptMid) ;
|
||||
i = max( i - 2, nStart - 1) ;
|
||||
nEnd = pCurve->GetCurveCount() - ( pCurve->IsClosed() ? 0 : 1) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
+8
-11
@@ -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"
|
||||
@@ -114,13 +115,9 @@ GetSurfFlatRegionDisk( double dRadius)
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
ISurfFlatRegion*
|
||||
GetSurfFlatRegionFromFatCurve( ICurve* pCrv, double dRadius, bool bSquareEnds, bool bSquareMids)
|
||||
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 ;
|
||||
@@ -187,7 +184,7 @@ GetSurfFlatRegionFromFatCurve( ICurve* pCrv, double dRadius, bool bSquareEnds, b
|
||||
// per creare la regione
|
||||
SurfFlatRegionByContours SfrCntr( false, false) ;
|
||||
// offset della prima curva a destra del raggio
|
||||
OffsetCurve OffsCrv1 ;
|
||||
OffsetCurve OffsCrv1( dOffsLinTol) ;
|
||||
if ( ! OffsCrv1.Make( pCompo1, dRadius, nOffsType))
|
||||
return nullptr ;
|
||||
ICurve* pOffs1 = OffsCrv1.GetLongerCurve() ;
|
||||
@@ -197,7 +194,7 @@ GetSurfFlatRegionFromFatCurve( ICurve* pCrv, double dRadius, bool bSquareEnds, b
|
||||
}
|
||||
|
||||
// offset della seconda curva a destra del raggio (è invertita rispetto alla precedente)
|
||||
OffsetCurve OffsCrv2 ;
|
||||
OffsetCurve OffsCrv2( dOffsLinTol) ;
|
||||
if ( ! OffsCrv2.Make( pCompo2, dRadius, nOffsType))
|
||||
return nullptr ;
|
||||
ICurve* pOffs2 = OffsCrv2.GetLongerCurve() ;
|
||||
@@ -227,7 +224,7 @@ GetSurfFlatRegionFromFatCurve( ICurve* pCrv, double dRadius, bool bSquareEnds, b
|
||||
SurfFlatRegionByContours SfrCntr( false, false) ;
|
||||
|
||||
// offset della prima curva a destra del raggio
|
||||
OffsetCurve OffsCrv1 ;
|
||||
OffsetCurve OffsCrv1( dOffsLinTol) ;
|
||||
if ( ! OffsCrv1.Make( pCompo1, dRadius, nOffsType))
|
||||
return nullptr ;
|
||||
ICurve* pOffs1 = OffsCrv1.GetLongerCurve() ;
|
||||
@@ -243,7 +240,7 @@ GetSurfFlatRegionFromFatCurve( ICurve* pCrv, double dRadius, bool bSquareEnds, b
|
||||
}
|
||||
|
||||
// offset della seconda curva a destra del raggio
|
||||
OffsetCurve OffsCrv2 ;
|
||||
OffsetCurve OffsCrv2( dOffsLinTol) ;
|
||||
if ( ! OffsCrv2.Make( pCompo2, dRadius, nOffsType))
|
||||
return nullptr ;
|
||||
ICurve* pOffs2 = OffsCrv2.GetLongerCurve() ;
|
||||
|
||||
+22
-12
@@ -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,6 +439,8 @@ 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)
|
||||
{
|
||||
// metodo di calcolo impostato da USE_VORONOI
|
||||
|
||||
// verifico che la linea guida sia piana
|
||||
Plane3d plGuide ;
|
||||
if ( ! pGuide->IsFlat( plGuide, false, 10 * EPS_SMALL))
|
||||
@@ -456,19 +457,28 @@ GetSurfTriMeshBeveledRectSwept( double dDimH, double dDimV, double dBevelH, doub
|
||||
const int NUM_OFFS = 4 ;
|
||||
OffsetCurve vOffsCrv[NUM_OFFS] ;
|
||||
double vDist[NUM_OFFS] = { dDimH / 2 - dBevelH, -dDimH / 2 + dBevelH, dDimH / 2, -dDimH / 2} ;
|
||||
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) ;
|
||||
bool bOk = true ;
|
||||
int nFin = 0 ;
|
||||
while ( nFin < NUM_OFFS) {
|
||||
for ( int i = 0 ; i < NUM_OFFS ; ++ i) {
|
||||
if ( vRes[i].valid() && vRes[i].wait_for( chrono::nanoseconds{ 1}) == future_status::ready) {
|
||||
bOk = vRes[i].get() && bOk ;
|
||||
++ nFin ;
|
||||
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) ;
|
||||
bool bOk = true ;
|
||||
int nFin = 0 ;
|
||||
while ( nFin < NUM_OFFS) {
|
||||
for ( int i = 0 ; i < NUM_OFFS ; ++ i) {
|
||||
if ( vRes[i].valid() && vRes[i].wait_for( chrono::nanoseconds{ 1}) == future_status::ready) {
|
||||
bOk = vRes[i].get() && bOk ;
|
||||
++ nFin ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// se Voronoi non è possibile calcolare gli offset di una stessa curva in parallelo
|
||||
for ( int i = 0 ; i < NUM_OFFS && bOk ; ++ i)
|
||||
bOk = vOffsCrv[i].Make( pGuide, vDist[i], ICurve::OFF_FILLET) ;
|
||||
}
|
||||
|
||||
if ( ! bOk ||
|
||||
vOffsCrv[0].GetCurveCount() == 0 || vOffsCrv[1].GetCurveCount() == 0 ||
|
||||
vOffsCrv[2].GetCurveCount() == 0 || vOffsCrv[3].GetCurveCount() == 0)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// File : StmFromTriangleSoup.cpp Data : 07.05.23 Versione : 2.5e2
|
||||
// Contenuto : Implementazione della classe StmFromTriangleSoup, per creare
|
||||
// una superficie trimesh da un insieme di triangoli
|
||||
// (pu� essere disordinato come STL o pu� essere una superficie).
|
||||
// (può essere disordinato come STL o può essere una superficie).
|
||||
//
|
||||
// Modifiche : 19.05.14 DS Creazione modulo.
|
||||
//
|
||||
@@ -53,7 +53,7 @@ StmFromTriangleSoup::AddTriangle( const Triangle3d& Tria)
|
||||
// ciclo sui tre vertici
|
||||
int nIdV[3] ;
|
||||
for ( int i = 0 ; i < 3 ; ++ i) {
|
||||
// verifico se vertice gi� presente
|
||||
// verifico se vertice già presente
|
||||
int nId ;
|
||||
if ( ! m_VertGrid.Find( Tria.GetP( i), 2 * EPS_SMALL, nId)) {
|
||||
// aggiungo il vertice
|
||||
@@ -77,7 +77,7 @@ StmFromTriangleSoup::AddTriangle( const Triangle3d& Tria)
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
StmFromTriangleSoup::AddTriangle( const Point3d& ptP0, const Point3d& ptP1, const Point3d& ptP2,
|
||||
const double dU0, const double dV0,const double dU1, const double dV1,const double dU2, const double dV2)
|
||||
double dU0, double dV0, double dU1, double dV1, double dU2, double dV2)
|
||||
{
|
||||
// verifico inizializzazione
|
||||
if ( m_pSTM == nullptr)
|
||||
@@ -100,9 +100,9 @@ StmFromTriangleSoup::AddTriangle( const Point3d& ptP0, const Point3d& ptP1, cons
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
StmFromTriangleSoup::AddVertex( const Point3d& ptP, const double dU, const double dV)
|
||||
StmFromTriangleSoup::AddVertex( const Point3d& ptP, double dU, double dV)
|
||||
{
|
||||
// verifico se gi� presente
|
||||
// verifico se già presente
|
||||
int nId ;
|
||||
if ( m_VertGrid.Find( ptP, 2 * EPS_SMALL, nId))
|
||||
return nId ;
|
||||
|
||||
+27
-25
@@ -26,34 +26,36 @@ using namespace std ;
|
||||
static SurfTriMesh*
|
||||
GetStandardSurfTriMeshBox( double dDimX, double dDimY, double dHeight)
|
||||
{
|
||||
// creo la polilinea del contorno della base
|
||||
PolyLine PL ;
|
||||
int nU = 0 ;
|
||||
PL.AddUPoint( nU, Point3d( 0, 0, 0)) ;
|
||||
PL.AddUPoint( ++ nU, Point3d( dDimX, 0, 0)) ;
|
||||
PL.AddUPoint( ++ nU, Point3d( dDimX, dDimY, 0)) ;
|
||||
PL.AddUPoint( ++ nU, Point3d( 0, dDimY, 0)) ;
|
||||
PL.AddUPoint( ++ nU, Point3d( 0, 0, 0)) ;
|
||||
if ( dHeight < 0)
|
||||
PL.Invert() ;
|
||||
// vettore altezza (estrusione)
|
||||
Vector3d vtExtr( 0, 0, dHeight) ;
|
||||
// creo e setto la superficie trimesh laterale
|
||||
// creo oggetto vuoto
|
||||
PtrOwner<SurfTriMesh> pSTM( CreateBasicSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByExtrusion( PL, vtExtr))
|
||||
if ( IsNull( pSTM))
|
||||
return nullptr ;
|
||||
// creo la prima superficie di estremità
|
||||
SurfTriMesh STM1 ;
|
||||
if ( ! STM1.CreateByFlatContour( PL))
|
||||
// assegno i vertici
|
||||
double dBotZ = 0, dTopZ = dHeight ;
|
||||
if ( dBotZ > dTopZ)
|
||||
swap( dBotZ, dTopZ) ;
|
||||
if ( pSTM->AddVertex( Point3d( 0, 0, dBotZ)) == SVT_NULL ||
|
||||
pSTM->AddVertex( Point3d( 0, 0, dTopZ)) == SVT_NULL ||
|
||||
pSTM->AddVertex( Point3d( dDimX, 0, dBotZ)) == SVT_NULL ||
|
||||
pSTM->AddVertex( Point3d( dDimX, 0, dTopZ)) == SVT_NULL ||
|
||||
pSTM->AddVertex( Point3d( dDimX, dDimY, dBotZ)) == SVT_NULL ||
|
||||
pSTM->AddVertex( Point3d( dDimX, dDimY, dTopZ)) == SVT_NULL ||
|
||||
pSTM->AddVertex( Point3d( 0, dDimY, dBotZ)) == SVT_NULL ||
|
||||
pSTM->AddVertex( Point3d( 0, dDimY, dTopZ)) == SVT_NULL)
|
||||
return nullptr ;
|
||||
// la copio
|
||||
SurfTriMesh STM2 = STM1 ;
|
||||
// inverto la prima superficie
|
||||
STM1.Invert() ;
|
||||
// traslo la seconda
|
||||
STM2.Translate( Vector3d( 0, 0, dHeight)) ;
|
||||
// le unisco alla superficie del fianco
|
||||
if ( ! pSTM->DoSewing( STM1) || ! pSTM->DoSewing( STM2))
|
||||
// definisco i triangoli
|
||||
int aVertId[12][3]{{ 1, 0, 2}, { 1, 2, 3},
|
||||
{ 3, 2, 4}, { 3, 4, 5},
|
||||
{ 5, 4, 6}, { 5, 6, 7},
|
||||
{ 7, 6, 0}, { 7, 0, 1},
|
||||
{ 0, 4, 2}, { 6, 4, 0},
|
||||
{ 1, 3, 5}, { 7, 1, 5}} ;
|
||||
for ( int i = 0 ; i < 12 ; ++ i) {
|
||||
if ( pSTM->AddTriangle( aVertId[i]) == SVT_NULL)
|
||||
return nullptr ;
|
||||
}
|
||||
// sistemo la topologia
|
||||
if ( ! pSTM->AdjustTopology())
|
||||
return nullptr ;
|
||||
// restituisco la superficie
|
||||
return Release( pSTM) ;
|
||||
|
||||
+56
-43
@@ -54,7 +54,7 @@ SurfBezier::~SurfBezier( void)
|
||||
bool
|
||||
SurfBezier::Init( int nDegU, int nDegV, int nSpanU, int nSpanV, bool bIsRational)
|
||||
{
|
||||
// verifico validità grado
|
||||
// verifico validit� grado
|
||||
if ( nDegU < 1 || nDegU > MAXDEG || nDegV < 1 || nDegV > MAXDEG || nSpanU < 1 || nSpanV < 1)
|
||||
return false ;
|
||||
|
||||
@@ -86,7 +86,7 @@ SurfBezier::Init( int nDegU, int nDegV, int nSpanU, int nSpanV, bool bIsRational
|
||||
bool
|
||||
SurfBezier::SetControlPoint( int nInd, const Point3d& ptCtrl)
|
||||
{
|
||||
// verifico validità indice
|
||||
// verifico validit� indice
|
||||
if ( m_nStatus != OK || m_bRat || nInd < 0 || nInd >= GetDim())
|
||||
return false ;
|
||||
|
||||
@@ -108,7 +108,7 @@ SurfBezier::SetControlPoint( int nInd, const Point3d& ptCtrl)
|
||||
bool
|
||||
SurfBezier::SetControlPoint( int nInd, const Point3d& ptCtrl, double dW)
|
||||
{
|
||||
// verifico validità, razionalità e indice
|
||||
// verifico validit�, razionalit� e indice
|
||||
if ( m_nStatus != OK || ! m_bRat || nInd < 0 || nInd >= GetDim())
|
||||
return false ;
|
||||
|
||||
@@ -158,7 +158,7 @@ SurfBezier::GetTrimRegion( void) const
|
||||
bool
|
||||
SurfBezier::GetInfo( int& nDegU, int& nDegV, int& nSpanU, int& nSpanV, bool& bIsRat, bool& bTrimmed) const
|
||||
{
|
||||
// verifico validità superficie
|
||||
// verifico validit� superficie
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// restituisco gradi e flag di razionale
|
||||
@@ -175,7 +175,7 @@ SurfBezier::GetInfo( int& nDegU, int& nDegV, int& nSpanU, int& nSpanV, bool& bIs
|
||||
const Point3d&
|
||||
SurfBezier::GetControlPoint( int nInd, bool* pbOk) const
|
||||
{
|
||||
// verifico validità e indice
|
||||
// verifico validit� e indice
|
||||
if ( m_nStatus != OK || nInd < 0 || nInd >= GetDim()) {
|
||||
if ( pbOk != NULL)
|
||||
*pbOk = false ;
|
||||
@@ -191,7 +191,7 @@ SurfBezier::GetControlPoint( int nInd, bool* pbOk) const
|
||||
double
|
||||
SurfBezier::GetControlWeight( int nInd, bool* pbOk) const
|
||||
{
|
||||
// verifico validità, razionalità e indice
|
||||
// verifico validit�, razionalit� e indice
|
||||
if ( m_nStatus != OK || ! m_bRat || nInd < 0 || nInd >= GetDim()) {
|
||||
if ( pbOk != NULL)
|
||||
*pbOk = false ;
|
||||
@@ -503,7 +503,7 @@ SurfBezier::GetPointNrmD1D2( double dU, double dV, Side nUs, Side nVs,
|
||||
if ( vtN.Normalize())
|
||||
return true ;
|
||||
|
||||
// se solo una delle due derivate è piccola, mi sposto lungo il relativo parametro e uso le tangenti
|
||||
// se solo una delle due derivate � piccola, mi sposto lungo il relativo parametro e uso le tangenti
|
||||
if ( pvtDerU->Len() < EPS_SMALL && pvtDerV->Len() > 10 * EPS_SMALL) {
|
||||
double dCoeff = ( dU - 1000 * EPS_PARAM < 0. ? 1 : -1) ;
|
||||
double dUm = dU + 1000 * EPS_PARAM * dCoeff ;
|
||||
@@ -582,7 +582,7 @@ SurfBezier::CopyFrom( const SurfBezier& sbSrc)
|
||||
m_vWeCtrl = sbSrc.m_vWeCtrl ;
|
||||
if ( sbSrc.m_bTrimmed) {
|
||||
m_bTrimmed = true ;
|
||||
m_pTrimReg = sbSrc.m_pTrimReg ;
|
||||
m_pTrimReg = sbSrc.m_pTrimReg->Clone() ;
|
||||
}
|
||||
m_nTempProp[0] = sbSrc.m_nTempProp[0] ;
|
||||
m_nTempProp[1] = sbSrc.m_nTempProp[1] ;
|
||||
@@ -610,7 +610,7 @@ SurfBezier::GetTitle( void) const
|
||||
bool
|
||||
SurfBezier::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
||||
{
|
||||
// verifico validità superficie
|
||||
// verifico validit� superficie
|
||||
if ( m_nStatus != OK)
|
||||
sOut += string( "Status=Invalid") + szNewLine ;
|
||||
// area
|
||||
@@ -843,7 +843,7 @@ SurfBezier::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, d
|
||||
// la superficie deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità dell'asse di rotazione
|
||||
// verifico validit� dell'asse di rotazione
|
||||
if ( vtAx.IsSmall())
|
||||
return false ;
|
||||
|
||||
@@ -899,7 +899,7 @@ SurfBezier::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
// la superficie deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità del piano di specchiatura
|
||||
// verifico validit� del piano di specchiatura
|
||||
if ( vtNorm.IsSmall())
|
||||
return false ;
|
||||
|
||||
@@ -922,7 +922,7 @@ SurfBezier::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d&
|
||||
// la superficie deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità dei parametri
|
||||
// verifico validit� dei parametri
|
||||
if ( vtNorm.IsSmall() || vtDir.IsSmall())
|
||||
return false ;
|
||||
|
||||
@@ -944,11 +944,11 @@ SurfBezier::ToGlob( const Frame3d& frRef)
|
||||
// la superficie deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità del frame
|
||||
// verifico validit� del frame
|
||||
if ( frRef.GetType() == Frame3d::ERR)
|
||||
return false ;
|
||||
|
||||
// se frame identità, non devo fare alcunché
|
||||
// se frame identit�, non devo fare alcunch�
|
||||
if ( IsGlobFrame( frRef))
|
||||
return true ;
|
||||
|
||||
@@ -970,11 +970,11 @@ SurfBezier::ToLoc( const Frame3d& frRef)
|
||||
// la superficie deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità del frame
|
||||
// verifico validit� del frame
|
||||
if ( frRef.GetType() == Frame3d::ERR)
|
||||
return false ;
|
||||
|
||||
// se frame identità, non devo fare alcunché
|
||||
// se frame identit�, non devo fare alcunch�
|
||||
if ( IsGlobFrame( frRef))
|
||||
return true ;
|
||||
|
||||
@@ -996,11 +996,11 @@ SurfBezier::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
// la superficie deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità dei frame
|
||||
// verifico validit� dei frame
|
||||
if ( frOri.GetType() == Frame3d::ERR || frDest.GetType() == Frame3d::ERR)
|
||||
return false ;
|
||||
|
||||
// se i due riferimenti coincidono, non devo fare alcunché
|
||||
// se i due riferimenti coincidono, non devo fare alcunch�
|
||||
if ( AreSameFrame( frOri, frDest))
|
||||
return true ;
|
||||
|
||||
@@ -1263,7 +1263,7 @@ SurfBezier::GetLoop( int nLoop) const
|
||||
// se loop chiuso lo restituisco, altrimenti errore
|
||||
return ( pLoop->IsClosed() ? Release( pLoop) : nullptr) ;
|
||||
}
|
||||
// la superficie è trimmata, quindi devo cercare nei vari chunck il loop corrispondente
|
||||
// la superficie � trimmata, quindi devo cercare nei vari chunck il loop corrispondente
|
||||
else {
|
||||
if ( nLoop > m_pTrimReg->GetChunkCount())
|
||||
return nullptr ;
|
||||
@@ -1421,7 +1421,7 @@ SurfBezier::GetCurveOnVApproxLen( double dU) const
|
||||
// ResetAuxSurf() ;
|
||||
// return nullptr ;
|
||||
// }
|
||||
// // se già calcolata, la restituisco
|
||||
// // se gi� calcolata, la restituisco
|
||||
// if ( m_pSTM != nullptr)
|
||||
// return m_pSTM ;
|
||||
// // costruttore della superficie
|
||||
@@ -1497,34 +1497,44 @@ SurfBezier::GetAuxSurf( void) const
|
||||
ResetAuxSurf() ;
|
||||
return nullptr ;
|
||||
}
|
||||
// se già calcolata, la restituisco
|
||||
// se gi� calcolata, la restituisco
|
||||
if ( m_pSTM != nullptr)
|
||||
return m_pSTM ;
|
||||
|
||||
// costruttore della superficie
|
||||
vector<POLYLINEVECTOR> vvPL ;
|
||||
// costruttore della superficie
|
||||
POLYLINEMATRIX vvPL ;
|
||||
//POLYLINEVECTOR vPL ; // per usare i polygon basic
|
||||
Tree Tree( this, true) ;
|
||||
std::vector<std::tuple<Point3d,Point3d>> vTrees ;
|
||||
BIPNTVECTOR vTrees ;
|
||||
Tree.GetIndependentTrees( vTrees) ;
|
||||
bool bTest = false ; // per debug
|
||||
for ( int i = 0 ; i < (int) vTrees.size() ; ++ i) {
|
||||
Point3d ptMin = std::get<0>( vTrees[i]) ;
|
||||
Point3d ptMax = std::get<1>( vTrees[i]) ;
|
||||
Tree.SetSurf( this, true, ptMin, ptMax) ;
|
||||
//Tree.BuildTree_test() ; // per debug
|
||||
//Tree.BuildTree( 5 * LIN_TOL_FINE, 1) ;
|
||||
Tree.BuildTree( 5 * LIN_TOL_FINE, 0.1) ;
|
||||
if ( bTest) {
|
||||
Tree.BuildTree_test() ; // per debug
|
||||
//Tree.BuildTree( 5 * LIN_TOL_FINE, 1) ; // per debug
|
||||
Tree.SetTestMode() ;
|
||||
}
|
||||
else {
|
||||
Tree.BuildTree( 5 * LIN_TOL_FINE, 0.1) ;
|
||||
}
|
||||
Tree.GetPolygons( vvPL) ;
|
||||
|
||||
//Tree.GetPolygonsBasic( vPL) ; // per usare i polygon basic
|
||||
}
|
||||
//// per usare i polygon basic//////////////////////
|
||||
//// per usare i polygon basic//////////////////////
|
||||
//for (int k = 0 ; k < (int)vPL.size(); ++k) {
|
||||
// vvPL.emplace_back() ;
|
||||
// vvPL.back().push_back(vPL[k]) ;
|
||||
//}
|
||||
//// per usare i polygon basic///////////////////
|
||||
//// per usare i polygon basic///////////////////
|
||||
|
||||
// qui non sarebbe male stampare un messaggio di errore nel log se avevo un'area da disegnare ma non sono usciti dei poligoni
|
||||
if ( int(vvPL.size()) == 0)
|
||||
LOG_DBG_ERR( GetEGkLogger(), "ERROR : Bezier Surface couldn't be triangulated, hence wasn't drawn") ;
|
||||
|
||||
PtrOwner<SurfTriMesh> pSrfTm( CreateBasicSurfTriMesh()) ;
|
||||
StmFromTriangleSoup stmSoup ;
|
||||
if ( ! stmSoup.Start())
|
||||
return nullptr ;
|
||||
@@ -1565,24 +1575,27 @@ SurfBezier::GetAuxSurf( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfBezier::GetLeaves( std::vector<std::tuple<int, Point3d, Point3d>>& vLeaves) const
|
||||
SurfBezier::GetLeaves( vector<tuple<int, Point3d, Point3d>>& vLeaves) const
|
||||
{
|
||||
std::vector<Cell> vCells ;
|
||||
Tree Tree( this, true) ;
|
||||
std::vector<std::tuple<Point3d,Point3d>> vTrees ;
|
||||
BIPNTVECTOR vTrees ;
|
||||
Tree.GetIndependentTrees( vTrees) ;
|
||||
for ( int i = 0 ; i < (int) vTrees.size() ; ++ i) {
|
||||
Point3d ptMin = std::get<0>( vTrees[i]) ;
|
||||
Point3d ptMax = std::get<1>( vTrees[i]) ;
|
||||
for ( int i = 0 ; i < int( vTrees.size()) ; ++ i) {
|
||||
Point3d ptMin = get<0>( vTrees[i]) ;
|
||||
Point3d ptMax = get<1>( vTrees[i]) ;
|
||||
Tree.SetSurf( this, true, ptMin, ptMax) ;
|
||||
//Tree.BuildTree_test() ;
|
||||
//Tree.BuildTree( 5 * LIN_TOL_FINE, 1) ;
|
||||
Tree.BuildTree( 5 * LIN_TOL_FINE, 0.1) ;
|
||||
bool bTest = false ; // per debug
|
||||
if ( bTest) {
|
||||
Tree.BuildTree_test() ; // per debug
|
||||
//Tree.BuildTree( 5 * LIN_TOL_FINE, 1) ; // per debug
|
||||
}
|
||||
else {
|
||||
Tree.BuildTree( 5 * LIN_TOL_FINE, 0.1) ;
|
||||
}
|
||||
vector<Cell> vCells ;
|
||||
Tree.GetLeaves( vCells) ;
|
||||
for (int k = 0 ; k < (int)vCells.size(); ++ k ) {
|
||||
std::tuple<int, Point3d, Point3d> tCell ;
|
||||
tCell = make_tuple( vCells[k].m_nId, vCells[k].GetBottomLeft(), vCells[k].GetTopRight()) ;
|
||||
vLeaves.push_back( tCell) ;
|
||||
for ( int k = 0 ; k < int( vCells.size()) ; ++ k) {
|
||||
vLeaves.emplace_back( vCells[k].m_nId, vCells[k].GetBottomLeft(), vCells[k].GetTopRight()) ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
|
||||
+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
@@ -106,7 +106,7 @@ SurfTriMesh::Clear( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
SurfTriMesh::AddVertex( const Point3d& ptVert, const double dU, const double dV)
|
||||
SurfTriMesh::AddVertex( const Point3d& ptVert, double dU, double dV)
|
||||
{
|
||||
// imposto ricalcolo
|
||||
m_nStatus = TO_VERIFY ;
|
||||
|
||||
+1
-1
@@ -226,7 +226,7 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
|
||||
{ m_dSmoothAng = std::max( dSmoothAngDeg, EPS_ANG_SMALL) ;
|
||||
m_dCosSmAng = cos( m_dSmoothAng * DEGTORAD) ;
|
||||
m_OGrMgr.Reset() ; }
|
||||
int AddVertex( const Point3d& ptVert, const double dU = -1 , const double dV = -1) override ;
|
||||
int AddVertex( const Point3d& ptVert, double dU = -1, double dV = -1) override ;
|
||||
bool MoveVertex( int nInd, const Point3d& ptNewVert) override ;
|
||||
int AddTriangle( const int nIdVert[3], int nTFlag = 0) override ;
|
||||
bool RemoveTriangle( int nId) override ;
|
||||
|
||||
+115
-20
@@ -1275,6 +1275,7 @@ SurfTriMesh::IntersectTriMeshTriangle( SurfTriMesh& Other)
|
||||
RetriangulationForBooleanOperation( LineMapB, AmbiguosB, SurfB, bModif) ;
|
||||
|
||||
// Se i triangoli delle superfici non si intersecano, una delle due è totalmente interna o esterna all'altra.
|
||||
// non mi basta fare un controllo sulle bbox perché non so come sono orientate le superfici e che potrebbero anche non essere chiuse
|
||||
bool bRetriangulated = true ;
|
||||
if ( ! bModif && ( int( AmbiguosA.size()) == 0 || int( AmbiguosB.size()) == 0)) {
|
||||
bRetriangulated = false ;
|
||||
@@ -1283,7 +1284,7 @@ SurfTriMesh::IntersectTriMeshTriangle( SurfTriMesh& Other)
|
||||
int nCurVert = GetFirstVertex( ptFirstV) ;
|
||||
int nInOutNum = 0 ;
|
||||
while ( nInOutNum == 0 && nCurVert != SVT_NULL) {
|
||||
int nTriaNum = - 1 ;
|
||||
INTVECTOR vnTriaNum ;
|
||||
double dMinDist = DBL_MAX ;
|
||||
for ( int nTB = 0 ; nTB < nTriaNumB ; ++ nTB) {
|
||||
// Se il triangolo B non è valido, continuo
|
||||
@@ -1291,18 +1292,66 @@ SurfTriMesh::IntersectTriMeshTriangle( SurfTriMesh& Other)
|
||||
if ( ! SurfB.GetTriangle( nTB, trTriaB) || ! trTriaB.Validate( true))
|
||||
continue ;
|
||||
double dDist ;
|
||||
if ( DistPointTriangle( ptFirstV, trTriaB).GetDist( dDist) && dDist < dMinDist) {
|
||||
nTriaNum = nTB ;
|
||||
dMinDist = dDist ;
|
||||
// potrei trovare più triangolo equidistanti, li salvo tutti
|
||||
if ( DistPointTriangle( ptFirstV, trTriaB).GetDist( dDist)) {
|
||||
if ( abs(dDist - dMinDist) < EPS_SMALL)
|
||||
vnTriaNum.push_back( nTB) ;
|
||||
else if ( dDist < dMinDist){
|
||||
vnTriaNum.clear() ;
|
||||
vnTriaNum.push_back( nTB) ;
|
||||
dMinDist = dDist ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( nTriaNum >= 0) {
|
||||
if ( ! vnTriaNum.empty()) {
|
||||
Triangle3d trTriaB ;
|
||||
SurfB.GetTriangle( nTriaNum, trTriaB) ;
|
||||
if ( ( ptFirstV - trTriaB.GetP(0)) * trTriaB.GetN() < - EPS_SMALL)
|
||||
nInOutNum = 1 ;
|
||||
else if ( ( ptFirstV - trTriaB.GetP(0)) * trTriaB.GetN() > EPS_SMALL)
|
||||
nInOutNum = - 1 ;
|
||||
bool bSame = true ;
|
||||
// controllo se rispetto a questi triangoli il punto risulta sempre fuori o sempre dentro
|
||||
for ( int nTriaNum : vnTriaNum) {
|
||||
SurfB.GetTriangle( nTriaNum, trTriaB) ;
|
||||
if ( ( ptFirstV - trTriaB.GetP(0)) * trTriaB.GetN() < - EPS_SMALL) {
|
||||
if ( nInOutNum == 0)
|
||||
nInOutNum = 1 ;
|
||||
else if (nInOutNum == -1) {
|
||||
bSame = false ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else if ( ( ptFirstV - trTriaB.GetP(0)) * trTriaB.GetN() > EPS_SMALL) {
|
||||
if ( nInOutNum == 0)
|
||||
nInOutNum = -1 ;
|
||||
else if (nInOutNum == 1) {
|
||||
bSame = false ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// se le informazioni date dalle normali dei triangoli non sono concordi valuto il triangolo più vicino
|
||||
// e ricalcolo l'informazione che mi dà la sua normale
|
||||
if ( ! bSame ) {
|
||||
Point3d ptBar_tot ;
|
||||
for (int nTriaNum : vnTriaNum) {
|
||||
SurfB.GetTriangle( nTriaNum, trTriaB) ;
|
||||
ptBar_tot += trTriaB.GetCentroid();
|
||||
}
|
||||
ptBar_tot /= (int)vnTriaNum.size() ;
|
||||
for (int nTriaNum : vnTriaNum) {
|
||||
SurfB.GetTriangle( nTriaNum, trTriaB) ;
|
||||
Point3d ptInters1, ptInters2 ;
|
||||
int nInters = IntersLineTria(ptFirstV, ptBar_tot, trTriaB, ptInters1, ptInters2, true) ;
|
||||
if (nInters == ILTT_NO)
|
||||
continue ;
|
||||
else if ( nInters == ILTT_IN ) {
|
||||
if ( ( ptFirstV - trTriaB.GetP(0)) * trTriaB.GetN() < - EPS_SMALL)
|
||||
nInOutNum = 1 ;
|
||||
else if ( ( ptFirstV - trTriaB.GetP(0)) * trTriaB.GetN() > EPS_SMALL)
|
||||
nInOutNum = -1 ;
|
||||
break ;
|
||||
}
|
||||
else
|
||||
nInOutNum = 0 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( nInOutNum == 0) {
|
||||
nCurVert = GetNextVertex( nVertNum, ptFirstV) ;
|
||||
@@ -1316,7 +1365,7 @@ SurfTriMesh::IntersectTriMeshTriangle( SurfTriMesh& Other)
|
||||
nCurVert = SurfB.GetFirstVertex( ptFirstV) ;
|
||||
nInOutNum = 0 ;
|
||||
while ( nInOutNum == 0 && nCurVert != SVT_NULL) {
|
||||
int nTriaNum = - 1 ;
|
||||
INTVECTOR vnTriaNum ;
|
||||
double dMinDist = DBL_MAX ;
|
||||
for ( int nTA = 0 ; nTA < nTriaNumA ; ++ nTA) {
|
||||
// Se il triangolo A non è valido, continuo
|
||||
@@ -1326,19 +1375,65 @@ SurfTriMesh::IntersectTriMeshTriangle( SurfTriMesh& Other)
|
||||
DistPointTriangle DistCalculator( ptFirstV, trTriaA) ;
|
||||
double dDist ;
|
||||
DistCalculator.GetDist( dDist) ;
|
||||
if ( dDist < dMinDist) {
|
||||
nTriaNum = nTA ;
|
||||
dMinDist = dDist ;
|
||||
// potrei trovare più triangolo equidistanti, li salvo tutti
|
||||
if ( DistPointTriangle( ptFirstV, trTriaA).GetDist( dDist)) {
|
||||
if ( abs(dDist - dMinDist) < EPS_SMALL)
|
||||
vnTriaNum.push_back( nTA) ;
|
||||
else if ( dDist < dMinDist){
|
||||
vnTriaNum.clear() ;
|
||||
vnTriaNum.push_back( nTA) ;
|
||||
dMinDist = dDist ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( nTriaNum >= 0) {
|
||||
if ( ! vnTriaNum.empty()) {
|
||||
Triangle3d trTriaA ;
|
||||
GetTriangle( nTriaNum, trTriaA) ;
|
||||
if ( ( ptFirstV - trTriaA.GetP( 0)) * trTriaA.GetN() < - EPS_SMALL) {
|
||||
nInOutNum = 1 ;
|
||||
bool bSame = true ;
|
||||
// controllo se rispetto a questi triangoli il punto risulta sempre fuori o sempre dentro
|
||||
for ( int nTriaNum : vnTriaNum) {
|
||||
GetTriangle( nTriaNum, trTriaA) ;
|
||||
if ( ( ptFirstV - trTriaA.GetP(0)) * trTriaA.GetN() < - EPS_SMALL) {
|
||||
if ( nInOutNum == 0)
|
||||
nInOutNum = 1 ;
|
||||
else if (nInOutNum == -1) {
|
||||
bSame = false ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else if ( ( ptFirstV - trTriaA.GetP(0)) * trTriaA.GetN() > EPS_SMALL) {
|
||||
if ( nInOutNum == 0)
|
||||
nInOutNum = -1 ;
|
||||
else if (nInOutNum == 1) {
|
||||
bSame = false ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( ( ptFirstV - trTriaA.GetP(0)) * trTriaA.GetN() > EPS_SMALL) {
|
||||
nInOutNum = - 1 ;
|
||||
// se le informazioni date dalle normali dei triangoli non sono concordi valuto il triangolo più vicino
|
||||
// e ricalcolo l'informazione che mi dà la sua normale
|
||||
if ( ! bSame ) {
|
||||
Point3d ptBar_tot ;
|
||||
for (int nTriaNum : vnTriaNum) {
|
||||
GetTriangle( nTriaNum, trTriaA) ;
|
||||
ptBar_tot += trTriaA.GetCentroid();
|
||||
}
|
||||
ptBar_tot /= (int)vnTriaNum.size() ;
|
||||
for (int nTriaNum : vnTriaNum) {
|
||||
GetTriangle( nTriaNum, trTriaA) ;
|
||||
Point3d ptInters1, ptInters2 ;
|
||||
int nInters = IntersLineTria(ptFirstV, ptBar_tot, trTriaA, ptInters1, ptInters2, true) ;
|
||||
if (nInters == ILTT_NO)
|
||||
continue ;
|
||||
else if ( nInters == ILTT_IN ) {
|
||||
if ( ( ptFirstV - trTriaA.GetP(0)) * trTriaA.GetN() < - EPS_SMALL)
|
||||
nInOutNum = 1 ;
|
||||
else if ( ( ptFirstV - trTriaA.GetP(0)) * trTriaA.GetN() > EPS_SMALL)
|
||||
nInOutNum = -1 ;
|
||||
break ;
|
||||
}
|
||||
else
|
||||
nInOutNum = 0 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( nInOutNum == 0) {
|
||||
|
||||
@@ -731,7 +731,7 @@ SurfTriMesh::CloneFacet( int nF) const
|
||||
int nIdV[3] ;
|
||||
for ( int j = 0 ; j < 3 ; ++ j) {
|
||||
// verifico se vertice già presente
|
||||
VVMAP::iterator it = PntMap.find( m_vTria[nT].nIdVert[j]) ;
|
||||
const auto it = PntMap.find( m_vTria[nT].nIdVert[j]) ;
|
||||
if ( it == PntMap.end()) {
|
||||
// aggiungo il vertice
|
||||
if ( ( nIdV[j] = pSTM->AddVertex( m_vVert[m_vTria[nT].nIdVert[j]].ptP)) == SVT_NULL)
|
||||
|
||||
@@ -254,16 +254,19 @@ SurfTriMesh::RemoveTJunctions( bool& bModified)
|
||||
static bool
|
||||
IsVertex( PNTULIST& PointList, PNTULIST::const_iterator itCurr)
|
||||
{
|
||||
// se la lista contiene meno di tre punti, test inutili
|
||||
if ( PointList.size() < 3)
|
||||
return false ;
|
||||
// recupero il punto precedente
|
||||
PNTULIST::const_iterator itPrev ;
|
||||
if ( itCurr == PointList.begin())
|
||||
itPrev = prev( PointList.end(), 2) ;
|
||||
if ( itCurr == PointList.cbegin())
|
||||
itPrev = prev( PointList.cend(), 2) ;
|
||||
else
|
||||
itPrev = prev( itCurr) ;
|
||||
// recupero il punto successivo
|
||||
auto itNext = next( itCurr) ;
|
||||
if ( itNext == PointList.end())
|
||||
itNext = next( PointList.begin()) ;
|
||||
if ( itNext == PointList.cend())
|
||||
itNext = next( PointList.cbegin()) ;
|
||||
// se cambia faccia adiacente tra prima e dopo, va bene
|
||||
if ( itPrev->second != itCurr->second)
|
||||
return true ;
|
||||
|
||||
@@ -14,27 +14,28 @@
|
||||
#pragma once
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include <map>
|
||||
#include "SurfBezier.h"
|
||||
#include "GeoConst.h"
|
||||
#include "CurveLine.h"
|
||||
#include "/EgtDev/Include/EGkPolyLine.h"
|
||||
#include <map>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
struct Inters {
|
||||
int nIn ;
|
||||
PNTVECTOR vpt ;
|
||||
int nOut ;
|
||||
bool bCCW ;
|
||||
bool bVertex ;
|
||||
int nChunk ;
|
||||
// riordino le intersezioni per lato in senso antiorario dal top
|
||||
// se ho più intersezioni che entrano in un lato le riordino considerando che percorro i lati in senso antiorario a partire da ptTR
|
||||
bool operator < ( Inters& b) {
|
||||
// trovo in che ordine stanno i due strat, tenendo conto anche della possibilità che siano vertici
|
||||
// se ho pi� intersezioni che entrano in un lato le riordino considerando che percorro i lati in senso antiorario a partire da ptTR
|
||||
bool operator < ( Inters& b)
|
||||
{
|
||||
// trovo in che ordine stanno i due strat, tenendo conto anche della possibilit� che siano vertici
|
||||
INTVECTOR vEdges = { 7, 0, 4, 1, 5, 2, 6, 3} ;
|
||||
INTVECTOR::iterator iter1 = find( vEdges.begin(), vEdges.end(), nIn) ;
|
||||
const auto iter1 = find( vEdges.begin(), vEdges.end(), nIn) ;
|
||||
int nPos1 = std::distance( vEdges.begin(), iter1) ;
|
||||
INTVECTOR::iterator iter2 = find( vEdges.begin(), vEdges.end(), b.nIn) ;
|
||||
const auto iter2 = find( vEdges.begin(), vEdges.end(), b.nIn) ;
|
||||
int nPos2 = std::distance( vEdges.begin(), iter2) ;
|
||||
// se sono loop interni li ordino in modo decrescente rispetto all'area
|
||||
bool bEqIn = ( nIn == b.nIn) ;
|
||||
@@ -51,27 +52,29 @@ struct Inters {
|
||||
pl.Close() ;
|
||||
pl.GetAreaXY( dAreaB) ;
|
||||
}
|
||||
// se nIn è un vertice sistemo il valore
|
||||
// se nIn � un vertice sistemo il valore
|
||||
int nEdgeIn = nIn ;
|
||||
if ( nIn > 3)
|
||||
nEdgeIn = nIn - 4 ;
|
||||
return nPos1 < nPos2 ||
|
||||
( bEqIn && nEdgeIn == -1 && abs(dAreaA) > abs(dAreaB)) ||
|
||||
( bEqIn && nEdgeIn == 0 && vpt[0].x > b.vpt[0].x) ||
|
||||
( bEqIn && nEdgeIn == 1 && vpt[0].y > b.vpt[0].y) ||
|
||||
( bEqIn && nEdgeIn == 2 && vpt[0].x < b.vpt[0].x) ||
|
||||
( bEqIn && nEdgeIn == 3 && vpt[0].y < b.vpt[0].y)
|
||||
; }
|
||||
bool operator == ( Inters& b) {
|
||||
return ( nPos1 < nPos2 ||
|
||||
( bEqIn && nEdgeIn == -1 && abs( dAreaA) > abs( dAreaB)) ||
|
||||
( bEqIn && nEdgeIn == 0 && vpt[0].x > b.vpt[0].x) ||
|
||||
( bEqIn && nEdgeIn == 1 && vpt[0].y > b.vpt[0].y) ||
|
||||
( bEqIn && nEdgeIn == 2 && vpt[0].x < b.vpt[0].x) ||
|
||||
( bEqIn && nEdgeIn == 3 && vpt[0].y < b.vpt[0].y)) ;
|
||||
}
|
||||
bool operator == ( Inters& b)
|
||||
{
|
||||
return AreSamePointExact( vpt[0], b.vpt[0]) ;
|
||||
}
|
||||
bool operator != ( Inters& b){
|
||||
bool operator != ( Inters& b)
|
||||
{
|
||||
return ! AreSamePointExact( vpt[0], b.vpt[0]) ;
|
||||
}
|
||||
} ;
|
||||
// nIn e nOut sono flag che indicano da quale lato ho l'ingresso e l'uscita a partire dal lato top in senso antiorario
|
||||
// oltre il 3 sono le celle adiacenti in diagonale al vertice-> 4 corrisponde al ptTl e da lì in senso antiorario
|
||||
// -1 se la curva è sempre dentro la cella
|
||||
// oltre il 3 sono le celle adiacenti in diagonale al vertice-> 4 corrisponde al ptTl e da l� in senso antiorario
|
||||
// -1 se la curva � sempre dentro la cella
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Cell
|
||||
@@ -86,23 +89,47 @@ class Cell
|
||||
// |_________________|
|
||||
// Edge 5 ( SW) Edge 2 (Bottom) Edge 6 ( SE)
|
||||
public :
|
||||
~Cell( void) ;
|
||||
Cell( void) ;
|
||||
Cell( const Point3d& ptBL, const Point3d& ptTR) ;
|
||||
inline bool IsSame( const Cell& cOtherCell) const ;
|
||||
void SetBottomLeft( const Point3d ptBL) { m_ptPbl = ptBL ; }
|
||||
void SetTopRight( const Point3d ptTR) { m_ptPtr = ptTR ; }
|
||||
void SetSplitDirVert( const bool bVert) { m_bSplitVert = bVert ; }
|
||||
void SetParent( const int& nParent) { m_nParent = nParent ; }
|
||||
Point3d GetBottomLeft( void) const { return m_ptPbl ; }
|
||||
Point3d GetTopRight( void) const { return m_ptPtr ; }
|
||||
double GetSplitValue( void) const { return m_dSplit ; }
|
||||
bool IsSplitVert( void) const { return m_bSplitVert ; } // se true la cella verrebbe splittata verticalmente, sennò orizzontalmente
|
||||
bool IsLeaf( void) const ; // flag che indica se la cella ha figli o se è una foglia
|
||||
bool IsProcessed( void) const { return m_bProcessed ; } // flag che indica se tutti i figli della cella, se ce ne sono, sono stati processati
|
||||
void SetProcessed( const bool bProcessed = true) { m_bProcessed = bProcessed ; }
|
||||
static bool minorX ( const Cell& c1, const Cell& c2) { return c1.m_ptPbl.x < c2.m_ptPbl.x ; }
|
||||
static bool minorY ( const Cell& c1, const Cell& c2) { return c1.m_ptPbl.y < c2.m_ptPbl.y ; }
|
||||
~Cell( void) {}
|
||||
Cell( void)
|
||||
: m_nId( -1),m_nTop ( -2), m_nBottom( -2), m_nLeft( -2), m_nRight ( -2), m_nParent( -2), m_nDepth( 0),
|
||||
m_nChild1( -2), m_nChild2( -2), m_nFlag( -1), m_nFlag2( 0), m_nRightEdgeIn( -1), m_bOnLeftEdge( false), m_bOnTopEdge( false),
|
||||
m_ptPbl( ORIG), m_ptPtr( SBZ_TREG_COEFF, SBZ_TREG_COEFF, 0), m_bProcessed( false), m_bSplitVert( true)
|
||||
{
|
||||
Point3d ptTr ( 1 * SBZ_TREG_COEFF, 1 * SBZ_TREG_COEFF) ;
|
||||
m_ptPtr = ptTr ;
|
||||
}
|
||||
Cell( const Point3d& ptBL, const Point3d& ptTR)
|
||||
: m_nId( -1),m_nTop ( -2), m_nBottom( -2), m_nLeft( -2), m_nRight ( -2), m_nParent( -2), m_nDepth( 0),
|
||||
m_nChild1( -2), m_nChild2( -2), m_nFlag( -1), m_nFlag2( 0), m_nRightEdgeIn( -1), m_bOnLeftEdge( false), m_bOnTopEdge( false),
|
||||
m_ptPbl( ptBL), m_ptPtr( ptTR), m_bProcessed( false), m_bSplitVert( true) {}
|
||||
bool IsSame( const Cell& cOtherCell) const
|
||||
{ return ( m_nId == cOtherCell.m_nId) ; }
|
||||
void SetBottomLeft( const Point3d& ptBL)
|
||||
{ m_ptPbl = ptBL ; }
|
||||
void SetTopRight( const Point3d& ptTR)
|
||||
{ m_ptPtr = ptTR ; }
|
||||
void SetSplitDirVert( bool bVert)
|
||||
{ m_bSplitVert = bVert ; }
|
||||
void SetParent( int nParent)
|
||||
{ m_nParent = nParent ; }
|
||||
Point3d GetBottomLeft( void) const
|
||||
{ return m_ptPbl ; }
|
||||
Point3d GetTopRight( void) const
|
||||
{ return m_ptPtr ; }
|
||||
double GetSplitValue( void) const
|
||||
{ return m_dSplit ; }
|
||||
bool IsSplitVert( void) const // se true la cella verrebbe splittata verticalmente, senn� orizzontalmente
|
||||
{ return m_bSplitVert ; }
|
||||
bool IsLeaf( void) const // flag che indica se la cella ha figli o se � una foglia
|
||||
{ return ( m_nChild1 == -2 && m_nChild2 == -2) ; }
|
||||
bool IsProcessed( void) const // flag che indica se tutti i figli della cella, se ce ne sono, sono stati processati
|
||||
{ return m_bProcessed ; }
|
||||
void SetProcessed( bool bProcessed = true)
|
||||
{ m_bProcessed = bProcessed ; }
|
||||
static bool minorX( const Cell& c1, const Cell& c2)
|
||||
{ return c1.m_ptPbl.x < c2.m_ptPbl.x ; }
|
||||
static bool minorY( const Cell& c1, const Cell& c2)
|
||||
{ return c1.m_ptPbl.y < c2.m_ptPbl.y ; }
|
||||
|
||||
public :
|
||||
int m_nId ; // Id della cella
|
||||
@@ -111,94 +138,95 @@ class Cell
|
||||
int m_nLeft ; // cella adiacente al lato left
|
||||
int m_nRight ; // cella adiacente al lato right
|
||||
int m_nParent ; // cella genitore
|
||||
int m_nDepth ; // profondità della cella rispetto a root
|
||||
double m_dSplit ; // parametro a cui è stata splittata la cella
|
||||
int m_nDepth ; // profondit� della cella rispetto a root
|
||||
double m_dSplit ; // parametro a cui � stata splittata la cella
|
||||
int m_nChild1 ; // prima cella figlio
|
||||
int m_nChild2 ; // seconda cella figlio
|
||||
int m_nFlag ; // falg che indica la caratterizzazione della cella rispetto ai loop di trim
|
||||
// 0 esterna, 1 intersecata, 2 contiene un loop, 3 intersecata e contenente un loop, 4 contenuta in un loop
|
||||
int m_nFlag2 ; // falg che indica se la cella è stata attraversata durante l'ultima fase del labelling
|
||||
int m_nRightEdgeIn ; // 0 right edge fuori, 1 right edge dentro, 2 metà e metà
|
||||
bool m_bOnLeftEdge ; // flag che indica se la cella è sul lato sinistro ( per superfici chiuse sul parametro U)
|
||||
bool m_bOnTopEdge ; // flag che indica se la cella è sul lato top ( per superfici chiuse sul parametro V)
|
||||
std::vector<Inters> m_vInters ; // vettore delle intersezioni della cella con i loop di trim
|
||||
// ogni elemento del vettore è l'insieme dei punti che caratterizza un atrtaversamento della cella
|
||||
int m_nFlag2 ; // falg che indica se la cella � stata attraversata durante l'ultima fase del labelling
|
||||
int m_nRightEdgeIn ; // 0 right edge fuori, 1 right edge dentro, 2 met� e met�
|
||||
bool m_bOnLeftEdge ; // flag che indica se la cella � sul lato sinistro ( per superfici chiuse sul parametro U)
|
||||
bool m_bOnTopEdge ; // flag che indica se la cella � sul lato top ( per superfici chiuse sul parametro V)
|
||||
std::vector<Inters> m_vInters ; // vettore delle intersezioni della cella con i loop di trim
|
||||
// ogni elemento del vettore � l'insieme dei punti che caratterizza un atrtaversamento della cella
|
||||
|
||||
private :
|
||||
Point3d m_ptPbl ; // punto bottom left
|
||||
Point3d m_ptPtr ; // punto top right
|
||||
bool m_bProcessed ; // flag che indica se la cella è stata processata
|
||||
bool m_bSplitVert ; // flag che indica in quale direzione è stata divisa la cella
|
||||
bool m_bProcessed ; // flag che indica se la cella � stata processata
|
||||
bool m_bSplitVert ; // flag che indica in quale direzione � stata divisa la cella
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Tree
|
||||
{
|
||||
public :
|
||||
~Tree( void) ;
|
||||
Tree( void) ;
|
||||
Tree ( const SurfBezier* pSrfBz, const bool bSplitPatches = true, const Point3d ptMin = ORIG, const Point3d ptMax = ORIG) ;
|
||||
void SetSurf( const SurfBezier* pSrfBz, const bool bSplitPatches = true, const Point3d ptMin = ORIG, const Point3d ptMax = ORIG) ;
|
||||
bool GetIndependentTrees( std::vector<std::tuple<Point3d,Point3d>>& vTrees) ; // calcolo la suddivisione della superficie solo sulle singole bbox dei loop di trim ( unendo quelli vicini)
|
||||
bool BuildTree( const double& dLinTol = LIN_TOL_STD, const double& dSideMin = 1, const double& dSideMax = INFINITO) ; // dSideMax è il massimo per la dimensione maggiore di un triangolo della trimesh
|
||||
// dSideMin è lunghezza minima del lato di una cella nello spazio reale
|
||||
bool BuildTree_test( const double& dLinTol = LIN_TOL_STD, const double& dSideMin = 1, const double& dSideMax = INFINITO) ;
|
||||
bool GetPolygons( std::vector<POLYLINEVECTOR>& vPolygons) ;
|
||||
bool GetPolygonsBasic( POLYLINEVECTOR& vPolygons) ; // restituisce il poligono corrispondente ad ogni cella foglia dell'albero
|
||||
// ad ogni poligono sono stati aggiunti tutti i vertici dei vicini posizionati sui suoi lati
|
||||
bool GetLeaves ( std::vector<Cell>& vLeaves) const ;
|
||||
public :
|
||||
~Tree( void) ;
|
||||
Tree( void) ;
|
||||
Tree ( const SurfBezier* pSrfBz, bool bSplitPatches = true, const Point3d& ptMin = ORIG, const Point3d& ptMax = ORIG) ;
|
||||
void SetSurf( const SurfBezier* pSrfBz, bool bSplitPatches = true, const Point3d& ptMin = ORIG, const Point3d& ptMax = ORIG) ;
|
||||
bool GetIndependentTrees( BIPNTVECTOR& vTrees) ; // calcolo la suddivisione della superficie solo sulle singole bbox dei loop di trim ( unendo quelli vicini)
|
||||
bool BuildTree( double dLinTol = LIN_TOL_STD, double dSideMin = 1, double dSideMax = INFINITO) ; // dSideMax � il massimo per la dimensione maggiore di un triangolo della trimesh
|
||||
// dSideMin � lunghezza minima del lato di una cella nello spazio reale
|
||||
bool BuildTree_test( double dLinTol = LIN_TOL_STD, double dSideMin = 1, double dSideMax = INFINITO) ;
|
||||
bool GetPolygons( POLYLINEMATRIX& vPolygons) ;
|
||||
bool GetPolygonsBasic( POLYLINEVECTOR& vPolygons) ; // restituisce il poligono corrispondente ad ogni cella foglia dell'albero
|
||||
// ad ogni poligono sono stati aggiunti tutti i vertici dei vicini posizionati sui suoi lati
|
||||
bool GetLeaves ( std::vector<Cell>& vLeaves) const ; // restituisce gli indici delle foglie nell'albero
|
||||
void SetTestMode( void) { m_bTestMode = true ;} ; // attivando la test mode, per la costruzione dell'albero viene usata la funzione BuiltTree_test e viene corretta di conseguenza la FindCell
|
||||
|
||||
private :
|
||||
bool Split( const int& nId, const double& dSplitValue) ; // funzione di split di una cella al parametro indicato nella direzione data da bVert
|
||||
bool Split( const int& nId) ; // funzione di split di una cella dell'albero a metà nella direzione data da bVert
|
||||
void Balance () ; // creo rami in modo che tutte tutte le foglie abbiano come adiacenti foglie ad una profonditù di +- 1
|
||||
int GetHeightLeaves ( const int& nId, INTVECTOR& vnLeaves, int d = 0) const ; // altezza del subtree a partire dal nodo nId
|
||||
int GetDepth ( const int& nId, const int& nRef) const ; // livello del nodo nId
|
||||
void GetTopNeigh( const int& nId, INTVECTOR& vTopNeighs) const ; // restituisce le celle foglie che sono adiacenti al lato top
|
||||
void GetBottomNeigh( const int& nId, INTVECTOR& vBottomNeighs) const ; // restituisce le celle foglie che sono adiacenti al lato bottom
|
||||
void GetLeftNeigh( const int& nId, INTVECTOR& vLeftNeighs) const ; // restituisce le celle foglie che sono adiacenti al lato left
|
||||
void GetRightNeigh( const int& nId, INTVECTOR& vRightNeighs) const ; // restituisce le celle foglie che sono adiacenti al lato right
|
||||
void GetRootNeigh( const int& nEdge, INTVECTOR& vNeigh) ; // restituisce le foglie dell'albero che sono adiacenti al lato nEdge, numerato a partire dal top ( 0) in senso antiorario
|
||||
void ResetTree ( void) ; // resetto m_bProcessed a false per tutti i nodi dell'albero
|
||||
INTVECTOR FindCell ( const Point3d& ptToAssign, const CurveLine& cl) const ; // dato un punto, trova la cella foglia a cui appartiene
|
||||
INTVECTOR FindCell ( const Point3d& ptToAssign, const CurveLine& cl, INTVECTOR vCells) const ; // dato un punto, trova la cella foglia a cui appartiene
|
||||
bool TraceLoopLabelCell( const POLYLINEVECTOR& vplPolygons) ; // tracing dei loop e labelling delle celle
|
||||
bool FindInters( int& nId, const CurveLine& clTrim, PNTVECTOR& vptInters, bool bFirstInters = true) ; // trova le intersezioni tra una cella e una linea di trim
|
||||
// resituisce l'id della cella verso cui la curva di trim esce e il vettore delle intersezioni per la cella successiva con il primo punto
|
||||
bool CreateCellPolygons ( const int& nLeafId, std::vector<POLYLINEVECTOR>& vPolygons, INTVECTOR& vToCheck, int& nPoly, INTVECTOR& vnParentChunk, const PolyLine& plCell) ;
|
||||
bool CreateIslandAndHoles ( const int& nLeafId, std::vector<POLYLINEVECTOR>& vPolygons, int& nPoly, INTVECTOR& vnParentChunk) ;
|
||||
bool CheckIfBefore( const PolyLine& pl, const int& nEdge) const ;
|
||||
bool CheckIfBefore( const Inters& inA) const ;
|
||||
bool CheckIfBefore( const int& nEdge1, const Point3d& ptP1, const int& nEdge2, const Point3d& ptP2) const ; // punto 1 su edge 1 e punto 2 su edge 2, rispetto al lato 3
|
||||
bool CheckIfBefore( const int& nEdge, const Point3d& ptP1, const Point3d& ptP2, const int& nEdge2 = -1) const ; // entrambi i punti sullo stesso lato, nEdge. nEdge2 serve come backup, in caso nEdge sia un vertice.
|
||||
bool AreSameEdge( const int& nEdge1, const int nEdge2) const ;
|
||||
bool AddVertex( const int& nId, const std::vector<PNTVECTOR>& vEdgeVertex, PolyLine& plTrimmedPoly, int& c, const Point3d& ptToAdd) const ;
|
||||
//bool SetRightEdgeIn( int nId, std::vector<PNTVECTOR>& vEdgeVertex, PolyLine& plTrimmedPoly) ;
|
||||
bool SetRightEdgeIn( const int& nId) ;
|
||||
bool CategorizeCell( const int& nId) ;
|
||||
bool CheckIfBetween( const Inters& inA, const Inters& inB) const ;
|
||||
bool OnWhichEdge( const int& nId, const Point3d& ptToAssign, int& nEdge) const ;
|
||||
private :
|
||||
bool Split( int nId, double dSplitValue) ; // funzione di split di una cella al parametro indicato nella direzione data da bVert
|
||||
bool Split( int nId) ; // funzione di split di una cella dell'albero a met� nella direzione data da bVert
|
||||
void Balance( void) ; // creo rami in modo che tutte tutte le foglie abbiano come adiacenti foglie ad una profondit� di +- 1
|
||||
int GetHeightLeaves( int nId, INTVECTOR& vnLeaves, int d = 0) const ; // altezza del subtree a partire dal nodo nId
|
||||
int GetDepth( int nId, int nRef) const ; // livello del nodo nId
|
||||
void GetTopNeigh( int nId, INTVECTOR& vTopNeighs) const ; // restituisce le celle foglie che sono adiacenti al lato top
|
||||
void GetBottomNeigh( int nId, INTVECTOR& vBottomNeighs) const ; // restituisce le celle foglie che sono adiacenti al lato bottom
|
||||
void GetLeftNeigh( int nId, INTVECTOR& vLeftNeighs) const ; // restituisce le celle foglie che sono adiacenti al lato left
|
||||
void GetRightNeigh( int nId, INTVECTOR& vRightNeighs) const ; // restituisce le celle foglie che sono adiacenti al lato right
|
||||
void GetRootNeigh( int nEdge, INTVECTOR& vNeigh) ; // restituisce le foglie dell'albero che sono adiacenti al lato nEdge, numerato a partire dal top ( 0) in senso antiorario
|
||||
void ResetTree( void) ; // resetto m_bProcessed a false per tutti i nodi dell'albero
|
||||
INTVECTOR FindCell( const Point3d& ptToAssign, const CurveLine& cl, bool bRecurs = false) const ; // dato un punto, trova la cella foglia a cui appartiene
|
||||
INTVECTOR FindCell( const Point3d& ptToAssign, const CurveLine& cl, INTVECTOR vCells, bool bRecurs = false) const ; // dato un punto, trova la cella foglia a cui appartiene
|
||||
bool TraceLoopLabelCell( const POLYLINEVECTOR& vplPolygons) ; // tracing dei loop e labelling delle celle
|
||||
bool FindInters( int& nId, const CurveLine& clTrim, PNTVECTOR& vptInters, bool bFirstInters = true) ; // trova le intersezioni tra una cella e una linea di trim
|
||||
// resituisce l'id della cella verso cui la curva di trim esce e il vettore delle intersezioni per la cella successiva con il primo punto
|
||||
bool CreateCellPolygons( int nLeafId, POLYLINEMATRIX& vPolygons, INTVECTOR& vToCheck, int& nPoly, INTVECTOR& vnParentChunk, const PolyLine& plCell) ; // crea i poligoni della cella passata. richiede anche la funzione CreateIslandAndHoles per completare i poligoni.
|
||||
bool CreateIslandAndHoles( int nLeafId, POLYLINEMATRIX& vPolygons, int& nPoly, INTVECTOR& vnParentChunk) ; // ai poligoni generati da CreatePolygonsCell aggiunge i loop che creano isole o buchi all'interno della singola cella
|
||||
bool CheckIfBefore( const PolyLine& pl, int nEdge) const ; // controllo se ptEnd è prima di ptStart sul lato nEdge rispetto al senso antiorario
|
||||
bool CheckIfBefore( const Inters& inA) const ; // controlla se l'ingresso è prima dell'uscita in senso antiorario a partire da ptTR.
|
||||
bool CheckIfBefore( int nEdge1, const Point3d& ptP1, int nEdge2, const Point3d& ptP2) const ; // verifico quale punto viene prima tra pt1 e pt2 a partire da ptTR girando in senso CCW (punto 1 su edge 1 e punto 2 su edge 2, rispetto al lato 3)
|
||||
bool CheckIfBefore( int nEdge, const Point3d& ptP1, const Point3d& ptP2, int nEdge2 = -1) const ; // sul lato nEdge controllo se ptP1 viene prima di ptP2.
|
||||
bool AreSameEdge( int nEdge1, int nEdge2) const ; // indica se i due edge sono lo stesso. Un vertice adiacente ad un edge viene considerato uguale a questo edge
|
||||
bool AddVertex( int nId, const PNTMATRIX& vEdgeVertex, PolyLine& plTrimmedPoly, int& c, const Point3d& ptToAdd) const ; // aggiunge un punto ad un poligono in una cella, premurandosi di aggiungere eventualmente vertici o punti di celle vicine di cui tenere conto
|
||||
bool SetRightEdgeIn( int nId) ; // categorizza la cella in base all'edge destro per poter poi definire m_nFlag
|
||||
bool CategorizeCell( int nId) ; // categorizza la cella in base al flag m_nFlag (dentro, fuori, intersecata)
|
||||
bool CheckIfBetween( const Inters& inA, const Inters& inB) const ; // / controllo se inB è compreso tra l'end e lo start di inA (in senso CCW)
|
||||
bool OnWhichEdge( int nId, const Point3d& ptToAssign, int& nEdge) const ; // indica a quale edge o vertice il punto è vicino entro EPS_SMALL
|
||||
|
||||
private :
|
||||
const SurfBezier* m_pSrfBz ; // superficie di bezier
|
||||
DBLVECTOR m_vDim ; // distanze tra i vertici della superficie di bezier in 3d in ordine antiorario a partire da ptP00
|
||||
bool m_bTrimmed ; // superficie trimmata
|
||||
std::vector<INTVECTOR> m_vChunk ; // elenco dei loop divisi per chunk
|
||||
std::map<int,int> m_mChunk ;
|
||||
ICURVEPOVECTOR m_vLoop ; // curve di loop
|
||||
std::vector<std::tuple<PolyLine,bool>> m_vPlApprox ;
|
||||
bool m_bBilinear ; // superficie bilineare
|
||||
bool m_bMulti ; // superficie multi-patch
|
||||
bool m_bClosedU ; // superficie chiusa lungo il parametro U
|
||||
bool m_bClosedV ; // superficie chiusa lungo il parametro V
|
||||
bool m_bSplitPatches ; // flag che indica se le patches sono state divise prima della creazione dell'albero
|
||||
int m_nDegU ; // grado della superficie nel parametro U
|
||||
int m_nDegV ; // grado della superficie nel parametro V
|
||||
int m_nSpanU ;
|
||||
int m_nSpanV ;
|
||||
std::vector<POLYLINEVECTOR> m_vPolygons ; // vettore dei poligoni del tree
|
||||
std::map<int,Cell> m_mTree ; // mappa che contiene tutti i nodi e le foglie dell'albero. -2 è puntatore Null e -1 è root
|
||||
std::map<int,PNTVECTOR> m_mVert ; // mappa che contiene tutti i vertici 3d delle celle del tree. L'Id è lo stesso che la cella ha in m_mTree
|
||||
INTVECTOR m_vnLeaves ; // vettore delle foglie
|
||||
INTVECTOR m_vnParents ; // vettore delle celle ottenute dalla divisione preliminare in singole patch
|
||||
private :
|
||||
const SurfBezier* m_pSrfBz ; // superficie di bezier
|
||||
DBLVECTOR m_vDim ; // distanze tra i vertici della superficie di bezier in 3d in ordine antiorario a partire da ptP00
|
||||
bool m_bTrimmed ; // superficie trimmata
|
||||
INTMATRIX m_vChunk ; // elenco dei loop divisi per chunk
|
||||
std::map<int,int> m_mChunk ; // mappa in cui vengono salvati chunk di appartenza per ogni loop di trim
|
||||
ICURVEPOVECTOR m_vLoop ; // curve di loop
|
||||
std::vector<std::tuple<PolyLine,bool>> m_vPlApprox ; // vettore contenente le approssimazioni dei loop
|
||||
bool m_bBilinear ; // superficie bilineare
|
||||
bool m_bMulti ; // superficie multi-patch
|
||||
bool m_bClosedU ; // superficie chiusa lungo il parametro U
|
||||
bool m_bClosedV ; // superficie chiusa lungo il parametro V
|
||||
bool m_bSplitPatches ; // flag che indica se le patches sono state divise prima della creazione dell'albero
|
||||
int m_nDegU ; // grado della superficie nel parametro U
|
||||
int m_nDegV ; // grado della superficie nel parametro V
|
||||
int m_nSpanU ; // numero di span lungo il parametro U
|
||||
int m_nSpanV ; // numero di span lungo il parametro V
|
||||
POLYLINEMATRIX m_vPolygons ; // matrice dei poligoni del tree
|
||||
std::map<int,Cell> m_mTree ; // mappa che contiene tutti i nodi e le foglie dell'albero. -2 � puntatore Null e -1 � root
|
||||
std::map<int,PNTVECTOR> m_mVert ; // mappa che contiene tutti i vertici 3d delle celle del tree. L'Id � lo stesso che la cella ha in m_mTree
|
||||
INTVECTOR m_vnLeaves ; // vettore delle foglie
|
||||
INTVECTOR m_vnParents ; // vettore delle celle ottenute dalla divisione preliminare in singole patch
|
||||
bool m_bTestMode ; // bool che indica se la test mode è attiva
|
||||
} ;
|
||||
+5
-2
@@ -1930,9 +1930,12 @@ VolZmap::AvoidSurfTm( const ISurfTriMesh& tmSurf, double dSafeDist, bool bPrecis
|
||||
}
|
||||
// Intersezione della linea con triangolo eventualmente offsettato
|
||||
Point3d ptInt, ptInt2 ;
|
||||
if ( IntersLineTria( ptT, vtK, 1, trNewTria, ptInt, ptInt2, false) != IntLineTriaType::ILTT_NO) {
|
||||
int nIntLnTr = IntersLineTria( ptT, vtK, 1, trNewTria, ptInt, ptInt2, false) ;
|
||||
if ( nIntLnTr != ILTT_NO) {
|
||||
double dZmin = ( ptInt - ptT) * vtK ;
|
||||
double dZmax = ( ptInt2 - ptT) * vtK ;
|
||||
double dZmax = dZmin ;
|
||||
if ( nIntLnTr == ILTT_SEGM || nIntLnTr == ILTT_SEGM_ON_EDGE)
|
||||
dZmax = ( ptInt2 - ptT) * vtK ;
|
||||
for ( int nIndex = 0 ; nIndex < nSize ; nIndex += 1) {
|
||||
if ( dZmax > m_Values[0][nPos][nIndex].dMin - EPS_SMALL &&
|
||||
dZmin < m_Values[0][nPos][nIndex].dMax + EPS_SMALL)
|
||||
|
||||
+223
-161
@@ -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 ;
|
||||
@@ -115,25 +115,35 @@ Voronoi::AddCurve( const ICurve* pCrv)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// verifico se oggetto vroni è stato inizializzato
|
||||
if ( m_vroni == nullptr) {
|
||||
m_vroni = new( nothrow) vroniObject() ;
|
||||
m_vroni->apiInitializeProgram() ;
|
||||
}
|
||||
|
||||
// creo una copia della curva e la porto in locale
|
||||
PtrOwner<ICurve> pCrvLoc( pCrv->Clone()) ;
|
||||
if ( IsNull( pCrvLoc))
|
||||
return false ;
|
||||
pCrvLoc->ToLoc( m_Frame) ;
|
||||
|
||||
// aggiungo la curva in locale all'oggetto vroni
|
||||
if ( ! AddCurveToVroni( pCrvLoc))
|
||||
try {
|
||||
// verifico se oggetto vroni è stato inizializzato
|
||||
if ( m_vroni == nullptr) {
|
||||
m_vroni = new( nothrow) vroniObject() ;
|
||||
if ( m_vroni == nullptr)
|
||||
return false ;
|
||||
m_vroni->apiInitializeProgram() ;
|
||||
}
|
||||
|
||||
// aggiungo la curva in locale all'oggetto vroni
|
||||
if ( ! AddCurveToVroni( pCrvLoc))
|
||||
return false ;
|
||||
}
|
||||
catch (...) {
|
||||
LOG_ERROR( GetEGkLogger(), m_vroni->GetExceptionMessage()) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// aggiorno il box complessivo
|
||||
BBox3d bBox ;
|
||||
pCrvLoc->GetLocalBBox( bBox) ;
|
||||
m_bBox.Add( bBox) ;
|
||||
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -162,21 +172,31 @@ Voronoi::AddSurfFlatRegion( const ISurfFlatRegion* pSfr)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// verifico se oggetto vroni è stato inizializzato
|
||||
if ( m_vroni == nullptr) {
|
||||
m_vroni = new( nothrow) vroniObject() ;
|
||||
m_vroni->apiInitializeProgram() ;
|
||||
}
|
||||
|
||||
// aggiungo le curve di loop
|
||||
for ( int i = 0 ; i < pSfr->GetChunkCount() ; i ++) {
|
||||
for ( int j = 0 ; j < pSfr->GetLoopCount( i) ; j ++) {
|
||||
PtrOwner<ICurve> pCrvLoc( pSfr->GetLoop( i, j)) ;
|
||||
pCrvLoc->ToLoc( m_Frame) ;
|
||||
if ( ! AddCurveToVroni( pCrvLoc))
|
||||
try {
|
||||
// verifico se oggetto vroni è stato inizializzato
|
||||
if ( m_vroni == nullptr) {
|
||||
m_vroni = new( nothrow) vroniObject() ;
|
||||
if ( m_vroni == nullptr)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
m_vroni->apiInitializeProgram() ;
|
||||
}
|
||||
|
||||
// aggiungo le curve di loop
|
||||
for ( int i = 0 ; i < pSfr->GetChunkCount() ; i ++) {
|
||||
for ( int j = 0 ; j < pSfr->GetLoopCount( i) ; j ++) {
|
||||
PtrOwner<ICurve> pCrvLoc( pSfr->GetLoop( i, j)) ;
|
||||
if ( IsNull( pCrvLoc))
|
||||
return false ;
|
||||
pCrvLoc->ToLoc( m_Frame) ;
|
||||
if ( ! AddCurveToVroni( pCrvLoc))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
LOG_ERROR( GetEGkLogger(), m_vroni->GetExceptionMessage())
|
||||
return false ;
|
||||
}
|
||||
|
||||
// aggiorno il box complessivo
|
||||
BBox3d bBox ;
|
||||
@@ -184,7 +204,7 @@ Voronoi::AddSurfFlatRegion( const ISurfFlatRegion* pSfr)
|
||||
frSrf.Invert() ;
|
||||
pSfr->GetBBox( frSrf, bBox) ;
|
||||
m_bBox.Add( bBox) ;
|
||||
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -225,8 +245,9 @@ Voronoi::AddLineToVroni( const ICurveLine* pLine, int& nVroniCrv, int nLoopId, i
|
||||
{
|
||||
if ( pLine == nullptr)
|
||||
return false ;
|
||||
|
||||
// verifico se il punto finale viene forzato oppure deve essere ricavato dalla pLine
|
||||
if ( ! ptEnd.IsValid()) {
|
||||
// recupero end point
|
||||
if ( ! pLine->GetEndPoint( ptEnd))
|
||||
return false ;
|
||||
}
|
||||
@@ -244,7 +265,7 @@ Voronoi::AddArcToVroni( const ICurveArc* pArc, int& nVroniCrv, int nLoopId, int
|
||||
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
int nArcSiteType = ( dAngCen > EPS_SMALL ? ARC : -ARC ) ;
|
||||
int nArcSiteType = ( dAngCen > 0 ? ARC : -ARC ) ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
if ( AreOppositeVectorApprox( vtN, Z_AX))
|
||||
nArcSiteType *= -1 ;
|
||||
@@ -260,8 +281,8 @@ Voronoi::AddArcToVroni( const ICurveArc* pArc, int& nVroniCrv, int nLoopId, int
|
||||
m_vroni->AddArc( &nVroniCrv, ptStart.x, ptStart.y, ptCen.x, ptCen.y, nArcSiteType, {nLoopId, nCrvId}) ;
|
||||
}
|
||||
else {
|
||||
// verifico se il punto finale viene forzato oppure deve essere ricavato dal pArc
|
||||
if ( ! ptEnd.IsValid()) {
|
||||
// recupero end point dalla curva
|
||||
if ( ! pArc->GetEndPoint( ptEnd))
|
||||
return false ;
|
||||
}
|
||||
@@ -362,8 +383,10 @@ Voronoi::CalcVoronoi( int nBound)
|
||||
if ( m_bVDComputed)
|
||||
m_vroni->ResetVoronoiDiagram() ;
|
||||
|
||||
// come valore minimo per il bound considero quello standard di vroni
|
||||
m_nBound = max( nBound, VORONOI_STD_BOUND) ;
|
||||
|
||||
// calcolo
|
||||
m_nBound = nBound ;
|
||||
m_bVDComputed = true ;
|
||||
string sTmp = "" ;
|
||||
m_vroni->apiComputeVD( false, true, false, m_nBound, 0, 0, &sTmp[0], false, false, false, &sTmp[0], true) ;
|
||||
@@ -377,65 +400,85 @@ Voronoi::GetBisectorCurve( int i)
|
||||
{
|
||||
if ( i >= m_vroni->GetNumberOfEdges())
|
||||
return nullptr ;
|
||||
|
||||
// recupero estremi del bisettore
|
||||
Point3d ptS, ptE ;
|
||||
m_vroni->GetVDBisectorPoints( i, ptS.v, ptE.v) ;
|
||||
if ( AreSamePointApprox( ptS, ptE))
|
||||
return nullptr ;
|
||||
|
||||
// recupero parametri del bisettore
|
||||
double dParS, dParE ;
|
||||
m_vroni->GetVDBisectorParams( i, dParS, dParE) ;
|
||||
|
||||
// eventuale inversione
|
||||
if ( dParS > dParE + EPS_SMALL) {
|
||||
swap( dParS, dParE) ;
|
||||
swap( ptS, ptE) ;
|
||||
}
|
||||
|
||||
// costruisco la curva
|
||||
int nType = m_vroni->GetVDBisectorType( i) ;
|
||||
if ( nType == LINE) {
|
||||
|
||||
// identifico il tipo di bisettore
|
||||
int nType = m_vroni->GetBisectorType( i) ;
|
||||
|
||||
// linea
|
||||
if ( nType == BisectorType::LINE) {
|
||||
// recupero i dati del bisettore da vroni
|
||||
Point3d ptS, ptE ;
|
||||
double dParS, dParE ;
|
||||
m_vroni->GetLinearBisectorData( i, ptS.v, ptE.v, dParS, dParE) ;
|
||||
// creo la linea
|
||||
CurveLine* pLine = CreateBasicCurveLine() ;
|
||||
if ( pLine == nullptr)
|
||||
return nullptr ;
|
||||
pLine->Set( ptS, ptE) ;
|
||||
pLine->ToGlob( m_Frame) ;
|
||||
// salvo le distanze nei suoi estremi come TempParam
|
||||
pLine->SetTempParam( dParS, 0) ;
|
||||
pLine->SetTempParam( dParE, 1) ;
|
||||
pLine->ToGlob( m_Frame) ;
|
||||
return pLine ;
|
||||
}
|
||||
else if ( nType != NONE) {
|
||||
// creo una composita campionando il bisettore
|
||||
|
||||
// degenerate hyperellipse ( arco)
|
||||
else if ( nType == BisectorType::DEGENERATE_HYPERELL) {
|
||||
// recupero i dati del bisettore da vroni
|
||||
Point3d ptS, ptE, ptC ;
|
||||
double dParS, dParE ;
|
||||
m_vroni->GetDegenerateHyperEllipticBisectorData( i, ptS.v, ptE.v, ptC.v, dParS, dParE) ;
|
||||
// creo arco
|
||||
CurveArc* pArc = CreateBasicCurveArc() ;
|
||||
if ( pArc == nullptr)
|
||||
return nullptr ;
|
||||
pArc->SetC2P( ptC, ptS, ptE) ;
|
||||
pArc->SetTempParam( dParS, 0) ;
|
||||
pArc->SetTempParam( dParS, 1) ;
|
||||
pArc->ToGlob( m_Frame) ;
|
||||
return pArc ;
|
||||
}
|
||||
|
||||
// bisettore generico
|
||||
else if ( nType != BisectorType::NONE) {
|
||||
// approssimo linearmente il bisettore
|
||||
int nPoints = m_vroni->GetApproxedBisectorPointsNbr( i) ;
|
||||
if ( nPoints < 2)
|
||||
return nullptr ;
|
||||
|
||||
CurveComposite* pCompo = CreateBasicCurveComposite() ;
|
||||
if ( pCompo == nullptr)
|
||||
return nullptr ;
|
||||
int nMaxPnts = 100 ;
|
||||
double dDelta = ( dParE - dParS) / nMaxPnts ;
|
||||
pCompo->AddPoint( ptS) ;
|
||||
for ( int j = 1 ; j < nMaxPnts ; j ++) {
|
||||
Point3d ptP ;
|
||||
m_vroni->GetVDBisectorPointAtParam( i, dParS + j * dDelta, ptP.v) ;
|
||||
if ( pCompo->AddLine( ptP)) {
|
||||
// salvo le distanze dalla curva nei suoi estremi come temp param
|
||||
pCompo->SetCurveTempParam( pCompo->GetCurveCount() - 1, dParS + ( j - 1) * dDelta, 0) ;
|
||||
pCompo->SetCurveTempParam( pCompo->GetCurveCount() - 1, dParS + j * dDelta, 1) ;
|
||||
}
|
||||
}
|
||||
// ultimo punto
|
||||
if ( pCompo->AddLine( ptE)) {
|
||||
pCompo->SetCurveTempParam( pCompo->GetCurveCount() - 1, dParS + ( nMaxPnts - 1) * dDelta, 0) ;
|
||||
pCompo->SetCurveTempParam( pCompo->GetCurveCount() - 1, dParE, 1) ;
|
||||
return nullptr ;
|
||||
|
||||
// punto iniziale
|
||||
Point3d pt ;
|
||||
double dParS ;
|
||||
m_vroni->GetApproxedBisectorPoint( i, 0, pt.v, dParS) ;
|
||||
pCompo->AddPoint( pt) ;
|
||||
int nCrvCount = 0 ;
|
||||
|
||||
double dParPrev = dParS ;
|
||||
for ( int j = 1 ; j < nPoints ; j ++) {
|
||||
double dPar ;
|
||||
m_vroni->GetApproxedBisectorPoint( i, j, pt.v, dPar) ;
|
||||
if ( pCompo->AddLine( pt)) {
|
||||
// setto i parametri sulla sottocurva
|
||||
pCompo->SetCurveTempParam( nCrvCount, dParPrev, 0) ;
|
||||
pCompo->SetCurveTempParam( nCrvCount, dPar, 1) ;
|
||||
// aggiorno parametro precedente
|
||||
dParPrev = dPar ;
|
||||
nCrvCount ++ ;
|
||||
}
|
||||
}
|
||||
|
||||
// setto parametri sulla curva
|
||||
pCompo->SetTempParam( dParS, 0) ;
|
||||
pCompo->SetTempParam( dParE, 1) ;
|
||||
pCompo->ToGlob( m_Frame) ;
|
||||
return pCompo ;
|
||||
pCompo->SetTempParam( dParPrev, 1) ;
|
||||
|
||||
pCompo->ToGlob( m_Frame) ;
|
||||
return pCompo ;
|
||||
}
|
||||
else
|
||||
return nullptr ;
|
||||
|
||||
return nullptr ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -447,15 +490,21 @@ Voronoi::CalcVoronoiDiagram( ICURVEPOVECTOR& vCrvs, int nBound)
|
||||
if ( ! IsValid())
|
||||
return false ;
|
||||
|
||||
// verifico se necessario calcolo Voronoi
|
||||
if ( ! m_bVDComputed || nBound != m_nBound)
|
||||
CalcVoronoi( nBound) ;
|
||||
try {
|
||||
// verifico se necessario calcolo Voronoi
|
||||
if ( ! m_bVDComputed || nBound != m_nBound)
|
||||
CalcVoronoi( nBound) ;
|
||||
|
||||
for ( int i = 4 ; i < m_vroni->GetNumberOfEdges() ; i ++) {
|
||||
// recupero la curva del bisettore
|
||||
PtrOwner<ICurve> pCrv( GetBisectorCurve( i)) ;
|
||||
if ( ! IsNull( pCrv))
|
||||
vCrvs.emplace_back( Release( pCrv)) ;
|
||||
for ( int i = 4 ; i < m_vroni->GetNumberOfEdges() ; i ++) {
|
||||
// recupero la curva del bisettore
|
||||
PtrOwner<ICurve> pCrv( GetBisectorCurve( i)) ;
|
||||
if ( ! IsNull( pCrv) && pCrv->IsValid())
|
||||
vCrvs.emplace_back( Release( pCrv)) ;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
LOG_ERROR( GetEGkLogger(), m_vroni->GetExceptionMessage()) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -469,10 +518,7 @@ Voronoi::CalcMedialAxis( ICURVEPOVECTOR& vCrvs, int nSide)
|
||||
|
||||
if ( ! IsValid())
|
||||
return false ;
|
||||
|
||||
if ( ! m_bVDComputed)
|
||||
CalcVoronoi() ;
|
||||
|
||||
|
||||
// lato per il medial axis
|
||||
bool bLeft = true ;
|
||||
bool bRight = true ;
|
||||
@@ -481,18 +527,28 @@ Voronoi::CalcMedialAxis( ICURVEPOVECTOR& vCrvs, int nSide)
|
||||
else if ( nSide == WMAT_RIGHT)
|
||||
bLeft = false ;
|
||||
|
||||
// calcolo medial axis
|
||||
m_vroni->apiComputeWMAT( false, 0.0, 0.0, false, bLeft, bRight) ;
|
||||
|
||||
for ( int i = 4 ; i < m_vroni->GetNumberOfEdges() ; i ++) {
|
||||
// verifico se il lato appartiene al medial axis
|
||||
if ( m_vroni->IsWMATEdge( i)) {
|
||||
PtrOwner<ICurve> pCrv( GetBisectorCurve( i)) ;
|
||||
if ( ! IsNull( pCrv))
|
||||
vCrvs.emplace_back( Release( pCrv)) ;
|
||||
}
|
||||
try {
|
||||
if ( ! m_bVDComputed)
|
||||
CalcVoronoi() ;
|
||||
|
||||
// calcolo medial axis
|
||||
m_vroni->apiComputeWMAT( false, 0.0, 0.0, false, bLeft, bRight) ;
|
||||
|
||||
for ( int i = 4 ; i < m_vroni->GetNumberOfEdges() ; i ++) {
|
||||
// verifico se il lato appartiene al medial axis
|
||||
if ( m_vroni->IsWMATEdge( i)) {
|
||||
PtrOwner<ICurve> pCrv( GetBisectorCurve( i)) ;
|
||||
if ( ! IsNull( pCrv) && pCrv->IsValid())
|
||||
vCrvs.emplace_back( Release( pCrv)) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
catch (...) {
|
||||
LOG_ERROR( GetEGkLogger(), m_vroni->GetExceptionMessage()) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -539,20 +595,21 @@ Voronoi::CalcOffset( ICURVEPOVECTOR& vOffs, double dOffs, int nType)
|
||||
if ( pCrv->IsValid()) {
|
||||
// eventuale inversione
|
||||
if ( dOffs > EPS_SMALL)
|
||||
pCrv->Invert() ;
|
||||
|
||||
pCrv->Invert() ;
|
||||
|
||||
// sistemo i raccordi
|
||||
if ( ( nType & ICurve::OFF_CHAMFER) != 0 || ( nType & ICurve::OFF_EXTEND) != 0) {
|
||||
IdentifyFillets( pCrv, dOffs) ;
|
||||
AdjustCurveFillets( pCrv, dOffs, nType) ;
|
||||
}
|
||||
|
||||
if ( bClosed) {
|
||||
// forzo chiusura della curva per evitare piccole imprecisioni
|
||||
pCrv->Close() ;
|
||||
// sistemo il punto di inizio
|
||||
AdjustOffsetStart( *pCrv) ;
|
||||
}
|
||||
|
||||
// sistemo i raccordi
|
||||
if ( ( nType & ICurve::OFF_CHAMFER) != 0 || ( nType & ICurve::OFF_EXTEND) != 0) {
|
||||
IdentifyFillets( pCrv, dOffs) ;
|
||||
AdjustCurveFillets( pCrv, dOffs, nType) ;
|
||||
}
|
||||
|
||||
// porto nel frame globale
|
||||
pCrv->ToGlob( m_Frame) ;
|
||||
// unisco le parti allineate
|
||||
@@ -640,75 +697,81 @@ Voronoi::CalcVroniOffset( ICRVCOMPOPLIST& OffsList, double dOffs, bool bRightOff
|
||||
nOrigCrvCnt = pOrigCompo->GetCurveCount() ;
|
||||
}
|
||||
|
||||
// reset di eventuali offset precedenti
|
||||
m_vroni->apiResetOffsetData() ;
|
||||
|
||||
// verifico necessario calcolo o ricalcolo di Voronoi
|
||||
UpdateVoronoi( dOffs) ;
|
||||
|
||||
string sTmp = "" ;
|
||||
m_vroni->apiComputeOff( false, &sTmp[0], false, false, dOffs, 0.0, false, bLeftOffs, bRightOffs) ;
|
||||
int nOffsCnt = m_vroni->GetOffsetCount() ;
|
||||
if ( nOffsCnt == 0) {
|
||||
// se non ho ottenuto offset ritento con valore leggermente diverso per le tolleranze di vroni
|
||||
try {
|
||||
// reset di eventuali offset precedenti
|
||||
m_vroni->apiResetOffsetData() ;
|
||||
m_vroni->apiComputeOff( false, &sTmp[0], false, false, dOffs - VRONI_OFFS_TOL, 0.0, false, bLeftOffs, bRightOffs) ;
|
||||
nOffsCnt = m_vroni->GetOffsetCount() ;
|
||||
}
|
||||
|
||||
// recupero le curve di offset da vroni
|
||||
for ( int i = 0 ; i < nOffsCnt ; i++) {
|
||||
PtrOwner<CurveComposite> pCrvOffs ( CreateBasicCurveComposite()) ;
|
||||
int nCrvCnt = m_vroni->GetOffsetCurveCount( i) ; // numero di sottocurve
|
||||
// verifico necessario calcolo o ricalcolo di Voronoi
|
||||
UpdateVoronoi( dOffs) ;
|
||||
|
||||
for ( int j = 0 ; j < nCrvCnt ; j ++) {
|
||||
// recupero la sottocurva da vroni
|
||||
Point3d ptS, ptE, ptC ;
|
||||
int nType ;
|
||||
int nOrigCrv, nOrigLoop, nOrigPnt ; // sito
|
||||
m_vroni->GetOffsetCurve( i, j, nType, ptS.v, ptE.v, ptC.v, nOrigLoop, nOrigCrv, nOrigPnt) ;
|
||||
|
||||
if ( j == 0)
|
||||
pCrvOffs->AddPoint( ptS) ;
|
||||
|
||||
bool bOk = false ;
|
||||
if ( nType == t_site::SEG)
|
||||
bOk = pCrvOffs->AddLine( ptE) ;
|
||||
else {
|
||||
PtrOwner<CurveArc> pArc( CreateBasicCurveArc()) ;
|
||||
pArc->Set2PRS( ptS, ptE, Dist( ptC, ptS), nType == CCW) ;
|
||||
bOk = pCrvOffs->AddCurve( Release( pArc)) ;
|
||||
}
|
||||
|
||||
// se la curva è stata aggiunta
|
||||
if ( bOk) {
|
||||
// setto come info la sottocurva da cui si è generata
|
||||
int nCurrCrvId = pCrvOffs->GetCurveCount() - 1 ;
|
||||
pCrvOffs->SetCurveTempProp( nCurrCrvId, nOrigCrv + 1, 0) ;
|
||||
pCrvOffs->SetCurveTempProp( nCurrCrvId, nOrigLoop, 1) ;
|
||||
// verifico se è raccordo relativo agli estremi della curva
|
||||
if ( nOrigCrv == -1 && ( nOrigPnt == 0 || nOrigPnt == nOrigCrvCnt))
|
||||
pCrvOffs->SetCurveTempParam( nCurrCrvId, 1.0, 0) ;
|
||||
}
|
||||
string sTmp = "" ;
|
||||
m_vroni->apiComputeOff( false, &sTmp[0], false, false, dOffs, 0.0, false, bLeftOffs, bRightOffs) ;
|
||||
int nOffsCnt = m_vroni->GetOffsetCount() ;
|
||||
if ( nOffsCnt == 0) {
|
||||
// se non ho ottenuto offset ritento con valore leggermente diverso per le tolleranze di vroni
|
||||
m_vroni->apiResetOffsetData() ;
|
||||
m_vroni->apiComputeOff( false, &sTmp[0], false, false, dOffs - VRONI_OFFS_TOL, 0.0, false, bLeftOffs, bRightOffs) ;
|
||||
nOffsCnt = m_vroni->GetOffsetCount() ;
|
||||
}
|
||||
|
||||
// rimuovo tratti di lunghezza inferiore a 5 * EPS_SMALL
|
||||
RemoveCurveSmallParts( pCrvOffs, 5 * EPS_SMALL) ;
|
||||
// recupero le curve di offset da vroni
|
||||
for ( int i = 0 ; i < nOffsCnt ; i++) {
|
||||
PtrOwner<CurveComposite> pCrvOffs ( CreateBasicCurveComposite()) ;
|
||||
int nCrvCnt = m_vroni->GetOffsetCurveCount( i) ; // numero di sottocurve
|
||||
|
||||
// aggiungo la curva alla lista degli offset
|
||||
if ( ! IsNull( pCrvOffs) && pCrvOffs->IsValid())
|
||||
OffsList.push_back( Release( pCrvOffs)) ;
|
||||
for ( int j = 0 ; j < nCrvCnt ; j ++) {
|
||||
// recupero la sottocurva da vroni
|
||||
Point3d ptS, ptE, ptC ;
|
||||
int nType ;
|
||||
int nOrigCrv, nOrigLoop, nOrigPnt ; // sito
|
||||
m_vroni->GetOffsetCurve( i, j, nType, ptS.v, ptE.v, ptC.v, nOrigLoop, nOrigCrv, nOrigPnt) ;
|
||||
|
||||
if ( j == 0)
|
||||
pCrvOffs->AddPoint( ptS) ;
|
||||
|
||||
bool bOk = false ;
|
||||
if ( nType == t_site::SEG)
|
||||
bOk = pCrvOffs->AddLine( ptE) ;
|
||||
else {
|
||||
PtrOwner<CurveArc> pArc( CreateBasicCurveArc()) ;
|
||||
pArc->Set2PRS( ptS, ptE, Dist( ptC, ptS), nType == CCW) ;
|
||||
bOk = pCrvOffs->AddCurve( Release( pArc)) ;
|
||||
}
|
||||
|
||||
// se la curva è stata aggiunta
|
||||
if ( bOk) {
|
||||
// setto come info la sottocurva da cui si è generata
|
||||
int nCurrCrvId = pCrvOffs->GetCurveCount() - 1 ;
|
||||
pCrvOffs->SetCurveTempProp( nCurrCrvId, nOrigCrv + 1, 0) ;
|
||||
pCrvOffs->SetCurveTempProp( nCurrCrvId, nOrigLoop, 1) ;
|
||||
// verifico se è raccordo relativo agli estremi della curva
|
||||
if ( nOrigCrv == -1 && ( nOrigPnt == 0 || nOrigPnt == nOrigCrvCnt))
|
||||
pCrvOffs->SetCurveTempParam( nCurrCrvId, 1.0, 0) ;
|
||||
}
|
||||
}
|
||||
|
||||
// rimuovo tratti di lunghezza inferiore a 5 * EPS_SMALL
|
||||
RemoveCurveSmallParts( pCrvOffs, 5 * EPS_SMALL) ;
|
||||
|
||||
// aggiungo la curva alla lista degli offset
|
||||
if ( ! IsNull( pCrvOffs) && pCrvOffs->IsValid())
|
||||
OffsList.push_back( Release( pCrvOffs)) ;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
LOG_ERROR( GetEGkLogger(), m_vroni->GetExceptionMessage()) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Voronoi::UpdateVoronoi( double dOffs)
|
||||
{
|
||||
double dNeededBound = abs( dOffs) / 0.49 / sqrt( m_bBox.GetDimX() * m_bBox.GetDimX() + m_bBox.GetDimY() * m_bBox.GetDimY()) ;
|
||||
// calcolo il bound necessario per l'offset desiderato
|
||||
double dNeededBound = abs( dOffs) / 0.49 / sqrt( m_bBox.GetDimX() * m_bBox.GetDimX() + m_bBox.GetDimY() * m_bBox.GetDimY()) ;
|
||||
if ( ! m_bVDComputed || dNeededBound > m_nBound) {
|
||||
// aggiorno il valore del bound
|
||||
int nBound = ( int)( ceil( dNeededBound) + 0.5) ;
|
||||
@@ -717,7 +780,6 @@ Voronoi::UpdateVoronoi( double dOffs)
|
||||
}
|
||||
|
||||
return true ;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -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-9 ;
|
||||
|
||||
//-------------------------- 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
|
||||
} ;
|
||||
@@ -263,11 +263,8 @@ void Earcut<N>::earcutLinked(Node* ear, int pass) {
|
||||
Node* prev;
|
||||
Node* next;
|
||||
|
||||
int iterations = 0;
|
||||
|
||||
// iterate through ears, slicing them one by one
|
||||
while (ear->prev != ear->next) {
|
||||
iterations++;
|
||||
prev = ear->prev;
|
||||
next = ear->next;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user