Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtGeomKernel
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 ;
|
||||
|
||||
+4
-8
@@ -832,8 +832,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 ;
|
||||
@@ -1188,8 +1187,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 +1213,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 +1261,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))
|
||||
|
||||
@@ -211,7 +211,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 :
|
||||
|
||||
+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.
+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
-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 ;
|
||||
|
||||
+10
-10
@@ -85,7 +85,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)
|
||||
@@ -171,15 +171,15 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
if ( ! bUseVoronoi) {
|
||||
|
||||
// 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 +187,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 +437,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 +656,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) ;
|
||||
|
||||
+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 ;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-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 ;
|
||||
@@ -683,7 +674,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 ;
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -114,7 +114,7 @@ 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 ;
|
||||
@@ -187,7 +187,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 +197,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 +227,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 +243,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() ;
|
||||
|
||||
+25
-10
@@ -440,6 +440,12 @@ GetSurfTriMeshSharpRectSwept( double dDimH, double dDimV, const ICurve* pGuide,
|
||||
static ISurfTriMesh*
|
||||
GetSurfTriMeshBeveledRectSwept( double dDimH, double dDimV, double dBevelH, double dBevelV, const ICurve* pGuide, int nCapType, double dLinTol)
|
||||
{
|
||||
// imposto metodo di calcolo
|
||||
bool bUseVoronoi = false ;
|
||||
#ifdef _VRONI
|
||||
bUseVoronoi = true ;
|
||||
#endif // _VRONI
|
||||
|
||||
// verifico che la linea guida sia piana
|
||||
Plane3d plGuide ;
|
||||
if ( ! pGuide->IsFlat( plGuide, false, 10 * EPS_SMALL))
|
||||
@@ -456,19 +462,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 ( ! bUseVoronoi) {
|
||||
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) ;
|
||||
|
||||
+35
-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 ;
|
||||
@@ -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,36 +1497,32 @@ 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) ;
|
||||
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) ; // per debug
|
||||
//
|
||||
//Tree.BuildTree( 5 * LIN_TOL_FINE, 0.1) ; // per ENDER
|
||||
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///////////////////
|
||||
|
||||
PtrOwner<SurfTriMesh> pSrfTm( CreateBasicSurfTriMesh()) ;
|
||||
StmFromTriangleSoup stmSoup ;
|
||||
if ( ! stmSoup.Start())
|
||||
return nullptr ;
|
||||
@@ -1567,24 +1563,20 @@ 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() ; // per debug
|
||||
Tree.BuildTree( 5 * LIN_TOL_FINE, 1) ; // per debug
|
||||
//Tree.BuildTree( 5 * LIN_TOL_FINE, 0.1) ; // per ENDER
|
||||
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
-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 ;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -256,14 +256,14 @@ IsVertex( PNTULIST& PointList, PNTULIST::const_iterator itCurr)
|
||||
{
|
||||
// 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,12 +14,13 @@
|
||||
#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 ;
|
||||
@@ -27,13 +28,14 @@ struct Inters {
|
||||
bool bCCW ;
|
||||
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) ;
|
||||
@@ -50,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
|
||||
@@ -85,23 +89,42 @@ 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)
|
||||
: 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) {}
|
||||
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
|
||||
@@ -110,94 +133,93 @@ 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 ;
|
||||
|
||||
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, bool bRecurs = false) 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) 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) ;
|
||||
bool CreateIslandAndHoles( int nLeafId, POLYLINEMATRIX& vPolygons, int& nPoly, INTVECTOR& vnParentChunk) ;
|
||||
bool CheckIfBefore( const PolyLine& pl, int nEdge) const ;
|
||||
bool CheckIfBefore( const Inters& inA) const ;
|
||||
bool CheckIfBefore( int nEdge1, const Point3d& ptP1, int nEdge2, const Point3d& ptP2) const ; // 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 ; // entrambi i punti sullo stesso lato, nEdge. nEdge2 serve come backup, in caso nEdge sia un vertice.
|
||||
bool AreSameEdge( int nEdge1, int nEdge2) const ;
|
||||
bool AddVertex( int nId, const PNTMATRIX& vEdgeVertex, PolyLine& plTrimmedPoly, int& c, const Point3d& ptToAdd) const ;
|
||||
bool SetRightEdgeIn( int nId) ;
|
||||
bool CategorizeCell( int nId) ;
|
||||
bool CheckIfBetween( const Inters& inA, const Inters& inB) const ;
|
||||
bool OnWhichEdge( int nId, const Point3d& ptToAssign, int& nEdge) const ;
|
||||
|
||||
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 ;
|
||||
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 ;
|
||||
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
|
||||
} ;
|
||||
+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)
|
||||
|
||||
+69
-49
@@ -244,7 +244,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 ;
|
||||
@@ -377,65 +377,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 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -454,7 +474,7 @@ Voronoi::CalcVoronoiDiagram( ICURVEPOVECTOR& vCrvs, int nBound)
|
||||
for ( int i = 4 ; i < m_vroni->GetNumberOfEdges() ; i ++) {
|
||||
// recupero la curva del bisettore
|
||||
PtrOwner<ICurve> pCrv( GetBisectorCurve( i)) ;
|
||||
if ( ! IsNull( pCrv))
|
||||
if ( ! IsNull( pCrv) && pCrv->IsValid())
|
||||
vCrvs.emplace_back( Release( pCrv)) ;
|
||||
}
|
||||
|
||||
@@ -488,7 +508,7 @@ Voronoi::CalcMedialAxis( ICURVEPOVECTOR& vCrvs, int nSide)
|
||||
// verifico se il lato appartiene al medial axis
|
||||
if ( m_vroni->IsWMATEdge( i)) {
|
||||
PtrOwner<ICurve> pCrv( GetBisectorCurve( i)) ;
|
||||
if ( ! IsNull( pCrv))
|
||||
if ( ! IsNull( pCrv) && pCrv->IsValid())
|
||||
vCrvs.emplace_back( Release( pCrv)) ;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user