Compare commits
289 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e924113d3 | |||
| dcc3fc772a | |||
| a48f373e4d | |||
| 2ed2a34d55 | |||
| fcbdee1dba | |||
| 33d1ef4123 | |||
| fe2aba43e5 | |||
| c0b5f38301 | |||
| 1c157f323e | |||
| 3e6aa0d81b | |||
| 34089648b0 | |||
| 0bef1638d0 | |||
| 17759877d4 | |||
| d00064a671 | |||
| dc91f932f7 | |||
| d911862c84 | |||
| 1b025ec60e | |||
| 9d18e1a9ba | |||
| 3a8900983a | |||
| 971a76e473 | |||
| 35c019a03e | |||
| de97f249a2 | |||
| 81f0cc23bf | |||
| 8a0234093e | |||
| 88d355f2f7 | |||
| 20fd06d67c | |||
| 52f2785e67 | |||
| 2e2bd0ceec | |||
| e4c3c9a2a4 | |||
| e490c173e8 | |||
| 7e165a6dea | |||
| 49ff6e79a8 | |||
| 1160e3d067 | |||
| 91d667bcfc | |||
| b23df89cd3 | |||
| cf9737a48e | |||
| ae52115bda | |||
| 3dd9466938 | |||
| c0f7eb6727 | |||
| 76e2843ed3 | |||
| faa2004c29 | |||
| c9a59dc5ea | |||
| aaaf951990 | |||
| cc263089ca | |||
| d99b8f4c86 | |||
| f5e5441469 | |||
| 4206a4822f | |||
| 788a5bc4eb | |||
| a5a96c2bb5 | |||
| 881691e678 | |||
| 80f4d64ad4 | |||
| 7d9a641e39 | |||
| d82ccd8947 | |||
| 318b1e4b2f | |||
| 583e30170a | |||
| fe46b8ebd2 | |||
| 6a845e4f81 | |||
| 46e18b3977 | |||
| 20d146268b | |||
| 5013fc2b6c | |||
| 32a0e1d2b5 | |||
| 7ce9e7e26c | |||
| 9a6e972521 | |||
| 8c008f36c2 | |||
| eae29d4854 | |||
| 2bd53476ca | |||
| 015065f3c8 | |||
| 12862a6c76 | |||
| 9d869411e8 | |||
| 0c3c17e0f4 | |||
| 47f6eedd9c | |||
| b36adefd10 | |||
| 8cf8c0def5 | |||
| 1e6a70c60d | |||
| 9712e8c526 | |||
| 6b1f932dfc | |||
| 7882964b26 | |||
| 9653ba8d53 | |||
| ba66891539 | |||
| 4ab4a2fc81 | |||
| a6d9811595 | |||
| c94a62f5b2 | |||
| 535011072d | |||
| 718f5ce716 | |||
| 3f02119ef7 | |||
| 632b711b2a | |||
| 07faeaaa11 | |||
| 104726c5ee | |||
| e2445c0a15 | |||
| d253312139 | |||
| 9880fa0173 | |||
| 5952eee22c | |||
| 4483434711 | |||
| d276809906 | |||
| 93678ce56c | |||
| 8c4b0bde37 | |||
| 67c03daa42 | |||
| 469d1c3445 | |||
| 4268da4a1f | |||
| 7d3284fef3 | |||
| 3857cd4b5a | |||
| a04a748552 | |||
| 13ecae3829 | |||
| 1acd97d42a | |||
| 4f485d0e87 | |||
| d48348fa1c | |||
| 003dd0bdef | |||
| 6a92f6b80f | |||
| bf3760808e | |||
| ec109908fa | |||
| 3630b85632 | |||
| 45226d0b6f | |||
| fdce6e1853 | |||
| 8ffa9d7fb7 | |||
| 96ea6bc73e | |||
| 360484c9af | |||
| 47606bffcd | |||
| 7a2af0b5f2 | |||
| 8d2ae598e5 | |||
| aea99a635f | |||
| ce139c6925 | |||
| 4b19936136 | |||
| 6efb3a6e7f | |||
| 5dcf5f5616 | |||
| 451ef8356b | |||
| 3a623996d2 | |||
| 4bada73c83 | |||
| 156d0eea4b | |||
| 6e810f050e | |||
| 6bfb5c619f | |||
| bd90fc2b59 | |||
| 5800093e53 | |||
| fae6a7cd78 | |||
| 65daddfced | |||
| c303b1273d | |||
| 95915b16e5 | |||
| ddade325c4 | |||
| 8d0c04e092 | |||
| 5d62db3e73 | |||
| 46b91bb49d | |||
| c8ce0a242e | |||
| 8be2246249 | |||
| 1005aae0e9 | |||
| 47e79756d1 | |||
| 0f8012ce61 | |||
| 595421bcdd | |||
| 2c159d7ce6 | |||
| b4058ad363 | |||
| 6b5de066b7 | |||
| 517a66b0fe | |||
| 56cff98cf3 | |||
| 3168bee865 | |||
| 3d2f8c1495 | |||
| 7cd83efd97 | |||
| 10f9aeb870 | |||
| c088ac9a08 | |||
| 932f590b61 | |||
| df4188002a | |||
| 005f75a4ba | |||
| b5a74807ef | |||
| 56d7726a58 | |||
| 9db53c7ee3 | |||
| 43c511b86f | |||
| 7043b2b318 | |||
| 3c458e9187 | |||
| 3fc056af67 | |||
| 46dbd17d7b | |||
| 86395eb2d1 | |||
| 5fbc75e4bd | |||
| 3d326c9ca2 | |||
| 2a43eca91c | |||
| debf3d65ba | |||
| cfe3672f8b | |||
| 9dfe558a83 | |||
| cc312f1529 | |||
| d88de3576d | |||
| 9e1d183343 | |||
| 09665eda9f | |||
| 44d080eae9 | |||
| d5e1be8be2 | |||
| d96660e6d1 | |||
| d72f7b6299 | |||
| 1f77e00f34 | |||
| 5c222cc59f | |||
| 7ee7fea375 | |||
| 1c2b127a91 | |||
| 0e927d7294 | |||
| 0dc918880e | |||
| ac5fe3ac65 | |||
| a9d6a87317 | |||
| 650540e573 | |||
| 0ae7e1876b | |||
| 4e7501ed7f | |||
| 751ea085a6 | |||
| 59f5c16c3b | |||
| 1280037d1d | |||
| c91c2a9720 | |||
| 7c44a6ec82 | |||
| 6277b2eaa8 | |||
| 92da41d421 | |||
| f7f30854a1 | |||
| 5eea981790 | |||
| f52608e15a | |||
| fbbb0739ee | |||
| 903f0c69bc | |||
| 15ed754512 | |||
| 2ca801e2ec | |||
| fc9312f0f2 | |||
| c2b36208e7 | |||
| b1e30147ea | |||
| 4903fcd9d2 | |||
| c3de378c7d | |||
| b818f5dcb2 | |||
| 6d2cc32568 | |||
| 9bee3fbb8f | |||
| cd303ff099 | |||
| c192d9a539 | |||
| fce40ffc38 | |||
| 5bd5efafb1 | |||
| d6fffd228e | |||
| b96daf4925 | |||
| c755406963 | |||
| 296b274190 | |||
| f378661948 | |||
| 37fc7b2164 | |||
| 91dca91153 | |||
| e30a2481a2 | |||
| 70f2f1cb01 | |||
| c158f8ac3e | |||
| a46fbb3f05 | |||
| b53a5adca4 | |||
| 7d6e3dc386 | |||
| f352ca0ae0 | |||
| 68d0198f3f | |||
| 0007121340 | |||
| a6e3c42340 | |||
| c0c01573ca | |||
| badbef94e6 | |||
| 610bd48747 | |||
| 2d5657a05a | |||
| 04b47e40b4 | |||
| 5bb1fdaed3 | |||
| a5714cc85d | |||
| 83a4c03979 | |||
| 058814a64b | |||
| 3c52ca3fef | |||
| 9ec04bff06 | |||
| fd2ba16258 | |||
| 18d7e471ae | |||
| d96ea77db7 | |||
| 041cbe4a8f | |||
| a3531c4841 | |||
| bfc6439dc0 | |||
| 4f16e8263a | |||
| d7ec1fd304 | |||
| b2bd8f7afe | |||
| cb0452a248 | |||
| b7a5123ba9 | |||
| 29c00caf4a | |||
| 73a65d8cf9 | |||
| 419d325409 | |||
| 349c515e3e | |||
| 69166fe585 | |||
| 8279e66cae | |||
| 1c34e40289 | |||
| e9c22b895b | |||
| ebda605497 | |||
| 06a69fa66b | |||
| 4daa62db97 | |||
| cb1edcf20a | |||
| d3d7f94c3a | |||
| 1aeb2809fa | |||
| 7cf933ec48 | |||
| f3346fd1f1 | |||
| 579bc5492c | |||
| 71ac2fde82 | |||
| 56d80f5bdd | |||
| 4704554728 | |||
| e4243a2df3 | |||
| 967f5aa795 | |||
| f0429aefa4 | |||
| c3b8677910 | |||
| 268983804e | |||
| 8c79bbb2b6 | |||
| 2d83c860f2 | |||
| 6a3fc0fd97 | |||
| 97fd05640b | |||
| 5d4b220dc7 | |||
| bca419ad63 |
@@ -149,6 +149,30 @@ MyAdjustLoops( ICurve* pCurve, ICURVEPLIST& CrvLst)
|
|||||||
}
|
}
|
||||||
// altrimenti attraversamento
|
// altrimenti attraversamento
|
||||||
else {
|
else {
|
||||||
|
double dParA = vIccInfo[i].IciA[0].dU ;
|
||||||
|
double dParB = vIccInfo[i].IciB[0].dU ;
|
||||||
|
if ( abs( dParA - dEnd) < EPS_SMALL)
|
||||||
|
swap( dParA, dParB) ;
|
||||||
|
// verifico se uno dei due intervalli dà origine ad un tratto trascurabile
|
||||||
|
PtrOwner<ICurve> pCrv1( pMyCrv->CopyParamRange( dParA, dParB)) ;
|
||||||
|
PtrOwner<ICurve> pCrv2( pMyCrv->CopyParamRange( dParB, dParA)) ;
|
||||||
|
double dArea1 = 0, dArea2 = 0 ;
|
||||||
|
if ( ! IsNull( pCrv1))
|
||||||
|
pCrv1->GetAreaXY( dArea1) ;
|
||||||
|
if ( ! IsNull( pCrv2))
|
||||||
|
pCrv2->GetAreaXY( dArea2) ;
|
||||||
|
|
||||||
|
if ( abs( dArea1) > 1e6 * abs( dArea2)) {
|
||||||
|
// se il tratto dParB->dParA non è significativo
|
||||||
|
inOk.Subtract( dStart, dParA) ;
|
||||||
|
inOk.Subtract( dParB, dEnd) ;
|
||||||
|
}
|
||||||
|
else if ( abs( dArea2) > 1e6 * abs( dArea1)) {
|
||||||
|
// se il tratto dParA->dParB non è siginificativo
|
||||||
|
inOk.Subtract( dParA, dParB) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// se entrambe le regioni sono significative
|
||||||
if ( IsEven( nCross))
|
if ( IsEven( nCross))
|
||||||
inOk.Subtract( vIccInfo[i].IciA[0].dU, vIccInfo[i].IciB[0].dU) ;
|
inOk.Subtract( vIccInfo[i].IciA[0].dU, vIccInfo[i].IciB[0].dU) ;
|
||||||
else
|
else
|
||||||
@@ -157,6 +181,7 @@ MyAdjustLoops( ICurve* pCurve, ICURVEPLIST& CrvLst)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Copio le parti da conservare
|
// Copio le parti da conservare
|
||||||
double dParS, dParE ;
|
double dParS, dParE ;
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
#include "CurveBezier.h"
|
#include "CurveBezier.h"
|
||||||
#include "CurveComposite.h"
|
#include "CurveComposite.h"
|
||||||
#include "CreateCurveAux.h"
|
#include "CreateCurveAux.h"
|
||||||
#include "DistPointLine.h"
|
|
||||||
#include "GeoConst.h"
|
#include "GeoConst.h"
|
||||||
#include "/EgtDev/Include/EGkArcPntDirTgCurve.h"
|
#include "/EgtDev/Include/EGkArcPntDirTgCurve.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||||
#include "/EgtDev/Include/EGkArcSpecial.h"
|
#include "/EgtDev/Include/EGkArcSpecial.h"
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
@@ -297,7 +297,7 @@ GetArcPntDirTgBezier( const Point3d& ptP, const Vector3d& vtDir, const CurveBezi
|
|||||||
return nullptr ;
|
return nullptr ;
|
||||||
// calcolo la circonferenza tangente a questa approssimazione
|
// calcolo la circonferenza tangente a questa approssimazione
|
||||||
Point3d ptTg ;
|
Point3d ptTg ;
|
||||||
PtrOwner<ICurve> pCrv( GetCurve( GetArcPntDirTgCurve( ptP, vtDir, *pCrvCompo, ptNear, vtN, &ptTg))) ;
|
PtrOwner<ICurve> pCrv( GetArcPntDirTgCurve( ptP, vtDir, *pCrvCompo, ptNear, vtN, &ptTg)) ;
|
||||||
if ( IsNull( pCrv))
|
if ( IsNull( pCrv))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
// porto il punto di tangenza della circonferenza esattamente sulla curva di Bezier
|
// porto il punto di tangenza della circonferenza esattamente sulla curva di Bezier
|
||||||
@@ -330,7 +330,7 @@ GetArcPntDirTgCompo( const Point3d& ptP, const Vector3d& vtDir, const CurveCompo
|
|||||||
pCrv = crvCompo.GetNextCurve()) {
|
pCrv = crvCompo.GetNextCurve()) {
|
||||||
// recupero la circonferenza tangente alla curva elementare
|
// recupero la circonferenza tangente alla curva elementare
|
||||||
Point3d ptTg ;
|
Point3d ptTg ;
|
||||||
PtrOwner<ICurve> pCrvTmp( GetCurve( GetArcPntDirTgCurve( ptP, vtDir, *pCrv, ptNear, vtN, &ptTg))) ;
|
PtrOwner<ICurve> pCrvTmp( GetArcPntDirTgCurve( ptP, vtDir, *pCrv, ptNear, vtN, &ptTg)) ;
|
||||||
if ( IsNull( pCrvTmp))
|
if ( IsNull( pCrvTmp))
|
||||||
continue ;
|
continue ;
|
||||||
// verifico se è la più vicina al punto desiderato
|
// verifico se è la più vicina al punto desiderato
|
||||||
|
|||||||
+23
-29
@@ -81,8 +81,7 @@ Attribs::Dump( const GeomDB& GDB, string& sOut, bool bMM, const char* szNewLine)
|
|||||||
}
|
}
|
||||||
sOut += szNewLine ;
|
sOut += szNewLine ;
|
||||||
// eventuali nome e stringhe informative
|
// eventuali nome e stringhe informative
|
||||||
STRLIST::const_iterator iIter ;
|
for ( auto iIter = m_slInfo.cbegin() ; iIter != m_slInfo.cend() ; ++ iIter)
|
||||||
for ( iIter = m_slInfo.begin() ; iIter != m_slInfo.end() ; ++ iIter)
|
|
||||||
sOut += *iIter + szNewLine ;
|
sOut += *iIter + szNewLine ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
@@ -101,7 +100,7 @@ Attribs::Save( NgeWriter& ngeOut) const
|
|||||||
// modo
|
// modo
|
||||||
if ( ! ngeOut.WriteUchar( m_Data[MODE], ","))
|
if ( ! ngeOut.WriteUchar( m_Data[MODE], ","))
|
||||||
return false ;
|
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]) ;
|
int nStat = (( m_Data[STATUS] > GDB_ST_ON) ? GDB_ST_ON : m_Data[STATUS]) ;
|
||||||
if ( ! ngeOut.WriteUchar( nStat, ","))
|
if ( ! ngeOut.WriteUchar( nStat, ","))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -118,8 +117,7 @@ Attribs::Save( NgeWriter& ngeOut) const
|
|||||||
if ( ! ngeOut.WriteInt( int( m_slInfo.size()), ";", true))
|
if ( ! ngeOut.WriteInt( int( m_slInfo.size()), ";", true))
|
||||||
return false ;
|
return false ;
|
||||||
// stringhe di info
|
// stringhe di info
|
||||||
STRLIST::const_iterator iIter ;
|
for ( auto iIter = m_slInfo.cbegin() ; iIter != m_slInfo.cend() ; ++ iIter) {
|
||||||
for ( iIter = m_slInfo.begin() ; iIter != m_slInfo.end() ; ++ iIter) {
|
|
||||||
if ( ! ngeOut.WriteString( *iIter, nullptr, true))
|
if ( ! ngeOut.WriteString( *iIter, nullptr, true))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -141,7 +139,7 @@ Attribs::Load( NgeReader& ngeIn)
|
|||||||
if ( ! ngeIn.ReadUchar( ucMode, ","))
|
if ( ! ngeIn.ReadUchar( ucMode, ","))
|
||||||
return false ;
|
return false ;
|
||||||
m_Data[MODE] = CLIP( ucMode, GDB_MD_STD, GDB_MD_HIDDEN) ;
|
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 ;
|
unsigned char ucStat ;
|
||||||
if ( ! ngeIn.ReadUchar( ucStat, ","))
|
if ( ! ngeIn.ReadUchar( ucStat, ","))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -177,7 +175,7 @@ Attribs::Load( NgeReader& ngeIn)
|
|||||||
bool
|
bool
|
||||||
Attribs::DataFromString( const string& sParam)
|
Attribs::DataFromString( const string& sParam)
|
||||||
{
|
{
|
||||||
// il primo parametro è diviso in 4 parti
|
// il primo parametro è diviso in 4 parti
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sParam, ",", vsParams) ;
|
Tokenize( sParam, ",", vsParams) ;
|
||||||
// 4 parti
|
// 4 parti
|
||||||
@@ -215,10 +213,9 @@ Attribs::SetName( const string& sName)
|
|||||||
if ( sName.empty() || ! IsValidVal( sName))
|
if ( sName.empty() || ! IsValidVal( sName))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// può essere solo la prima stringa
|
// può essere solo la prima stringa
|
||||||
STRLIST::iterator iIter ;
|
auto iIter = m_slInfo.begin() ;
|
||||||
if ( ( iIter = m_slInfo.begin()) != m_slInfo.end() &&
|
if ( iIter != m_slInfo.end() && FindKey( *iIter, NAME)) {
|
||||||
FindKey( *iIter, NAME)) {
|
|
||||||
*iIter = NAME + EQUAL + sName ;
|
*iIter = NAME + EQUAL + sName ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -237,10 +234,9 @@ Attribs::SetName( const string& sName)
|
|||||||
bool
|
bool
|
||||||
Attribs::GetName( string& sName) const
|
Attribs::GetName( string& sName) const
|
||||||
{
|
{
|
||||||
// può essere solo la prima stringa
|
// può essere solo la prima stringa
|
||||||
STRLIST::const_iterator iIter ;
|
const auto iIter = m_slInfo.cbegin() ;
|
||||||
if ( ( iIter = m_slInfo.begin()) != m_slInfo.end() &&
|
if ( iIter != m_slInfo.cend() && FindKey( *iIter, NAME)) {
|
||||||
FindKey( *iIter, NAME)) {
|
|
||||||
sName = iIter->substr( NAME.length() + 1) ;
|
sName = iIter->substr( NAME.length() + 1) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -252,23 +248,18 @@ Attribs::GetName( string& sName) const
|
|||||||
bool
|
bool
|
||||||
Attribs::ExistsName( void) const
|
Attribs::ExistsName( void) const
|
||||||
{
|
{
|
||||||
// può essere solo la prima stringa
|
// può essere solo la prima stringa
|
||||||
STRLIST::const_iterator iIter ;
|
const auto iIter = m_slInfo.cbegin() ;
|
||||||
if ( ( iIter = m_slInfo.begin()) != m_slInfo.end() &&
|
return ( iIter != m_slInfo.cend() && FindKey( *iIter, NAME)) ;
|
||||||
FindKey( *iIter, NAME))
|
|
||||||
return true ;
|
|
||||||
|
|
||||||
return false ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
Attribs::RemoveName( void)
|
Attribs::RemoveName( void)
|
||||||
{
|
{
|
||||||
// può essere solo la prima stringa
|
// può essere solo la prima stringa
|
||||||
STRLIST::const_iterator iIter ;
|
const auto iIter = m_slInfo.cbegin() ;
|
||||||
if ( ( iIter = m_slInfo.begin()) != m_slInfo.end() &&
|
if ( iIter != m_slInfo.cend() && FindKey( *iIter, NAME)) {
|
||||||
FindKey( *iIter, NAME)) {
|
|
||||||
m_slInfo.pop_front() ;
|
m_slInfo.pop_front() ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -285,11 +276,11 @@ Attribs::SetInfo( const string& sKey, const string& sVal)
|
|||||||
if ( ! IsValidKey( sKey) || sVal.empty() || ! IsValidVal( sVal))
|
if ( ! IsValidKey( sKey) || sVal.empty() || ! IsValidVal( sVal))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// se è il nome
|
// se è il nome
|
||||||
if ( sKey == NAME)
|
if ( sKey == NAME)
|
||||||
return SetName( sVal) ;
|
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) {
|
for ( auto iIter = m_slInfo.begin() ; iIter != m_slInfo.end() ; ++ iIter) {
|
||||||
if ( FindKey( *iIter, sKey)) {
|
if ( FindKey( *iIter, sKey)) {
|
||||||
*iIter = sKey + EQUAL + sVal ;
|
*iIter = sKey + EQUAL + sVal ;
|
||||||
@@ -362,8 +353,11 @@ Attribs::GetAllInfo( STRVECTOR& vsInfo) const
|
|||||||
{
|
{
|
||||||
// riservo spazio opportuno per il vettore delle stringhe
|
// riservo spazio opportuno per il vettore delle stringhe
|
||||||
vsInfo.clear() ;
|
vsInfo.clear() ;
|
||||||
if ( (int) m_slInfo.size() == 0)
|
|
||||||
|
// se non ci sono info esco
|
||||||
|
if ( m_slInfo.empty())
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
vsInfo.reserve( m_slInfo.size()) ;
|
vsInfo.reserve( m_slInfo.size()) ;
|
||||||
// recupero tutte le info tranne il nome (se presente sempre al primo posto)
|
// recupero tutte le info tranne il nome (se presente sempre al primo posto)
|
||||||
auto iIter = m_slInfo.cbegin() ;
|
auto iIter = m_slInfo.cbegin() ;
|
||||||
|
|||||||
+6
-6
@@ -14,10 +14,10 @@
|
|||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "BiArcs.h"
|
#include "BiArcs.h"
|
||||||
|
#include "CurveLine.h"
|
||||||
#include "CurveArc.h"
|
#include "CurveArc.h"
|
||||||
|
#include "CurveComposite.h"
|
||||||
#include "/EgtDev/Include/EGkAngle.h"
|
#include "/EgtDev/Include/EGkAngle.h"
|
||||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
|
||||||
#include "/EgtDev/Include/EGkArcSpecial.h"
|
#include "/EgtDev/Include/EGkArcSpecial.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||||
@@ -50,7 +50,7 @@ GetBiArc( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir
|
|||||||
return nullptr ;
|
return nullptr ;
|
||||||
|
|
||||||
// preparo la curva composita per i biarchi
|
// preparo la curva composita per i biarchi
|
||||||
PtrOwner<ICurveComposite> pBiArc( CreateCurveComposite()) ;
|
PtrOwner<CurveComposite> pBiArc( CreateBasicCurveComposite()) ;
|
||||||
if ( IsNull( pBiArc))
|
if ( IsNull( pBiArc))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ GetBiArc( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir
|
|||||||
pBiArc.Set( GetBiArc( ptP0, dDir0Deg, ptP1, dDir1Deg, 0.5)) ;
|
pBiArc.Set( GetBiArc( ptP0, dDir0Deg, ptP1, dDir1Deg, 0.5)) ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CurveArc* pArc = GetBasicCurveArc( pJCrv) ;
|
const CurveArc* pArc = GetBasicCurveArc( pJCrv) ;
|
||||||
if ( pArc == nullptr)
|
if ( pArc == nullptr)
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
double dU = -1 ;
|
double dU = -1 ;
|
||||||
@@ -172,7 +172,7 @@ CalcJCurve( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dD
|
|||||||
|
|
||||||
// se rotazione nulla, allora segmento di retta tra i due punti
|
// se rotazione nulla, allora segmento di retta tra i due punti
|
||||||
if ( abs( dAngDeg) < EPS_ANG_SMALL) {
|
if ( abs( dAngDeg) < EPS_ANG_SMALL) {
|
||||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
PtrOwner<CurveLine> pLine( CreateBasicCurveLine()) ;
|
||||||
if ( IsNull( pLine) || ! pLine->Set( ptP0, ptP1))
|
if ( IsNull( pLine) || ! pLine->Set( ptP0, ptP1))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
// inverto per avere parametrizzazione crescente allontanandosi da Dir0 e avvicinandosi a Dir1
|
// inverto per avere parametrizzazione crescente allontanandosi da Dir0 e avvicinandosi a Dir1
|
||||||
@@ -194,7 +194,7 @@ CalcJCurve( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dD
|
|||||||
Vector3d vtStart = ptP0 - ptCen ;
|
Vector3d vtStart = ptP0 - ptCen ;
|
||||||
double dRad, dAngStart ;
|
double dRad, dAngStart ;
|
||||||
vtStart.ToSpherical( &dRad, nullptr, &dAngStart) ;
|
vtStart.ToSpherical( &dRad, nullptr, &dAngStart) ;
|
||||||
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
|
PtrOwner<CurveArc> pArc( CreateBasicCurveArc()) ;
|
||||||
if ( IsNull( pArc) || ! pArc->SetXY( ptCen, dRad, dAngStart, dAngDeg, ( ptP1.z - ptP0.z)))
|
if ( IsNull( pArc) || ! pArc->SetXY( ptCen, dRad, dAngStart, dAngDeg, ( ptP1.z - ptP0.z)))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
double dDirStartDeg = dAngStart + ( dAngDeg > 0 ? ANG_RIGHT : - ANG_RIGHT) ;
|
double dDirStartDeg = dAngStart + ( dAngDeg > 0 ? ANG_RIGHT : - ANG_RIGHT) ;
|
||||||
|
|||||||
+12
-5
@@ -1,8 +1,8 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2018-2018
|
// EgalTech 2018-2018
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : CAToolSurfTm.cpp Data : 08.05.18 Versione : 1.9e2
|
// File : CAvToolSurfTm.cpp Data : 08.05.18 Versione : 1.9e2
|
||||||
// Contenuto : Implementazione della classe CAToolSurfTm.
|
// Contenuto : Implementazione della classe CAvToolSurfTm.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "CAvToolTriangle.h"
|
#include "CAvToolTriangle.h"
|
||||||
#include "CAvToolSurfTm.h"
|
#include "CAvToolSurfTm.h"
|
||||||
#include "DistPointLine.h"
|
|
||||||
#include "DllMain.h"
|
#include "DllMain.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <future>
|
#include <future>
|
||||||
@@ -104,6 +104,9 @@ CAvToolSurfTm::TestPosition( const Point3d& ptT, const Vector3d& vtDir, const Ve
|
|||||||
// Se utensile non definito, errore
|
// Se utensile non definito, errore
|
||||||
if ( m_Tool.GetType() == Tool::UNDEF)
|
if ( m_Tool.GetType() == Tool::UNDEF)
|
||||||
return false ;
|
return false ;
|
||||||
|
// Se direzioni non definite, errore
|
||||||
|
if ( vtDir.IsSmall() || vtMove.IsSmall())
|
||||||
|
return false ;
|
||||||
// Imposto il riferimento di movimento
|
// Imposto il riferimento di movimento
|
||||||
if ( ! AreSameOrOppositeVectorApprox( vtDir, vtMove))
|
if ( ! AreSameOrOppositeVectorApprox( vtDir, vtMove))
|
||||||
m_frMove.Set( ORIG, vtMove, vtDir) ;
|
m_frMove.Set( ORIG, vtMove, vtDir) ;
|
||||||
@@ -122,6 +125,9 @@ CAvToolSurfTm::TestPath( PNTULIST& lPntM, const Vector3d& vtDir, const Vector3d&
|
|||||||
// Se utensile non definito, errore
|
// Se utensile non definito, errore
|
||||||
if ( m_Tool.GetType() == Tool::UNDEF)
|
if ( m_Tool.GetType() == Tool::UNDEF)
|
||||||
return false ;
|
return false ;
|
||||||
|
// Se direzioni non definite, errore
|
||||||
|
if ( vtDir.IsSmall() || vtMove.IsSmall())
|
||||||
|
return false ;
|
||||||
// Se lista vuota, non devo fare alcunché
|
// Se lista vuota, non devo fare alcunché
|
||||||
if ( lPntM.empty())
|
if ( lPntM.empty())
|
||||||
return true ;
|
return true ;
|
||||||
@@ -206,8 +212,9 @@ CAvToolSurfTm::TestSubPath( int nId, PNTULIST& lPntM, const Vector3d& vtDir, dou
|
|||||||
while ( itPntMCurr != lPntM.end()) {
|
while ( itPntMCurr != lPntM.end()) {
|
||||||
// verifico il punto
|
// verifico il punto
|
||||||
ptCurr = itPntMCurr->first ;
|
ptCurr = itPntMCurr->first ;
|
||||||
itPntMCurr->second = MyTestPositionHG( itPntMCurr->first, vtDir) ;
|
double dMove = MyTestPositionHG( itPntMCurr->first, vtDir) ;
|
||||||
if ( itPntMCurr->second < - EPS_SMALL)
|
itPntMCurr->second = - dMove ;
|
||||||
|
if ( dMove < - EPS_SMALL)
|
||||||
return false ;
|
return false ;
|
||||||
// se esiste il punto precedente devo verificare il medio
|
// se esiste il punto precedente devo verificare il medio
|
||||||
if ( itPntMPrev != lPntM.end()) {
|
if ( itPntMPrev != lPntM.end()) {
|
||||||
|
|||||||
+13
-11
@@ -17,8 +17,8 @@
|
|||||||
#include "CAvToolTriangle.h"
|
#include "CAvToolTriangle.h"
|
||||||
#include "IntersLineSurfStd.h"
|
#include "IntersLineSurfStd.h"
|
||||||
#include "IntersLineTria.h"
|
#include "IntersLineTria.h"
|
||||||
#include "DistPointLine.h"
|
|
||||||
#include "CDeUtility.h"
|
#include "CDeUtility.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkIntervals.h"
|
#include "/EgtDev/Include/EGkIntervals.h"
|
||||||
#include "/EgtDev/Include/ENkPolynomialRoots.h"
|
#include "/EgtDev/Include/ENkPolynomialRoots.h"
|
||||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||||
@@ -146,18 +146,20 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
|||||||
const Triangle3d& trTria, const Vector3d& vtMove)
|
const Triangle3d& trTria, const Vector3d& vtMove)
|
||||||
{
|
{
|
||||||
// Non ha senso che il movimento sia in direzione "opposta" a quella dell'asse utensile
|
// 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. ;
|
return -1. ;
|
||||||
// Se avvicinamento non devo fare nulla
|
// Se avvicinamento non devo fare nulla
|
||||||
if ( vtMove * trTria.GetN() < - EPS_ZERO)
|
if ( vtMove * trTria.GetN() < - EPS_ZERO)
|
||||||
return 0. ;
|
return 0. ;
|
||||||
|
// Tolleranza su dischi (parti piatte perpendicolari all'asse utensile)
|
||||||
|
double dEpsilon = ( vtMove * vtToolAx > 0.5 ? 0 : EPS_SMALL) ;
|
||||||
// se utensile cilindrico
|
// se utensile cilindrico
|
||||||
if ( tlTool.GetType() == Tool::CYLMILL) {
|
if ( tlTool.GetType() == Tool::CYLMILL) {
|
||||||
// parametri geometrici
|
// parametri geometrici
|
||||||
double dHeigth = tlTool.GetHeigth() ;
|
double dHeigth = tlTool.GetHeigth() ;
|
||||||
double dRadius = tlTool.GetRadius() ;
|
double dRadius = tlTool.GetRadius() ;
|
||||||
// prima determino l'allontanamento del disco inferiore
|
// prima determino l'allontanamento del disco inferiore
|
||||||
double dDist = CAvDiskTriangle( ptToolOrig - ( dHeigth - EPS_SMALL) * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
double dDist = CAvDiskTriangle( ptToolOrig - ( dHeigth - dEpsilon) * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
||||||
if ( dDist < - EPS_SMALL)
|
if ( dDist < - EPS_SMALL)
|
||||||
return dDist ;
|
return dDist ;
|
||||||
// poi verifico quello del cilindro (tenendo conto di quanto è stata allontanato il disco)
|
// poi verifico quello del cilindro (tenendo conto di quanto è stata allontanato il disco)
|
||||||
@@ -165,7 +167,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
|||||||
if ( dDist2 < - EPS_SMALL)
|
if ( dDist2 < - EPS_SMALL)
|
||||||
return dDist2 ;
|
return dDist2 ;
|
||||||
// verifico quello del disco sopra
|
// verifico quello del disco sopra
|
||||||
double dDist3 = CAvDiskTriangle( ptToolOrig - EPS_SMALL * vtToolAx + ( dDist + dDist2) * vtMove, vtToolAx, dRadius, trTria, vtMove) ;
|
double dDist3 = CAvDiskTriangle( ptToolOrig - dEpsilon * vtToolAx + ( dDist + dDist2) * vtMove, vtToolAx, dRadius, trTria, vtMove) ;
|
||||||
if ( dDist3 < - EPS_SMALL)
|
if ( dDist3 < - EPS_SMALL)
|
||||||
return dDist3 ;
|
return dDist3 ;
|
||||||
return ( dDist + dDist2 + dDist3) ;
|
return ( dDist + dDist2 + dDist3) ;
|
||||||
@@ -189,7 +191,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
|||||||
return dDist2 ;
|
return dDist2 ;
|
||||||
// verifico quello del disco sopra
|
// verifico quello del disco sopra
|
||||||
Point3d ptDiskUpOrig = ptCylOrig + dDist2 * vtMove ;
|
Point3d ptDiskUpOrig = ptCylOrig + dDist2 * vtMove ;
|
||||||
double dDist3 = CAvDiskTriangle( ptDiskUpOrig - EPS_SMALL * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
double dDist3 = CAvDiskTriangle( ptDiskUpOrig - dEpsilon * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
||||||
if ( dDist3 < - EPS_SMALL)
|
if ( dDist3 < - EPS_SMALL)
|
||||||
return dDist3 ;
|
return dDist3 ;
|
||||||
return ( dDist + dDist2 + dDist3) ;
|
return ( dDist + dDist2 + dDist3) ;
|
||||||
@@ -199,7 +201,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
|||||||
// parametri geometrici
|
// parametri geometrici
|
||||||
double dCylHeigth = tlTool.GetHeigth() - tlTool.GetTipHeigth() ;
|
double dCylHeigth = tlTool.GetHeigth() - tlTool.GetTipHeigth() ;
|
||||||
// prima determino l'allontanamento del disco inferiore
|
// prima determino l'allontanamento del disco inferiore
|
||||||
double dDist = CAvDiskTriangle( ptToolOrig - ( tlTool.GetHeigth() - EPS_SMALL) * vtToolAx, vtToolAx, tlTool.GetTipRadius(),
|
double dDist = CAvDiskTriangle( ptToolOrig - ( tlTool.GetHeigth() - dEpsilon) * vtToolAx, vtToolAx, tlTool.GetTipRadius(),
|
||||||
trTria, vtMove) ;
|
trTria, vtMove) ;
|
||||||
if ( dDist < - EPS_SMALL)
|
if ( dDist < - EPS_SMALL)
|
||||||
return dDist ;
|
return dDist ;
|
||||||
@@ -220,7 +222,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
|||||||
return dDist3 ;
|
return dDist3 ;
|
||||||
// verifico quello del disco sopra
|
// verifico quello del disco sopra
|
||||||
Point3d ptDiskUpOrig = ptCylOrig + vtMove * dDist3 ;
|
Point3d ptDiskUpOrig = ptCylOrig + vtMove * dDist3 ;
|
||||||
double dDist4 = CAvDiskTriangle( ptDiskUpOrig - EPS_SMALL * vtToolAx, vtToolAx, tlTool.GetRadius(), trTria, vtMove) ;
|
double dDist4 = CAvDiskTriangle( ptDiskUpOrig - dEpsilon * vtToolAx, vtToolAx, tlTool.GetRadius(), trTria, vtMove) ;
|
||||||
if ( dDist4 < - EPS_SMALL)
|
if ( dDist4 < - EPS_SMALL)
|
||||||
return dDist4 ;
|
return dDist4 ;
|
||||||
return ( dDist + dDist2 + dDist3 + dDist4) ;
|
return ( dDist + dDist2 + dDist3 + dDist4) ;
|
||||||
@@ -247,7 +249,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
|||||||
double dMaxR = max( tlTool.GetRadius(), tlTool.GetTipRadius()) ;
|
double dMaxR = max( tlTool.GetRadius(), tlTool.GetTipRadius()) ;
|
||||||
double dCylHeigth = tlTool.GetHeigth() - tlTool.GetTipHeigth() ;
|
double dCylHeigth = tlTool.GetHeigth() - tlTool.GetTipHeigth() ;
|
||||||
// prima determino l'allontanamento del disco inferiore
|
// prima determino l'allontanamento del disco inferiore
|
||||||
double dDist = CAvDiskTriangle( ptToolOrig - ( tlTool.GetHeigth() - EPS_SMALL) * vtToolAx, vtToolAx, tlTool.GetTipRadius(),
|
double dDist = CAvDiskTriangle( ptToolOrig - ( tlTool.GetHeigth() - dEpsilon) * vtToolAx, vtToolAx, tlTool.GetTipRadius(),
|
||||||
trTria, vtMove) ;
|
trTria, vtMove) ;
|
||||||
if ( dDist < - EPS_SMALL)
|
if ( dDist < - EPS_SMALL)
|
||||||
return dDist ;
|
return dDist ;
|
||||||
@@ -266,7 +268,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
|||||||
return dDist3 ;
|
return dDist3 ;
|
||||||
// verifico quello del disco sopra
|
// verifico quello del disco sopra
|
||||||
Point3d ptDiskUpOrig = ptCylOrig + vtMove * dDist3 ;
|
Point3d ptDiskUpOrig = ptCylOrig + vtMove * dDist3 ;
|
||||||
double dDist4 = CAvDiskTriangle( ptDiskUpOrig - EPS_SMALL * vtToolAx, vtToolAx, tlTool.GetRadius(), trTria, vtMove) ;
|
double dDist4 = CAvDiskTriangle( ptDiskUpOrig - dEpsilon * vtToolAx, vtToolAx, tlTool.GetRadius(), trTria, vtMove) ;
|
||||||
if ( dDist4 < - EPS_SMALL)
|
if ( dDist4 < - EPS_SMALL)
|
||||||
return dDist4 ;
|
return dDist4 ;
|
||||||
return ( dDist + dDist2 + dDist3 + dDist4) ;
|
return ( dDist + dDist2 + dDist3 + dDist4) ;
|
||||||
@@ -299,10 +301,10 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
|||||||
double dRadius = max( ptStart.x, ptEnd.x) ;
|
double dRadius = max( ptStart.x, ptEnd.x) ;
|
||||||
// Se disco verso il basso dell'utensile
|
// Se disco verso il basso dell'utensile
|
||||||
if ( ptStart.x > ptEnd.x)
|
if ( ptStart.x > ptEnd.x)
|
||||||
dDist2 = CAvDiskTriangle( ptCompOrig + EPS_SMALL * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
dDist2 = CAvDiskTriangle( ptCompOrig + dEpsilon * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
||||||
// Se disco verso l'alto
|
// Se disco verso l'alto
|
||||||
else
|
else
|
||||||
dDist2 = CAvDiskTriangle( ptCompOrig - EPS_SMALL * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
dDist2 = CAvDiskTriangle( ptCompOrig - dEpsilon * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Verifiche curva precedente per eventuale tappo sopra
|
// Verifiche curva precedente per eventuale tappo sopra
|
||||||
|
|||||||
+54
-7
@@ -1,13 +1,14 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2016-2020
|
// EgalTech 2016-2024
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : CDBoxSurfTm.cpp Data : 09.01.20 Versione : 2.2a2
|
// File : CDeBoxClosedSurfTm.cpp Data : 24.03.24 Versione : 2.6c2
|
||||||
// Contenuto : Implementazione della verifica di collisione tra
|
// Contenuto : Implementazione della verifica di collisione tra
|
||||||
// BoundingBox e Closed SurftriMesh.
|
// BoundingBox e Closed SurftriMesh.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Modifiche : 05.10.16 DS Creazione modulo.
|
// Modifiche : 05.10.16 DS Creazione modulo.
|
||||||
// 09.01.20 DS Cambio nome alla funzione.
|
// 09.01.20 DS Cambio nome alla funzione.
|
||||||
|
// 24.03.24 DS Aggiunta TestCylSurfTm.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -19,10 +20,23 @@
|
|||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Il sistema di riferimento è allineato con il box e ha origine in un suo vertice.
|
||||||
|
// La distanza di sicurezza ha effetto solo se maggiore di EPS_SMALL.
|
||||||
|
// Il sistema di riferimento del box è riferito a quello della superficie.
|
||||||
|
// La funzione restituisce :
|
||||||
|
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||||
|
// - false in caso di assenza di collisione.
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, double dSafeDist, const ISurfTriMesh& Stm)
|
CDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, const ISurfTriMesh& Stm, double dSafeDist)
|
||||||
{
|
{
|
||||||
|
// Se il box non è ben definito non ha senso proseguire
|
||||||
|
if ( vtDiag.IsSmall())
|
||||||
|
return true ;
|
||||||
|
// Se superficie non valida o aperta, non ha senso proseguire
|
||||||
|
if ( ! Stm.IsValid() || ! Stm.IsClosed())
|
||||||
|
return true ;
|
||||||
// Recupero BBox del poliedro
|
// Recupero BBox del poliedro
|
||||||
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
||||||
// Calcolo il BBox del parallelepipedo
|
// Calcolo il BBox del parallelepipedo
|
||||||
@@ -39,13 +53,10 @@ CDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, double dSafeDi
|
|||||||
for ( int nT : vT) {
|
for ( int nT : vT) {
|
||||||
Triangle3d Tria ;
|
Triangle3d Tria ;
|
||||||
if ( Stm.GetTriangle( nT, Tria)) {
|
if ( Stm.GetTriangle( nT, Tria)) {
|
||||||
if ( CDeBoxTria( frBox, vtDiag, dSafeDist, Tria))
|
if ( CDeBoxTria( frBox, vtDiag, Tria, dSafeDist))
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Se superficie aperta, non c'è collisione
|
|
||||||
if ( ! Stm.IsClosed())
|
|
||||||
return false ;
|
|
||||||
// Se il BBox del parallelepipedo non è interno a quello del poliedro e viceversa, non c'è collisione
|
// Se il BBox del parallelepipedo non è interno a quello del poliedro e viceversa, non c'è collisione
|
||||||
if ( ! b3Poly.Encloses( b3Box) && ! b3Box.Encloses( b3Poly))
|
if ( ! b3Poly.Encloses( b3Box) && ! b3Box.Encloses( b3Poly))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -56,3 +67,39 @@ CDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, double dSafeDi
|
|||||||
// Se il box è interno c'è collisione
|
// Se il box è interno c'è collisione
|
||||||
return DistBoxCenSurfCalc.IsPointInside() ;
|
return DistBoxCenSurfCalc.IsPointInside() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Verifica l'interferenza tra il box e la superficie : restituisce true in caso di interferenza.
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
TestBoxSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, const ISurfTriMesh& Stm, double dSafeDist)
|
||||||
|
{
|
||||||
|
// Se il box non è ben definito non ha senso proseguire
|
||||||
|
if ( vtDiag.IsSmall())
|
||||||
|
return true ;
|
||||||
|
// Se superficie non valida, non ha senso proseguire
|
||||||
|
if ( ! Stm.IsValid())
|
||||||
|
return true ;
|
||||||
|
// Recupero BBox del poliedro
|
||||||
|
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
||||||
|
// Calcolo il BBox del parallelepipedo
|
||||||
|
BBox3d b3BoxL( ORIG, ORIG + vtDiag) ;
|
||||||
|
if ( dSafeDist > EPS_SMALL)
|
||||||
|
b3BoxL.Expand( dSafeDist) ;
|
||||||
|
BBox3d b3Box = GetToGlob( b3BoxL, frBox) ;
|
||||||
|
// Se i BBox non interferiscono, non c'è collisione
|
||||||
|
if ( ! b3Poly.Overlaps( b3Box) || ! b3Poly.Overlaps( frBox, b3BoxL))
|
||||||
|
return false ;
|
||||||
|
// Verifico se il parallelepipedo interferisce con i triangoli del poliedro presenti nel suo BBox
|
||||||
|
INTVECTOR vT ;
|
||||||
|
Stm.GetAllTriaOverlapBox( b3Box, vT) ;
|
||||||
|
for ( int nT : vT) {
|
||||||
|
Triangle3d Tria ;
|
||||||
|
if ( Stm.GetTriangle( nT, Tria)) {
|
||||||
|
if ( CDeBoxTria( frBox, vtDiag, Tria, dSafeDist))
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Non c'è interferenza
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -171,7 +171,7 @@ CDeSimpleBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, const Triangle3d
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, double dSafeDist, const Triangle3d& trTria)
|
CDeBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, const Triangle3d& trTria, double dSafeDist)
|
||||||
{
|
{
|
||||||
// Porto il triangolo nel riferimento del box
|
// Porto il triangolo nel riferimento del box
|
||||||
Triangle3d trTriaL = trTria ;
|
Triangle3d trTriaL = trTria ;
|
||||||
|
|||||||
+1
-1
@@ -17,4 +17,4 @@
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool CDeSimpleBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, const Triangle3d& trTria) ;
|
bool CDeSimpleBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, const Triangle3d& trTria) ;
|
||||||
bool CDeBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, double dSafeDist, const Triangle3d& trTria) ;
|
bool CDeBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, const Triangle3d& trTria, double dSafeDist) ;
|
||||||
|
|||||||
+1
-1
@@ -97,7 +97,7 @@ CDeSimpleCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, const Tr
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, double dSafeDist, const Triangle3d& trTria)
|
CDeCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, const Triangle3d& trTria, double dSafeDist)
|
||||||
{
|
{
|
||||||
return CDeSimpleCapsTria( ptP1, ptP2, dR + max( 0., dSafeDist), trTria) ;
|
return CDeSimpleCapsTria( ptP1, ptP2, dR + max( 0., dSafeDist), trTria) ;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -16,4 +16,4 @@
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool CDeSimpleCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, const Triangle3d& trTria) ;
|
bool CDeSimpleCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, const Triangle3d& trTria) ;
|
||||||
bool CDeCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, double dSafeDist, const Triangle3d& trTria) ;
|
bool CDeCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, const Triangle3d& trTria, double dSafeDist) ;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2020-2020
|
// EgalTech 2020-2024
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : CDeSurfTmSurfTm.h Data : 14.06.23 Versione : 2.5f3
|
// File : CDeClosedSurfTmClosedSurfTm.h Data : 24.03.24 Versione : 2.6c2
|
||||||
// Contenuto : Implementazione funzione verifica collisione tra
|
// Contenuto : Implementazione funzione verifica collisione tra
|
||||||
// SurfTm e SurfTm.
|
// SurfTm e SurfTm.
|
||||||
//
|
//
|
||||||
// Modifiche : 13.11.20 LM Creazione modulo.
|
// Modifiche : 13.11.20 LM Creazione modulo.
|
||||||
//
|
// 24.03.24 DS Aggiunta TestSurfTmSurfTm.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -22,24 +22,25 @@
|
|||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// La funzione restituisce true in caso di collisone, false in caso di assenza
|
|
||||||
// di collisione o inconsistenza dei parametri di input.
|
|
||||||
// Le due superfici devono essere espresse nel medesimo sistema di riferimento.
|
// Le due superfici devono essere espresse nel medesimo sistema di riferimento.
|
||||||
// La distanza di sicurezza ha effetto solo se maggiore di EPS_SMALL.
|
// La distanza di sicurezza ha effetto solo se maggiore di EPS_SMALL.
|
||||||
// Se necessario cerco la collisione con un offset della superficie B costituito
|
// Se necessario cerco la collisione con un offset della superficie B costituito
|
||||||
// da sfere centrate nei vertici, cilindri con i segmenti per asse e il triangolo
|
// da sfere centrate nei vertici, cilindri con gli spigoli per asse e il triangolo
|
||||||
// originale traslato di una costante pari alla distanza di sicurezza lungo la
|
// originale traslato della distanza di sicurezza lungo la sua normale.
|
||||||
// sua normale.
|
// La funzione restituisce :
|
||||||
|
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||||
|
// - false in caso di assenza di collisione.
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeClosedSurfTmClosedSurfTm( const ISurfTriMesh& SurfA, const ISurfTriMesh& SurfB, double dSafeDist)
|
CDeClosedSurfTmClosedSurfTm( const ISurfTriMesh& SurfA, const ISurfTriMesh& SurfB, double dSafeDist)
|
||||||
{
|
{
|
||||||
// Recupero le superfici base
|
// Recupero le superfici base
|
||||||
const SurfTriMesh* pSrfA = GetBasicSurfTriMesh( &SurfA) ;
|
const SurfTriMesh* pSrfA = GetBasicSurfTriMesh( &SurfA) ;
|
||||||
const SurfTriMesh* pSrfB = GetBasicSurfTriMesh( &SurfB) ;
|
const SurfTriMesh* pSrfB = GetBasicSurfTriMesh( &SurfB) ;
|
||||||
// Se le superfici non sono valide o non sono chiuse, non ha senso proseguire.
|
// Se le superfici non sono valide o non sono chiuse, non ha senso proseguire
|
||||||
if ( pSrfA == nullptr || ! pSrfA->IsValid() || ! pSrfA->IsClosed() ||
|
if ( pSrfA == nullptr || ! pSrfA->IsValid() || ! pSrfA->IsClosed() ||
|
||||||
pSrfB == nullptr || ! pSrfB->IsValid() || ! pSrfB->IsClosed())
|
pSrfB == nullptr || ! pSrfB->IsValid() || ! pSrfB->IsClosed())
|
||||||
return false ;
|
return true ;
|
||||||
// Se i box delle superfici non si intersecano, ho finito.
|
// Se i box delle superfici non si intersecano, ho finito.
|
||||||
BBox3d b3BoxA, b3BoxB ;
|
BBox3d b3BoxA, b3BoxB ;
|
||||||
pSrfA->GetLocalBBox( b3BoxA) ;
|
pSrfA->GetLocalBBox( b3BoxA) ;
|
||||||
@@ -121,3 +122,89 @@ CDeClosedSurfTmClosedSurfTm( const ISurfTriMesh& SurfA, const ISurfTriMesh& Surf
|
|||||||
DistPointSurfTm DistPoinBSrfA( ptPointB, *pSrfA) ;
|
DistPointSurfTm DistPoinBSrfA( ptPointB, *pSrfA) ;
|
||||||
return ( DistPoinASrfB.IsPointInside() || DistPoinBSrfA.IsPointInside()) ;
|
return ( DistPoinASrfB.IsPointInside() || DistPoinBSrfA.IsPointInside()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Verifica l'interferenza tra le due superfici : restituisce true in caso di interferenza.
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
TestSurfTmSurfTm( const ISurfTriMesh& SurfA, const ISurfTriMesh& SurfB, double dSafeDist)
|
||||||
|
{
|
||||||
|
// Recupero le superfici base
|
||||||
|
const SurfTriMesh* pSrfA = GetBasicSurfTriMesh( &SurfA) ;
|
||||||
|
const SurfTriMesh* pSrfB = GetBasicSurfTriMesh( &SurfB) ;
|
||||||
|
// Se le superfici non sono valide, non ha senso proseguire
|
||||||
|
if ( pSrfA == nullptr || ! pSrfA->IsValid() ||
|
||||||
|
pSrfB == nullptr || ! pSrfB->IsValid())
|
||||||
|
return true ;
|
||||||
|
// Se i box delle superfici non si intersecano, ho finito.
|
||||||
|
BBox3d b3BoxA, b3BoxB ;
|
||||||
|
pSrfA->GetLocalBBox( b3BoxA) ;
|
||||||
|
pSrfB->GetLocalBBox( b3BoxB) ;
|
||||||
|
// Se è necessario, espando il box di B di una costante additiva pari alla distanza di sicurezza.
|
||||||
|
if ( dSafeDist > EPS_SMALL)
|
||||||
|
b3BoxB.Expand( dSafeDist) ;
|
||||||
|
// Se i box non si sovrappongono, non c'è collisione. Ho finito.
|
||||||
|
if ( ! b3BoxA.Overlaps( b3BoxB))
|
||||||
|
return false ;
|
||||||
|
// Recupero i triangoli di A che interferiscono col box di B
|
||||||
|
INTVECTOR vTriaIndex ;
|
||||||
|
pSrfA->GetAllTriaOverlapBox( b3BoxB, vTriaIndex) ;
|
||||||
|
// Ciclo sui triangoli della superficie A che interferiscono col box della superficie B.
|
||||||
|
for ( int nTA : vTriaIndex) {
|
||||||
|
Triangle3d trTriaA ;
|
||||||
|
if ( ! ( pSrfA->GetTriangle( nTA, trTriaA) && trTriaA.Validate()))
|
||||||
|
continue ;
|
||||||
|
BBox3d b3BoxTriaA ;
|
||||||
|
trTriaA.GetLocalBBox( b3BoxTriaA) ;
|
||||||
|
// Se è necessario, espando il box di una costante additiva pari alla distanza di sicurezza.
|
||||||
|
if ( dSafeDist > EPS_SMALL)
|
||||||
|
b3BoxTriaA.Expand( dSafeDist) ;
|
||||||
|
// Recupero i triangoli di B che interferiscono col box del triangolo di A
|
||||||
|
INTVECTOR vNearTria ;
|
||||||
|
pSrfB->GetAllTriaOverlapBox( b3BoxTriaA, vNearTria) ;
|
||||||
|
// Settare tutti i triangoli come già processati.
|
||||||
|
// Al termine della chiamata i TempInt dei triangoli valgono 0.
|
||||||
|
pSrfB->ResetTempInts() ;
|
||||||
|
// Ciclo sui triangoli della superficie B che cadono nel box del triangolo corrente della Superficie A.
|
||||||
|
for ( int nTB : vNearTria) {
|
||||||
|
// Recupero il triangolo corrente della superficie B.
|
||||||
|
// Se triangolo non valido salto al successivo.
|
||||||
|
Triangle3d trTriaB ;
|
||||||
|
if ( ! ( pSrfB->GetTriangle( nTB, trTriaB) && trTriaB.Validate()))
|
||||||
|
continue ;
|
||||||
|
// Se necessario considero l'offset
|
||||||
|
if ( dSafeDist > EPS_SMALL) {
|
||||||
|
int nAdjTriaId[3] ;
|
||||||
|
pSrfB->GetTriangleAdjacencies( nTB, nAdjTriaId) ;
|
||||||
|
// Ciclo sui vertici del triangolo.
|
||||||
|
for ( int nVB = 0 ; nVB < 3 ; ++ nVB) {
|
||||||
|
// Se il triangolo adiacente al triangolo corrente su questo edge
|
||||||
|
// non è stato processato, processo il vertice e l'edge.
|
||||||
|
int nAdjTriaTempFlag ;
|
||||||
|
if ( ! ( pSrfB->GetTempInt( nAdjTriaId[nVB], nAdjTriaTempFlag) || nAdjTriaTempFlag == 0))
|
||||||
|
continue ;
|
||||||
|
// Processo il vertice: se c'è collisione fra triangolo A e sfera ho finito.
|
||||||
|
if ( CDeSimpleSpheTria( trTriaB.GetP( nVB), dSafeDist, trTriaA))
|
||||||
|
return true ;
|
||||||
|
// Processo l'edge: se c'è collisione fra triangolo A e cilindro ho finito.
|
||||||
|
Vector3d vtEdgeV = trTriaB.GetP( ( nVB + 1) % 3) - trTriaB.GetP( nVB) ;
|
||||||
|
double dEdgeLen = vtEdgeV.Len() ;
|
||||||
|
vtEdgeV /= dEdgeLen ;
|
||||||
|
Frame3d frCyl ;
|
||||||
|
frCyl.Set( trTriaB.GetP( nVB), vtEdgeV) ;
|
||||||
|
if ( CDeSimpleCylTria( frCyl, dSafeDist, dEdgeLen, trTriaA))
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
// Traslo il triangolo
|
||||||
|
trTriaB.Translate( dSafeDist * trTriaB.GetN()) ;
|
||||||
|
}
|
||||||
|
// Processo il triangolo: se i due triangoli collidono ho finito.
|
||||||
|
if ( CDeTriaTria( trTriaA, trTriaB))
|
||||||
|
return true ;
|
||||||
|
// Segno il triangolo come processato: nTemp = 1
|
||||||
|
pSrfB->SetTempInt( nTB, 1) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Non c'è interferenza
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2020-2020
|
// EgalTech 2020-2024
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : CDCylSurfTm.cpp Data : 09.11.20 Versione :
|
// File : CDeConeFrustumClosedSurfTm.cpp Data : 24.031.24 Versione : 2.6c2
|
||||||
// Contenuto : Implementazione della verifica di collisione tra
|
// Contenuto : Implementazione della verifica di collisione tra
|
||||||
// Cone e Closed SurftriMesh.
|
// Cone e Closed SurftriMesh.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Modifiche : 09.11.20 LM Creazione modulo.
|
// Modifiche : 09.11.20 LM Creazione modulo.
|
||||||
|
// 24.03.24 DS Aggiunta TestConeFrustumSurfTm.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -21,15 +22,22 @@ using namespace std ;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Il sistema di riferimento deve avere l'asse di simmetria del cono come asse Z e origine nel centro della base.
|
// Il sistema di riferimento deve avere l'asse di simmetria del cono come asse Z e origine nel centro della base.
|
||||||
// La distanza di sicurezza ha effetto solo se maggiore di epsilon, altrimenti è ignorata ed è ininfluente.
|
// La distanza di sicurezza ha effetto solo se maggiore di EPS_SMALL, altrimenti è ignorata ed è ininfluente.
|
||||||
// Il sistema di riferimento del cono deve essere immerso in quello della superficie.
|
// Il sistema di riferimento del cono è riferito a quello della superficie.
|
||||||
|
// La funzione restituisce :
|
||||||
|
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||||
|
// - false in caso di assenza di collisione.
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeConeFrustumClosedSurfTm( const Frame3d& frCone, double dBaseRad, double dTopRad, double dHeight,
|
CDeConeFrustumClosedSurfTm( const Frame3d& frCone, double dBaseRad, double dTopRad, double dHeight,
|
||||||
double dSafeDist, const ISurfTriMesh& Stm)
|
const ISurfTriMesh& Stm, double dSafeDist)
|
||||||
{
|
{
|
||||||
// Se il tronco di cono non è ben definito non ha senso proseguire
|
// Se il tronco di cono non è ben definito non ha senso proseguire
|
||||||
if ( max( dBaseRad, dTopRad) < EPS_SMALL || dHeight < EPS_SMALL)
|
if ( max( dBaseRad, dTopRad) < EPS_SMALL || dHeight < EPS_SMALL)
|
||||||
return false ;
|
return true ;
|
||||||
|
// Se superficie non valida o aperta, non ha senso proseguire
|
||||||
|
if ( ! Stm.IsValid() || ! Stm.IsClosed())
|
||||||
|
return true ;
|
||||||
// Recupero BBox della trimesh
|
// Recupero BBox della trimesh
|
||||||
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
||||||
// Calcolo il BBox del tronco di cono
|
// Calcolo il BBox del tronco di cono
|
||||||
@@ -49,13 +57,10 @@ CDeConeFrustumClosedSurfTm( const Frame3d& frCone, double dBaseRad, double dTopR
|
|||||||
for ( int nT : vT) {
|
for ( int nT : vT) {
|
||||||
Triangle3d trTria ;
|
Triangle3d trTria ;
|
||||||
if ( Stm.GetTriangle( nT, trTria)) {
|
if ( Stm.GetTriangle( nT, trTria)) {
|
||||||
if ( CDeConeFrustumTria( frCone, dBaseRad, dTopRad, dHeight, dSafeDist, trTria))
|
if ( CDeConeFrustumTria( frCone, dBaseRad, dTopRad, dHeight, trTria, dSafeDist))
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Se superficie aperta, non c'è collisione
|
|
||||||
if ( ! Stm.IsClosed())
|
|
||||||
return false ;
|
|
||||||
// Se il BBox del tronco di cono non è interno a quello del poliedro e viceversa, non c'è collisione
|
// Se il BBox del tronco di cono non è interno a quello del poliedro e viceversa, non c'è collisione
|
||||||
if ( ! b3Surf.Encloses( b3Cone) && ! b3Cone.Encloses( b3Surf))
|
if ( ! b3Surf.Encloses( b3Cone) && ! b3Cone.Encloses( b3Surf))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -66,3 +71,43 @@ CDeConeFrustumClosedSurfTm( const Frame3d& frCone, double dBaseRad, double dTopR
|
|||||||
// Se il tronco di cono è interno c'è collisione
|
// Se il tronco di cono è interno c'è collisione
|
||||||
return DistConeCenSurfCalc.IsPointInside() ;
|
return DistConeCenSurfCalc.IsPointInside() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Verifica l'interferenza tra il tronco di cono e la superficie : restituisce true in caso di interferenza.
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
TestConeFrustumSurfTm( const Frame3d& frCone, double dBaseRad, double dTopRad, double dHeight,
|
||||||
|
const ISurfTriMesh& Stm, double dSafeDist)
|
||||||
|
{
|
||||||
|
// Se il tronco di cono non è ben definito non ha senso proseguire
|
||||||
|
if ( max( dBaseRad, dTopRad) < EPS_SMALL || dHeight < EPS_SMALL)
|
||||||
|
return true ;
|
||||||
|
// Se superficie non valida, non ha senso proseguire
|
||||||
|
if ( ! Stm.IsValid())
|
||||||
|
return true ;
|
||||||
|
// Recupero BBox della trimesh
|
||||||
|
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
||||||
|
// Calcolo il BBox del tronco di cono
|
||||||
|
double dMaxRad = max( dBaseRad, dTopRad) ;
|
||||||
|
BBox3d b3ConeL( Point3d( -dMaxRad, -dMaxRad, 0),
|
||||||
|
Point3d( dMaxRad, dMaxRad, dHeight)) ;
|
||||||
|
if ( dSafeDist > EPS_SMALL)
|
||||||
|
b3ConeL.Expand( dSafeDist) ;
|
||||||
|
BBox3d b3Cone = GetToGlob( b3ConeL, frCone) ;
|
||||||
|
// Se i BBox non interferiscono, non c'è collisione
|
||||||
|
if ( ! b3Surf.Overlaps( b3Cone) || ! b3Surf.Overlaps( frCone, b3ConeL))
|
||||||
|
return false ;
|
||||||
|
// Recupero i triangoli che interferiscono con il box del cono
|
||||||
|
INTVECTOR vT ;
|
||||||
|
Stm.GetAllTriaOverlapBox( b3Cone, vT) ;
|
||||||
|
// Verifico se il tronco di cono interferisce con i triangoli del poliedro presenti nel suo BBox
|
||||||
|
for ( int nT : vT) {
|
||||||
|
Triangle3d trTria ;
|
||||||
|
if ( Stm.GetTriangle( nT, trTria)) {
|
||||||
|
if ( CDeConeFrustumTria( frCone, dBaseRad, dTopRad, dHeight, trTria, dSafeDist))
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Non c'è interferenza
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ CDeSimpleConeFrustumTria( const Frame3d& frCone, double dMinRad, double dMaxRad,
|
|||||||
// La distanza di sicurezza ha effetto solo se maggiore di epsilon, altrimenti è ignorata ed è ininfluente.
|
// La distanza di sicurezza ha effetto solo se maggiore di epsilon, altrimenti è ignorata ed è ininfluente.
|
||||||
bool
|
bool
|
||||||
CDeConeFrustumTria( const Frame3d& frCone, double dBaseRad, double dTopRad, double dHeight,
|
CDeConeFrustumTria( const Frame3d& frCone, double dBaseRad, double dTopRad, double dHeight,
|
||||||
double dSafeDist, const Triangle3d& trTria)
|
const Triangle3d& trTria, double dSafeDist)
|
||||||
{
|
{
|
||||||
// Se il tronco di cono o il triangolo non sono ben definiti non procedo
|
// Se il tronco di cono o il triangolo non sono ben definiti non procedo
|
||||||
if ( max( dBaseRad, dTopRad) < EPS_SMALL || dHeight < EPS_SMALL || ! trTria.IsValid())
|
if ( max( dBaseRad, dTopRad) < EPS_SMALL || dHeight < EPS_SMALL || ! trTria.IsValid())
|
||||||
@@ -142,7 +142,7 @@ CDeConeFrustumTria( const Frame3d& frCone, double dBaseRad, double dTopRad, doub
|
|||||||
|
|
||||||
// Se è un cilindro chiamo la routine apposita.
|
// Se è un cilindro chiamo la routine apposita.
|
||||||
if ( abs( dBaseRad - dTopRad) < EPS_SMALL)
|
if ( abs( dBaseRad - dTopRad) < EPS_SMALL)
|
||||||
return CDeCylTria( frCone, max( dBaseRad, dTopRad), dHeight, dSafeDist, trTria) ;
|
return CDeCylTria( frCone, max( dBaseRad, dTopRad), dHeight, trTria, dSafeDist) ;
|
||||||
|
|
||||||
// Se il raggio di base è maggiore del raggio top cambio il sistema di riferimento.
|
// Se il raggio di base è maggiore del raggio top cambio il sistema di riferimento.
|
||||||
double dMinRad = dBaseRad ;
|
double dMinRad = dBaseRad ;
|
||||||
@@ -156,11 +156,11 @@ CDeConeFrustumTria( const Frame3d& frCone, double dBaseRad, double dTopRad, doub
|
|||||||
|
|
||||||
// Se è un cono, chiamo la routine apposita
|
// Se è un cono, chiamo la routine apposita
|
||||||
if ( dMinRad < EPS_SMALL)
|
if ( dMinRad < EPS_SMALL)
|
||||||
return CDeConeTria( frMyCone, dMaxRad, dHeight, dSafeDist, trTria) ;
|
return CDeConeTria( frMyCone, dMaxRad, dHeight, trTria, dSafeDist) ;
|
||||||
|
|
||||||
// Se distanza di sicurezza nulla
|
// Se distanza di sicurezza nulla
|
||||||
if ( dSafeDist < EPS_SMALL)
|
if ( dSafeDist < EPS_SMALL)
|
||||||
return CDeSimpleConeFrustumTria( frMyCone, dBaseRad, dTopRad, dHeight, trTria ) ;
|
return CDeSimpleConeFrustumTria( frMyCone, dBaseRad, dTopRad, dHeight, trTria) ;
|
||||||
|
|
||||||
// Verifica preliminare con tronco di cono esteso
|
// Verifica preliminare con tronco di cono esteso
|
||||||
double dDiffRad = dMaxRad - dMinRad ;
|
double dDiffRad = dMaxRad - dMinRad ;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2020-2020
|
// EgalTech 2020-2020
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : CDeConTria.cpp Data : 28.10.20 Versione : 2.2k1
|
// File : CDeConeFrustumTria.h Data : 28.10.20 Versione : 2.2k1
|
||||||
// Contenuto : Dichiarazione della verifica di collisione tra
|
// Contenuto : Dichiarazione della verifica di collisione tra
|
||||||
// Cone e Triangle3d.
|
// Cone e Triangle3d.
|
||||||
//
|
//
|
||||||
@@ -20,6 +20,5 @@
|
|||||||
// Il sistema di riferimento deve avere l'origine nel centro della base minore e l'asse
|
// Il sistema di riferimento deve avere l'origine nel centro della base minore e l'asse
|
||||||
// di simmetria del cono, rivolto verso la direzione di apertura, come asse Z.
|
// di simmetria del cono, rivolto verso la direzione di apertura, come asse Z.
|
||||||
bool CDeSimpleConeFrustumTria( const Frame3d& frCone, double dMinRad, double dMaxRad, double dHeight, const Triangle3d& trTria) ;
|
bool CDeSimpleConeFrustumTria( const Frame3d& frCone, double dMinRad, double dMaxRad, double dHeight, const Triangle3d& trTria) ;
|
||||||
// Il sistema di riferimento ha l'asse Z coincidente con l'asse di simmetria del cono e l'origine nel centro della base.
|
|
||||||
bool CDeConeFrustumTria( const Frame3d& frCone, double dBaseRad, double dTopRad, double dHeight,
|
bool CDeConeFrustumTria( const Frame3d& frCone, double dBaseRad, double dTopRad, double dHeight,
|
||||||
double dSafeDist, const Triangle3d& trTria) ;
|
const Triangle3d& trTria, double dSafeDist) ;
|
||||||
|
|||||||
+1
-1
@@ -111,7 +111,7 @@ CDeSimpleConeTria( const Frame3d& frCone, double dRad, double dHeight, const Tri
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeConeTria( const Frame3d& frCone, double dRad, double dHeight, double dSafeDist, const Triangle3d& trTria)
|
CDeConeTria( const Frame3d& frCone, double dRad, double dHeight, const Triangle3d& trTria, double dSafeDist)
|
||||||
{
|
{
|
||||||
// Verifico validità del cono
|
// Verifico validità del cono
|
||||||
if ( dRad < EPS_SMALL || dHeight < EPS_SMALL)
|
if ( dRad < EPS_SMALL || dHeight < EPS_SMALL)
|
||||||
|
|||||||
+1
-1
@@ -19,4 +19,4 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Il sistema di riferimento ha asse Z coincidente con l'asse del cono e origine nel vertice del cono (punto più basso).
|
// Il sistema di riferimento ha asse Z coincidente con l'asse del cono e origine nel vertice del cono (punto più basso).
|
||||||
bool CDeSimpleConeTria( const Frame3d& frCone, double dRad, double dHeight, const Triangle3d& trTria) ;
|
bool CDeSimpleConeTria( const Frame3d& frCone, double dRad, double dHeight, const Triangle3d& trTria) ;
|
||||||
bool CDeConeTria( const Frame3d& frCone, double dRad, double dHeight, double dSafeDist, const Triangle3d& trTria) ;
|
bool CDeConeTria( const Frame3d& frCone, double dRad, double dHeight, const Triangle3d& trTria, double dSafeDist) ;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2020-2020
|
// EgalTech 2020-2024
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : CDeConvexTorusTria.cpp Data : 18.11.20 Versione :
|
// File : CDeConvexTorusTria.cpp Data : 24.03.24 Versione : 2.6c2
|
||||||
// Contenuto : Implementazione funzione verifica collisione tra
|
// Contenuto : Implementazione funzione verifica collisione tra
|
||||||
// toro convesso e SurfTriMesh.
|
// toro convesso e SurfTriMesh.
|
||||||
//
|
//
|
||||||
// Modifiche : 18.11.20 LM Creazione modulo.
|
// Modifiche : 18.11.20 LM Creazione modulo.
|
||||||
//
|
// 24.03.24 DS Aggiunta TestConvexTorusSurfTm.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -18,17 +18,23 @@
|
|||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Il toro convesso è il disco limitato dalla sola parte esterna del toro.
|
// Il toro convesso è il solido a disco limitato dalla sola parte esterna del toro.
|
||||||
// Raggio principale R1, raggio secondario R2.
|
// Raggio principale R1, raggio secondario R2.
|
||||||
// Il toro è posto nel piano XY del suo riferimento, centrato sull'origine.
|
// Il toro è posto nel piano XY del suo riferimento, centrato sull'origine.
|
||||||
// La funzione restituisce true in caso di collisione.
|
// La funzione restituisce :
|
||||||
|
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||||
|
// - false in caso di assenza di collisione.
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeConvexTorusClosedSurfTm( const Frame3d& frTorus, double dRad1, double dRad2,
|
CDeConvexTorusClosedSurfTm( const Frame3d& frTorus, double dRad1, double dRad2,
|
||||||
double dSafeDist, const ISurfTriMesh& Stm)
|
const ISurfTriMesh& Stm, double dSafeDist)
|
||||||
{
|
{
|
||||||
// I raggi devono essere non nulli e la superficie ben definita.
|
// I raggi devono essere non nulli
|
||||||
if ( dRad1 < EPS_SMALL || dRad2 < EPS_SMALL || ! Stm.IsValid())
|
if ( dRad1 < EPS_SMALL || dRad2 < EPS_SMALL)
|
||||||
return false ;
|
return true ;
|
||||||
|
// Se superficie non valida o aperta, non ha senso proseguire
|
||||||
|
if ( ! Stm.IsValid() || ! Stm.IsClosed())
|
||||||
|
return true ;
|
||||||
// Box della superficie
|
// Box della superficie
|
||||||
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
||||||
// Box del toro (sempre completo)
|
// Box del toro (sempre completo)
|
||||||
@@ -47,13 +53,10 @@ CDeConvexTorusClosedSurfTm( const Frame3d& frTorus, double dRad1, double dRad2,
|
|||||||
for ( int nT : vT) {
|
for ( int nT : vT) {
|
||||||
Triangle3d trTria ;
|
Triangle3d trTria ;
|
||||||
if ( Stm.GetTriangle( nT, trTria)) {
|
if ( Stm.GetTriangle( nT, trTria)) {
|
||||||
if ( CDeConvexTorusTria( frTorus, dRad1, dRad2, CT_TOT, dSafeDist, trTria))
|
if ( CDeConvexTorusTria( frTorus, dRad1, dRad2, CT_TOT, trTria, dSafeDist))
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Se superficie aperta, non c'è collisione
|
|
||||||
if ( ! Stm.IsClosed())
|
|
||||||
return false ;
|
|
||||||
// Se il BBox del toro non è interno a quello del poliedro e viceversa, non c'è collisione
|
// Se il BBox del toro non è interno a quello del poliedro e viceversa, non c'è collisione
|
||||||
if ( ! b3Surf.Encloses( b3Torus) && ! b3Torus.Encloses( b3Surf))
|
if ( ! b3Surf.Encloses( b3Torus) && ! b3Torus.Encloses( b3Surf))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -63,3 +66,42 @@ CDeConvexTorusClosedSurfTm( const Frame3d& frTorus, double dRad1, double dRad2,
|
|||||||
// Se il toro è interno c'è collisione
|
// Se il toro è interno c'è collisione
|
||||||
return ( DistConeOrigSurfCalc.IsPointInside()) ;
|
return ( DistConeOrigSurfCalc.IsPointInside()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Verifica l'interferenza tra il toro convesso e la superficie : restituisce true in caso di interferenza
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
TestConvexTorusSurfTm( const Frame3d& frTorus, double dRad1, double dRad2,
|
||||||
|
const ISurfTriMesh& Stm, double dSafeDist)
|
||||||
|
{
|
||||||
|
// I raggi devono essere non nulli
|
||||||
|
if ( dRad1 < EPS_SMALL || dRad2 < EPS_SMALL)
|
||||||
|
return true ;
|
||||||
|
// Se superficie non valida, non ha senso proseguire
|
||||||
|
if ( ! Stm.IsValid())
|
||||||
|
return true ;
|
||||||
|
// Box della superficie
|
||||||
|
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
||||||
|
// Box del toro (sempre completo)
|
||||||
|
BBox3d b3TorusL( Point3d( -dRad1 - dRad2, -dRad1 - dRad2, -dRad2),
|
||||||
|
Point3d( dRad1 + dRad2, dRad1 + dRad2, dRad2)) ;
|
||||||
|
if ( dSafeDist > EPS_SMALL)
|
||||||
|
b3TorusL.Expand( dSafeDist) ;
|
||||||
|
BBox3d b3Torus = GetToGlob( b3TorusL, frTorus) ;
|
||||||
|
// Se i BBox non interferiscono, non c'è collisione
|
||||||
|
if ( ! b3Surf.Overlaps( b3Torus) || ! b3Surf.Overlaps( frTorus, b3TorusL))
|
||||||
|
return false ;
|
||||||
|
// Recupero i triangoli che interferiscono con il box del toro
|
||||||
|
INTVECTOR vT ;
|
||||||
|
Stm.GetAllTriaOverlapBox( b3Torus, vT) ;
|
||||||
|
// Verifico se il toro interferisce con i triangoli del poliedro presenti nel suo BBox
|
||||||
|
for ( int nT : vT) {
|
||||||
|
Triangle3d trTria ;
|
||||||
|
if ( Stm.GetTriangle( nT, trTria)) {
|
||||||
|
if ( CDeConvexTorusTria( frTorus, dRad1, dRad2, CT_TOT, trTria, dSafeDist))
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Non c'è interferenza
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ CDeSimpleConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, in
|
|||||||
bool bContinue = plyApprox.GetFirstPoint( ptSt) && plyApprox.GetNextPoint( ptEn) ;
|
bool bContinue = plyApprox.GetFirstPoint( ptSt) && plyApprox.GetNextPoint( ptEn) ;
|
||||||
while ( bContinue && ! bCollision) {
|
while ( bContinue && ! bCollision) {
|
||||||
frConus.Set( Point3d( 0., 0., ptSt.z), Frame3d::TOP) ;
|
frConus.Set( Point3d( 0., 0., ptSt.z), Frame3d::TOP) ;
|
||||||
bCollision = CDeConeFrustumTria( frConus, ptSt.x, ptEn.x, ptEn.z - ptSt.z, 0., trMyTria) ;
|
bCollision = CDeSimpleConeFrustumTria( frConus, ptSt.x, ptEn.x, ptEn.z - ptSt.z, trMyTria) ;
|
||||||
ptSt = ptEn ;
|
ptSt = ptEn ;
|
||||||
bContinue = plyApprox.GetNextPoint( ptEn) ;
|
bContinue = plyApprox.GetNextPoint( ptEn) ;
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ CDeSimpleConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, in
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, int nCtType,
|
CDeConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, int nCtType,
|
||||||
double dSafeDist, const Triangle3d& trTria)
|
const Triangle3d& trTria, double dSafeDist)
|
||||||
{
|
{
|
||||||
// I raggi devono essere non nulli e il triangolo ben definito.
|
// I raggi devono essere non nulli e il triangolo ben definito.
|
||||||
if ( dRad1 < EPS_SMALL || dRad2 < EPS_SMALL || ! trTria.IsValid())
|
if ( dRad1 < EPS_SMALL || dRad2 < EPS_SMALL || ! trTria.IsValid())
|
||||||
|
|||||||
@@ -28,4 +28,4 @@ enum ConvexTorusType { CT_INF = -1, CT_SUP = 1, CT_TOT = 0} ;
|
|||||||
bool CDeSimpleConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, int nCtType,
|
bool CDeSimpleConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, int nCtType,
|
||||||
const Triangle3d& trTria) ;
|
const Triangle3d& trTria) ;
|
||||||
bool CDeConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, int nCtType,
|
bool CDeConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, int nCtType,
|
||||||
double dSafeDist, const Triangle3d& trTria) ;
|
const Triangle3d& trTria, double dSafeDist) ;
|
||||||
+62
-9
@@ -1,13 +1,13 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2020-2020
|
// EgalTech 2020-2024
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : CDCylSurfTm.cpp Data : 09.01.20 Versione : 2.2a2
|
// File : CDeCylClosedSurfTm.cpp Data : 24.03.24 Versione : 2.6c2
|
||||||
// Contenuto : Implementazione della verifica di collisione tra
|
// Contenuto : Implementazione della verifica di collisione tra
|
||||||
// Cylinder e Closed SurftriMesh.
|
// Cylinder e Closed SurftriMesh.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Modifiche : 09.01.20 DS Creazione modulo.
|
// Modifiche : 09.01.20 DS Creazione modulo.
|
||||||
//
|
// 24.03.24 DS Aggiunta TestCylSurfTm.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -19,17 +19,30 @@
|
|||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Il sistema di riferimento deve avere l'asse di simmetria del cilindro come asse Z e origine nel centro della base o del top.
|
||||||
|
// La distanza di sicurezza ha effetto solo se maggiore di EPS_SMALL, altrimenti è ignorata ed è ininfluente.
|
||||||
|
// Il sistema di riferimento del cilindro è riferito a quello della superficie.
|
||||||
|
// La funzione restituisce :
|
||||||
|
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||||
|
// - false in caso di assenza di collisione.
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, double dSafeDist, const ISurfTriMesh& Stm)
|
CDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, const ISurfTriMesh& Stm, double dSafeDist)
|
||||||
{
|
{
|
||||||
|
// Il cilindro deve essere ben definito
|
||||||
|
if ( dR < EPS_SMALL || dH < EPS_SMALL)
|
||||||
|
return true ;
|
||||||
|
// Se superficie non valida o aperta, non ha senso proseguire
|
||||||
|
if ( ! Stm.IsValid() || ! Stm.IsClosed())
|
||||||
|
return true ;
|
||||||
// Recupero BBox del poliedro
|
// Recupero BBox del poliedro
|
||||||
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
||||||
// Sistemazioni cilindro
|
// Sistemazioni cilindro
|
||||||
Frame3d frMyCyl = frCyl ;
|
Frame3d frMyCyl = frCyl ;
|
||||||
if ( dH < 0) {
|
if ( dH < 0) {
|
||||||
frMyCyl.Translate( dH * frMyCyl.VersZ()) ;
|
frMyCyl.Translate( dH * frMyCyl.VersZ()) ;
|
||||||
dH = - dH ;
|
dH = -dH ;
|
||||||
}
|
}
|
||||||
// Calcolo il BBox del cilindro
|
// Calcolo il BBox del cilindro
|
||||||
BBox3d b3CylL( Point3d( -dR, -dR, 0),
|
BBox3d b3CylL( Point3d( -dR, -dR, 0),
|
||||||
@@ -46,13 +59,10 @@ CDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, double dSafeDist
|
|||||||
for ( int nT : vT) {
|
for ( int nT : vT) {
|
||||||
Triangle3d Tria ;
|
Triangle3d Tria ;
|
||||||
if ( Stm.GetTriangle( nT, Tria)) {
|
if ( Stm.GetTriangle( nT, Tria)) {
|
||||||
if ( CDeCylTria( frMyCyl, dR, dH, dSafeDist, Tria))
|
if ( CDeCylTria( frMyCyl, dR, dH, Tria, dSafeDist))
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Se superficie aperta, non c'è collisione
|
|
||||||
if ( ! Stm.IsClosed())
|
|
||||||
return false ;
|
|
||||||
// Se il BBox del cilindro non è interno a quello del poliedro e viceversa, non c'è collisione
|
// Se il BBox del cilindro non è interno a quello del poliedro e viceversa, non c'è collisione
|
||||||
if ( ! b3Poly.Encloses( b3Cyl) && ! b3Cyl.Encloses( b3Poly))
|
if ( ! b3Poly.Encloses( b3Cyl) && ! b3Cyl.Encloses( b3Poly))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -63,3 +73,46 @@ CDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, double dSafeDist
|
|||||||
// Se il cilindro è interno c'è collisione
|
// Se il cilindro è interno c'è collisione
|
||||||
return ( DistCylCenSurfCalc.IsPointInside()) ;
|
return ( DistCylCenSurfCalc.IsPointInside()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Verifica l'interferenza tra il cilindro e la superficie : restituisce true in caso di interferenza
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
TestCylSurfTm( const Frame3d& frCyl, double dR, double dH, const ISurfTriMesh& Stm, double dSafeDist)
|
||||||
|
{
|
||||||
|
// Il cilindro deve essere ben definito
|
||||||
|
if ( dR < EPS_SMALL || dH < EPS_SMALL)
|
||||||
|
return true ;
|
||||||
|
// Se superficie non valida, non ha senso proseguire
|
||||||
|
if ( ! Stm.IsValid())
|
||||||
|
return true ;
|
||||||
|
// Recupero BBox della superficie poligonale
|
||||||
|
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
||||||
|
// Sistemazioni cilindro
|
||||||
|
Frame3d frMyCyl = frCyl ;
|
||||||
|
if ( dH < 0) {
|
||||||
|
frMyCyl.Translate( dH * frMyCyl.VersZ()) ;
|
||||||
|
dH = -dH ;
|
||||||
|
}
|
||||||
|
// Calcolo il BBox del cilindro
|
||||||
|
BBox3d b3CylL( Point3d( -dR, -dR, 0),
|
||||||
|
Point3d( dR, dR, dH)) ;
|
||||||
|
if ( dSafeDist > EPS_SMALL)
|
||||||
|
b3CylL.Expand( dSafeDist) ;
|
||||||
|
BBox3d b3Cyl = GetToGlob( b3CylL, frMyCyl) ;
|
||||||
|
// Se i BBox non interferiscono, non c'è interferenza
|
||||||
|
if ( ! b3Poly.Overlaps( b3Cyl) || ! b3Poly.Overlaps( frMyCyl, b3CylL))
|
||||||
|
return false ;
|
||||||
|
// Verifico se il cilindro interferisce con i triangoli del poliedro presenti nel suo BBox
|
||||||
|
INTVECTOR vT ;
|
||||||
|
Stm.GetAllTriaOverlapBox( b3Cyl, vT) ;
|
||||||
|
for ( int nT : vT) {
|
||||||
|
Triangle3d Tria ;
|
||||||
|
if ( Stm.GetTriangle( nT, Tria)) {
|
||||||
|
if ( CDeCylTria( frMyCyl, dR, dH, Tria, dSafeDist))
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Non c'è interferenza
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|||||||
+2
-2
@@ -13,9 +13,9 @@
|
|||||||
|
|
||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "DistPointLine.h"
|
|
||||||
#include "CDeCylTria.h"
|
#include "CDeCylTria.h"
|
||||||
#include "CDeConvexTorusTria.h"
|
#include "CDeConvexTorusTria.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkPolygon3d.h"
|
#include "/EgtDev/Include/EGkPolygon3d.h"
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
@@ -84,7 +84,7 @@ CDeSimpleCylTria( const Frame3d& frCyl, double dR, double dH, const Triangle3d&
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeCylTria( const Frame3d& frCyl, double dR, double dH, double dSafeDist, const Triangle3d& trTria)
|
CDeCylTria( const Frame3d& frCyl, double dR, double dH, const Triangle3d& trTria, double dSafeDist)
|
||||||
{
|
{
|
||||||
// Se distanza di sicurezza nulla
|
// Se distanza di sicurezza nulla
|
||||||
if ( dSafeDist < EPS_SMALL)
|
if ( dSafeDist < EPS_SMALL)
|
||||||
|
|||||||
+1
-1
@@ -16,4 +16,4 @@
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool CDeSimpleCylTria( const Frame3d& frCyl, double dR, double dH, const Triangle3d& trTria) ;
|
bool CDeSimpleCylTria( const Frame3d& frCyl, double dR, double dH, const Triangle3d& trTria) ;
|
||||||
bool CDeCylTria( const Frame3d& frCyl, double dR, double dH, double dSafeDist, const Triangle3d& trTria) ;
|
bool CDeCylTria( const Frame3d& frCyl, double dR, double dH, const Triangle3d& trTria, double dSafeDist) ;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2020-2020
|
// EgalTech 2020-2024
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : CDePyramidClosedSurfTm.h Data : 09.11.20 Versione :
|
// File : CDeRectPrismoidClosedSurfTm.h Data : 24.03.24 Versione : 2.6c2
|
||||||
// Contenuto : Implementazione funzione verifica collisione tra
|
// Contenuto : Implementazione funzione verifica collisione tra
|
||||||
// Prismoide a basi rettangolari e Closed SurfTriMesh.
|
// Prismoide a basi rettangolari e Closed SurfTriMesh.
|
||||||
//
|
//
|
||||||
// Modifiche : 09.11.20 LM Creazione modulo.
|
// Modifiche : 09.11.20 LM Creazione modulo.
|
||||||
//
|
// 24.03.24 DS Aggiunta TestRectPrismoidSurfTm.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -22,16 +22,23 @@ using namespace std ;
|
|||||||
// Il sistema di riferimento deve avere l'origine nel centro della Base, asse X lungo
|
// Il sistema di riferimento deve avere l'origine nel centro della Base, asse X lungo
|
||||||
// un segmento della stessa e asse Z ortogonale alle basi e diretta verso la base Top.
|
// un segmento della stessa e asse Z ortogonale alle basi e diretta verso la base Top.
|
||||||
// Il sistema di riferimento della piramide deve essere immerso in quello della superficie.
|
// Il sistema di riferimento della piramide deve essere immerso in quello della superficie.
|
||||||
|
// La funzione restituisce :
|
||||||
|
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||||
|
// - false in caso di assenza di collisione.
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dLenghtBaseX, double dLenghtBaseY,
|
CDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dLenghtBaseX, double dLenghtBaseY,
|
||||||
double dLenghtTopX, double dLenghtTopY, double dHeight,
|
double dLenghtTopX, double dLenghtTopY, double dHeight,
|
||||||
double dSafeDist, const ISurfTriMesh& Stm)
|
const ISurfTriMesh& Stm, double dSafeDist)
|
||||||
{
|
{
|
||||||
// Se il tronco di piramide non è definito o la superficie non ben definita non ha senso proseguire.
|
// Se il tronco di piramide non è definito non ha senso proseguire.
|
||||||
if ( max( dLenghtBaseX, dLenghtTopX) < EPS_SMALL ||
|
if ( max( dLenghtBaseX, dLenghtTopX) < EPS_SMALL ||
|
||||||
max( dLenghtBaseY, dLenghtTopY) < EPS_SMALL ||
|
max( dLenghtBaseY, dLenghtTopY) < EPS_SMALL ||
|
||||||
dHeight < EPS_SMALL || ! Stm.IsValid())
|
dHeight < EPS_SMALL)
|
||||||
return false ;
|
return true ;
|
||||||
|
// Se superficie non valida o aperta, non ha senso proseguire
|
||||||
|
if ( ! Stm.IsValid() || ! Stm.IsClosed())
|
||||||
|
return true ;
|
||||||
// Recupero BBox della trimesh
|
// Recupero BBox della trimesh
|
||||||
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
||||||
// Calcolo il BBox del tronco di piramide
|
// Calcolo il BBox del tronco di piramide
|
||||||
@@ -53,13 +60,10 @@ CDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dLenghtBaseX, dou
|
|||||||
Triangle3d trTria ;
|
Triangle3d trTria ;
|
||||||
if ( Stm.GetTriangle( nT, trTria)) {
|
if ( Stm.GetTriangle( nT, trTria)) {
|
||||||
if ( CDeRectPrismoidTria( frPrismoid, dLenghtBaseX, dLenghtBaseY, dLenghtTopX, dLenghtTopY, dHeight,
|
if ( CDeRectPrismoidTria( frPrismoid, dLenghtBaseX, dLenghtBaseY, dLenghtTopX, dLenghtTopY, dHeight,
|
||||||
dSafeDist, trTria))
|
trTria, dSafeDist))
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Se superficie aperta, non c'è collisione
|
|
||||||
if ( ! Stm.IsClosed())
|
|
||||||
return false ;
|
|
||||||
// Se il BBox del tronco di piramide non è interno a quello del poliedro e viceversa, non c'è collisione
|
// Se il BBox del tronco di piramide non è interno a quello del poliedro e viceversa, non c'è collisione
|
||||||
if ( ! b3Surf.Encloses( b3Pyr) && ! b3Pyr.Encloses( b3Surf))
|
if ( ! b3Surf.Encloses( b3Pyr) && ! b3Pyr.Encloses( b3Surf))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -70,3 +74,48 @@ CDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dLenghtBaseX, dou
|
|||||||
// C'è collisione se il tronco di piramide è interno
|
// C'è collisione se il tronco di piramide è interno
|
||||||
return ( DistPyrCenSurfCalc.IsPointInside()) ;
|
return ( DistPyrCenSurfCalc.IsPointInside()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Verifica l'interferenza tra il Prismoide a basi rettangolari e la superficie : restituisce true in caso di interferenza.
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
TestRectPrismoidSurfTm( const Frame3d& frPrismoid, double dLenghtBaseX, double dLenghtBaseY,
|
||||||
|
double dLenghtTopX, double dLenghtTopY, double dHeight,
|
||||||
|
const ISurfTriMesh& Stm, double dSafeDist)
|
||||||
|
{
|
||||||
|
// Se il tronco di piramide non è definito non ha senso proseguire.
|
||||||
|
if ( max( dLenghtBaseX, dLenghtTopX) < EPS_SMALL ||
|
||||||
|
max( dLenghtBaseY, dLenghtTopY) < EPS_SMALL ||
|
||||||
|
dHeight < EPS_SMALL)
|
||||||
|
return true ;
|
||||||
|
// Se superficie non valida, non ha senso proseguire
|
||||||
|
if ( ! Stm.IsValid())
|
||||||
|
return true ;
|
||||||
|
// Recupero BBox della trimesh
|
||||||
|
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
||||||
|
// Calcolo il BBox del tronco di piramide
|
||||||
|
double dMaxLenX = max( dLenghtBaseX, dLenghtTopX) ;
|
||||||
|
double dMaxLenY = max( dLenghtBaseY, dLenghtTopY) ;
|
||||||
|
BBox3d b3PyrL( Point3d( -dMaxLenX / 2, -dMaxLenY / 2, 0.),
|
||||||
|
Point3d( dMaxLenX / 2, dMaxLenY / 2, dHeight)) ;
|
||||||
|
if ( dSafeDist > EPS_SMALL)
|
||||||
|
b3PyrL.Expand( dSafeDist) ;
|
||||||
|
BBox3d b3Pyr = GetToGlob( b3PyrL, frPrismoid) ;
|
||||||
|
// Se i BBox non interferiscono, non c'è collisione
|
||||||
|
if ( ! b3Surf.Overlaps( b3Pyr) || ! b3Surf.Overlaps( frPrismoid, b3PyrL))
|
||||||
|
return false ;
|
||||||
|
// Recupero i triangoli che interferiscono con il box del tronco di piramide.
|
||||||
|
INTVECTOR vT ;
|
||||||
|
Stm.GetAllTriaOverlapBox( b3Pyr, vT) ;
|
||||||
|
// Verifico se il tronco di piramide interferisce con i triangoli del poliedro presenti nel suo BBox
|
||||||
|
for ( int nT : vT) {
|
||||||
|
Triangle3d trTria ;
|
||||||
|
if ( Stm.GetTriangle( nT, trTria)) {
|
||||||
|
if ( CDeRectPrismoidTria( frPrismoid, dLenghtBaseX, dLenghtBaseY, dLenghtTopX, dLenghtTopY, dHeight,
|
||||||
|
trTria, dSafeDist))
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Non c'è interferenza
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ CDeSimpleRectPrismoidTria( const Frame3d& frPrismoid, double dLenghtBaseX, doubl
|
|||||||
bool
|
bool
|
||||||
CDeRectPrismoidTria( const Frame3d& frPrismoid, double dLenghtBaseX, double dLenghtBaseY,
|
CDeRectPrismoidTria( const Frame3d& frPrismoid, double dLenghtBaseX, double dLenghtBaseY,
|
||||||
double dLenghtTopX, double dLenghtTopY, double dHeight,
|
double dLenghtTopX, double dLenghtTopY, double dHeight,
|
||||||
double dSafeDist, const Triangle3d& trTria)
|
const Triangle3d& trTria, double dSafeDist)
|
||||||
{
|
{
|
||||||
// Se il tronco di piramide o il triangolo non sono ben definiti non procedo
|
// Se il tronco di piramide o il triangolo non sono ben definiti non procedo
|
||||||
if ( max( dLenghtBaseX, dLenghtTopX) < EPS_SMALL ||
|
if ( max( dLenghtBaseX, dLenghtTopX) < EPS_SMALL ||
|
||||||
|
|||||||
@@ -26,4 +26,4 @@ bool CDeSimpleRectPrismoidTria( const Frame3d& frPrismoid, double dLenghtBaseX,
|
|||||||
// asse X lungo un lato della stessa e asse Z ortogonale alle basi e diretta verso la base Top.
|
// asse X lungo un lato della stessa e asse Z ortogonale alle basi e diretta verso la base Top.
|
||||||
bool CDeRectPrismoidTria( const Frame3d& frPrismoid, double dLenghtBaseX, double dLenghtBaseY,
|
bool CDeRectPrismoidTria( const Frame3d& frPrismoid, double dLenghtBaseX, double dLenghtBaseY,
|
||||||
double dLenghtTopX, double dLenghtTopY, double dHeight,
|
double dLenghtTopX, double dLenghtTopY, double dHeight,
|
||||||
double dSafeDist, const Triangle3d& trTria) ;
|
const Triangle3d& trTria, double dSafeDist) ;
|
||||||
|
|||||||
+50
-8
@@ -1,13 +1,13 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2020-2020
|
// EgalTech 2020-2024
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : CDCylSurfTm.cpp Data : 09.01.20 Versione : 2.2a2
|
// File : CDCylSurfTm.cpp Data : 24.03.24 Versione : 2.6c2
|
||||||
// Contenuto : Implementazione della verifica di collisione tra
|
// Contenuto : Implementazione della verifica di collisione tra
|
||||||
// Sphere e Closed SurftriMesh.
|
// Sphere e Closed SurftriMesh.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Modifiche : 09.01.20 DS Creazione modulo.
|
// Modifiche : 09.01.20 DS Creazione modulo.
|
||||||
//
|
// 24.03.24 DS Aggiunta TestSpheSurfTm.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -19,10 +19,20 @@
|
|||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// La funzione restituisce :
|
||||||
|
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||||
|
// - false in caso di assenza di collisione.
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeSpheClosedSurfTm( const Point3d& ptCen, double dR, double dSafeDist, const ISurfTriMesh& Stm)
|
CDeSpheClosedSurfTm( const Point3d& ptCen, double dR, const ISurfTriMesh& Stm, double dSafeDist)
|
||||||
{
|
{
|
||||||
|
// Il raggio deve essere non nullo
|
||||||
|
if ( dR < EPS_SMALL)
|
||||||
|
return true ;
|
||||||
|
// Se superficie non valida o aperta, non ha senso proseguire
|
||||||
|
if ( ! Stm.IsValid() || ! Stm.IsClosed())
|
||||||
|
return true ;
|
||||||
// Recupero BBox del poliedro
|
// Recupero BBox del poliedro
|
||||||
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
||||||
// Calcolo il BBox della sfera
|
// Calcolo il BBox della sfera
|
||||||
@@ -38,13 +48,10 @@ CDeSpheClosedSurfTm( const Point3d& ptCen, double dR, double dSafeDist, const IS
|
|||||||
for ( int nT : vT) {
|
for ( int nT : vT) {
|
||||||
Triangle3d Tria ;
|
Triangle3d Tria ;
|
||||||
if ( Stm.GetTriangle( nT, Tria)) {
|
if ( Stm.GetTriangle( nT, Tria)) {
|
||||||
if ( CDeSpheTria( ptCen, dR, dSafeDist, Tria))
|
if ( CDeSpheTria( ptCen, dR, Tria, dSafeDist))
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Se superficie aperta, non c'è collisione
|
|
||||||
if ( ! Stm.IsClosed())
|
|
||||||
return false ;
|
|
||||||
// Se il BBox della sfera non è interno a quello del poliedro e viceversa, non c'è collisione
|
// Se il BBox della sfera non è interno a quello del poliedro e viceversa, non c'è collisione
|
||||||
if ( ! b3Sphe.Encloses( b3Poly) && ! b3Poly.Encloses( b3Sphe))
|
if ( ! b3Sphe.Encloses( b3Poly) && ! b3Poly.Encloses( b3Sphe))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -53,3 +60,38 @@ CDeSpheClosedSurfTm( const Point3d& ptCen, double dR, double dSafeDist, const IS
|
|||||||
// C'è collisione se la sfera è interna.
|
// C'è collisione se la sfera è interna.
|
||||||
return ( DistCenSurfCalc.IsPointInside()) ;
|
return ( DistCenSurfCalc.IsPointInside()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Verifica l'interferenza tra la sfera e la superficie : restituisce true in caso di interferenza
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
TestSpheSurfTm( const Point3d& ptCen, double dR, const ISurfTriMesh& Stm, double dSafeDist)
|
||||||
|
{
|
||||||
|
// Il raggio deve essere non nullo
|
||||||
|
if ( dR < EPS_SMALL)
|
||||||
|
return true ;
|
||||||
|
// Se superficie non valida, non ha senso proseguire
|
||||||
|
if ( ! Stm.IsValid())
|
||||||
|
return true ;
|
||||||
|
// Recupero BBox del poliedro
|
||||||
|
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
||||||
|
// Calcolo il BBox della sfera
|
||||||
|
BBox3d b3Sphe( ptCen, dR) ;
|
||||||
|
if ( dSafeDist > EPS_SMALL)
|
||||||
|
b3Sphe.Expand( dSafeDist) ;
|
||||||
|
// Se i BBox non interferiscono, non c'è collisione
|
||||||
|
if ( ! b3Sphe.Overlaps( b3Poly))
|
||||||
|
return false ;
|
||||||
|
// Verifico se la sfera interferisce con i triangoli del poliedro presenti nel suo BBox
|
||||||
|
INTVECTOR vT ;
|
||||||
|
Stm.GetAllTriaOverlapBox( b3Sphe, vT) ;
|
||||||
|
for ( int nT : vT) {
|
||||||
|
Triangle3d Tria ;
|
||||||
|
if ( Stm.GetTriangle( nT, Tria)) {
|
||||||
|
if ( CDeSpheTria( ptCen, dR, Tria, dSafeDist))
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Non c'è interferenza
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ CDeSimpleSpheTria( const Point3d& ptCen, double dR, const Triangle3d& trTria)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CDeSpheTria( const Point3d& ptCen, double dR, double dSafeDist, const Triangle3d& trTria)
|
CDeSpheTria( const Point3d& ptCen, double dR, const Triangle3d& trTria, double dSafeDist)
|
||||||
{
|
{
|
||||||
return CDeSimpleSpheTria( ptCen, dR + max( 0., dSafeDist), trTria) ;
|
return CDeSimpleSpheTria( ptCen, dR + max( 0., dSafeDist), trTria) ;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -16,4 +16,4 @@
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool CDeSimpleSpheTria( const Point3d& ptCen, double dR, const Triangle3d& trTria) ;
|
bool CDeSimpleSpheTria( const Point3d& ptCen, double dR, const Triangle3d& trTria) ;
|
||||||
bool CDeSpheTria( const Point3d& ptCen, double dR, double dSafeDist, const Triangle3d& trTria) ;
|
bool CDeSpheTria( const Point3d& ptCen, double dR, const Triangle3d& trTria, double dSafeDist) ;
|
||||||
|
|||||||
+3
-4
@@ -12,11 +12,10 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "DistLineLine.h"
|
|
||||||
#include "CDeTriaTria.h"
|
#include "CDeTriaTria.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistLineLine.h"
|
||||||
#include "/EgtDev/Include/EGkIntersPlanePlane.h"
|
#include "/EgtDev/Include/EGkIntersPlanePlane.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ GetTwoGreater( int nVal0, int nVal1, int nVal2, int& nFirstMaxPos, int& nSecondM
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nFirstMaxPos = 2 ;
|
nFirstMaxPos = 2 ;
|
||||||
nSecondMaxPos = 1 ;
|
nSecondMaxPos = 0 ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( nVal0 > nVal2) {
|
else if ( nVal0 > nVal2) {
|
||||||
@@ -168,7 +167,7 @@ CDeTriaTria( const Triangle3d& trTriaA, const Triangle3d& trTriaB)
|
|||||||
Vector3d vtSegSecondB = trTriaB.GetP( ( nSecondMaxPosB + 1) % 3) - trTriaB.GetP( nSecondMaxPosB) ;
|
Vector3d vtSegSecondB = trTriaB.GetP( ( nSecondMaxPosB + 1) % 3) - trTriaB.GetP( nSecondMaxPosB) ;
|
||||||
double dSegLenSecondB = vtSegSecondB.Len() ;
|
double dSegLenSecondB = vtSegSecondB.Len() ;
|
||||||
vtSegSecondB /= dSegLenSecondB ;
|
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 ;
|
double dIntParEnB, dOtherParSecondB ;
|
||||||
LineLineDistCalcSecondB.GetPositionsAtMinDistPoints( dIntParEnB, dOtherParSecondB) ;
|
LineLineDistCalcSecondB.GetPositionsAtMinDistPoints( dIntParEnB, dOtherParSecondB) ;
|
||||||
// Ordino i parametri lungo la retta di intersezione fra i piani
|
// Ordino i parametri lungo la retta di intersezione fra i piani
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "CDeUtility.h"
|
#include "CDeUtility.h"
|
||||||
#include "DistPointLine.h"
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/ENkPolynomialRoots.h"
|
#include "/EgtDev/Include/ENkPolynomialRoots.h"
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|||||||
+3315
File diff suppressed because it is too large
Load Diff
@@ -16,8 +16,8 @@
|
|||||||
#include "CurveBezier.h"
|
#include "CurveBezier.h"
|
||||||
#include "CurveComposite.h"
|
#include "CurveComposite.h"
|
||||||
#include "CreateCurveAux.h"
|
#include "CreateCurveAux.h"
|
||||||
#include "DistPointLine.h"
|
|
||||||
#include "GeoConst.h"
|
#include "GeoConst.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkCircleCenTgCurve.h"
|
#include "/EgtDev/Include/EGkCircleCenTgCurve.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
|
|||||||
+158
-38
@@ -22,6 +22,7 @@
|
|||||||
#include "GeoObjFactory.h"
|
#include "GeoObjFactory.h"
|
||||||
#include "NgeWriter.h"
|
#include "NgeWriter.h"
|
||||||
#include "NgeReader.h"
|
#include "NgeReader.h"
|
||||||
|
#include "Voronoi.h"
|
||||||
#include "/EgtDev/Include/EGkAngle.h"
|
#include "/EgtDev/Include/EGkAngle.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||||
@@ -61,15 +62,14 @@ class ArcApproxer
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
CurveArc::CurveArc( void)
|
CurveArc::CurveArc( void)
|
||||||
: m_nStatus( TO_VERIFY), m_PtCen(), m_VtN(), m_VtS(), m_dRad(),
|
: m_nStatus( TO_VERIFY), m_PtCen(), m_VtN(), m_VtS(), m_dRad(),
|
||||||
m_dAngCenDeg(), m_dDeltaN(), m_VtExtr(), m_dThick()
|
m_dAngCenDeg(), m_dDeltaN(), m_VtExtr(), m_dThick(), m_nTempProp{0,0}, m_dTempParam{0.0, 0.0}, m_pVoronoiObj( nullptr)
|
||||||
{
|
{
|
||||||
m_nTempProp[0] = 0 ;
|
|
||||||
m_nTempProp[1] = 0 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
CurveArc::~CurveArc( void)
|
CurveArc::~CurveArc( void)
|
||||||
{
|
{
|
||||||
|
ResetVoronoiObject() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -92,6 +92,8 @@ CurveArc::Set( const Point3d& ptCen, const Vector3d& vtN, double dRad,
|
|||||||
m_VtN.Normalize() ;
|
m_VtN.Normalize() ;
|
||||||
m_VtS.Normalize() ;
|
m_VtS.Normalize() ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -117,6 +119,8 @@ CurveArc::Set( const Point3d& ptCen, const Vector3d& vtN, double dRad)
|
|||||||
m_dDeltaN = 0 ;
|
m_dDeltaN = 0 ;
|
||||||
m_nStatus = TO_VERIFY ;
|
m_nStatus = TO_VERIFY ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -138,6 +142,8 @@ CurveArc::SetXY( const Point3d& ptCen, double dRad, double dAngIniDeg, double dA
|
|||||||
m_dDeltaN = dDeltaZ ;
|
m_dDeltaN = dDeltaZ ;
|
||||||
m_nStatus = TO_VERIFY ;
|
m_nStatus = TO_VERIFY ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -159,6 +165,8 @@ CurveArc::SetXY( const Point3d& ptCen, double dRad)
|
|||||||
m_dDeltaN = 0 ;
|
m_dDeltaN = 0 ;
|
||||||
m_nStatus = TO_VERIFY ;
|
m_nStatus = TO_VERIFY ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -181,7 +189,7 @@ CurveArc::Set3P( const Point3d& ptStart, const Point3d& ptOther, const Point3d&
|
|||||||
// calcolo del versore normale
|
// calcolo del versore normale
|
||||||
m_VtN = vtA ^ vtB ;
|
m_VtN = vtA ^ vtB ;
|
||||||
double dNSqLen = m_VtN.SqLen() ;
|
double dNSqLen = m_VtN.SqLen() ;
|
||||||
// se i punti sono praticamente allineati non si può calcolare la circonferenza
|
// se i punti sono praticamente allineati non si può calcolare la circonferenza
|
||||||
if ( ! m_VtN.Normalize( EPS_ZERO))
|
if ( ! m_VtN.Normalize( EPS_ZERO))
|
||||||
return false ;
|
return false ;
|
||||||
// calcolo del centro
|
// calcolo del centro
|
||||||
@@ -208,19 +216,21 @@ CurveArc::Set3P( const Point3d& ptStart, const Point3d& ptOther, const Point3d&
|
|||||||
if ( ! m_VtS.GetRotation( ( ptEnd - m_PtCen), m_VtN, dAng2Deg, bDet2) || ! bDet2)
|
if ( ! m_VtS.GetRotation( ( ptEnd - m_PtCen), m_VtN, dAng2Deg, bDet2) || ! bDet2)
|
||||||
return false ;
|
return false ;
|
||||||
// deduzione dell'angolo al centro
|
// deduzione dell'angolo al centro
|
||||||
// se uno dei due angoli è nullo, errore
|
// se uno dei due angoli è nullo, errore
|
||||||
if ( abs( dAng1Deg) < EPS_ANG_SMALL || abs( dAng2Deg) < EPS_ANG_SMALL)
|
if ( abs( dAng1Deg) < EPS_ANG_SMALL || abs( dAng2Deg) < EPS_ANG_SMALL)
|
||||||
return false ;
|
return false ;
|
||||||
// se i due angoli hanno lo stesso segno e Ang1 è minore di Ang2 in modulo
|
// se i due angoli hanno lo stesso segno e Ang1 è minore di Ang2 in modulo
|
||||||
else if ( dAng1Deg * dAng2Deg > 0 && abs( dAng1Deg) < abs( dAng2Deg))
|
else if ( dAng1Deg * dAng2Deg > 0 && abs( dAng1Deg) < abs( dAng2Deg))
|
||||||
m_dAngCenDeg = dAng2Deg ;
|
m_dAngCenDeg = dAng2Deg ;
|
||||||
// altrimenti hanno segno opposto oppure Ang1 è maggiore di Ang2 in modulo
|
// altrimenti hanno segno opposto oppure Ang1 è maggiore di Ang2 in modulo
|
||||||
else
|
else
|
||||||
m_dAngCenDeg = - _copysign( ANG_FULL, dAng2Deg) + dAng2Deg ;
|
m_dAngCenDeg = - _copysign( ANG_FULL, dAng2Deg) + dAng2Deg ;
|
||||||
}
|
}
|
||||||
// non c'è DeltaN
|
// non c'è DeltaN
|
||||||
m_dDeltaN = 0 ;
|
m_dDeltaN = 0 ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -245,7 +255,7 @@ CurveArc::Set2PNB( const Point3d& ptIni, const Point3d& ptFin, const Vector3d& v
|
|||||||
Vector3d vtDiff = ptFin - ptIni ;
|
Vector3d vtDiff = ptFin - ptIni ;
|
||||||
if ( vtDiff.IsSmall())
|
if ( vtDiff.IsSmall())
|
||||||
return false ;
|
return false ;
|
||||||
// deltaN eventuale ( è componente parallela a VtN)
|
// deltaN eventuale ( è componente parallela a VtN)
|
||||||
m_dDeltaN = vtDiff * m_VtN ;
|
m_dDeltaN = vtDiff * m_VtN ;
|
||||||
vtDiff -= m_dDeltaN * m_VtN ;
|
vtDiff -= m_dDeltaN * m_VtN ;
|
||||||
if ( abs( m_dDeltaN) < EPS_SMALL)
|
if ( abs( m_dDeltaN) < EPS_SMALL)
|
||||||
@@ -268,6 +278,8 @@ CurveArc::Set2PNB( const Point3d& ptIni, const Point3d& ptFin, const Vector3d& v
|
|||||||
// calcolo l'angolo al centro
|
// calcolo l'angolo al centro
|
||||||
m_dAngCenDeg = 4 * atan( dBulge) * RADTODEG ;
|
m_dAngCenDeg = 4 * atan( dBulge) * RADTODEG ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -292,7 +304,7 @@ CurveArc::Set2PD( const Point3d& ptStart, const Point3d& ptEnd, double dDirStart
|
|||||||
// calcolo del versore normale
|
// calcolo del versore normale
|
||||||
m_VtN = vtA ^ vtB ;
|
m_VtN = vtA ^ vtB ;
|
||||||
double dNSqLen = m_VtN.SqLen() ;
|
double dNSqLen = m_VtN.SqLen() ;
|
||||||
// se tangente e punti sono praticamente allineati non si può calcolare la circonferenza
|
// se tangente e punti sono praticamente allineati non si può calcolare la circonferenza
|
||||||
if ( ! m_VtN.Normalize( EPS_ZERO))
|
if ( ! m_VtN.Normalize( EPS_ZERO))
|
||||||
return false ;
|
return false ;
|
||||||
// calcolo del centro
|
// calcolo del centro
|
||||||
@@ -309,7 +321,7 @@ CurveArc::Set2PD( const Point3d& ptStart, const Point3d& ptEnd, double dDirStart
|
|||||||
double dAng1Deg ;
|
double dAng1Deg ;
|
||||||
if ( ! m_VtS.GetRotation( ( ptEnd - m_PtCen), m_VtN, dAng1Deg, bDet1) || ! bDet1)
|
if ( ! m_VtS.GetRotation( ( ptEnd - m_PtCen), m_VtN, dAng1Deg, bDet1) || ! bDet1)
|
||||||
return false ;
|
return false ;
|
||||||
// poichè il senso di rotazione è sempre CCW, se l'angolo è negativo prendo il suo complemento al giro
|
// poichè il senso di rotazione è sempre CCW, se l'angolo è negativo prendo il suo complemento al giro
|
||||||
if ( dAng1Deg < 0)
|
if ( dAng1Deg < 0)
|
||||||
m_dAngCenDeg = ANG_FULL + dAng1Deg ;
|
m_dAngCenDeg = ANG_FULL + dAng1Deg ;
|
||||||
else
|
else
|
||||||
@@ -324,6 +336,8 @@ CurveArc::Set2PD( const Point3d& ptStart, const Point3d& ptEnd, double dDirStart
|
|||||||
m_dDeltaN = - m_dDeltaN ;
|
m_dDeltaN = - m_dDeltaN ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -400,12 +414,14 @@ CurveArc::Set2PRS( const Point3d& ptStart, const Point3d& ptEnd, double dRad, bo
|
|||||||
bool bDet ;
|
bool bDet ;
|
||||||
if ( ! m_VtS.GetRotation( ( ptEnd - m_PtCen), m_VtN, m_dAngCenDeg, bDet) || ! bDet)
|
if ( ! m_VtS.GetRotation( ( ptEnd - m_PtCen), m_VtN, m_dAngCenDeg, bDet) || ! bDet)
|
||||||
return false ;
|
return false ;
|
||||||
// quando è 180deg il segno è determinato solo dal senso
|
// quando è 180deg il segno è determinato solo dal senso
|
||||||
if ( abs( m_dAngCenDeg - ANG_STRAIGHT) < 10 * EPS_ANG_SMALL &&
|
if ( abs( m_dAngCenDeg - ANG_STRAIGHT) < 10 * EPS_ANG_SMALL &&
|
||||||
( ( bCCW && m_dAngCenDeg < 0) ||
|
( ( bCCW && m_dAngCenDeg < 0) ||
|
||||||
( ! bCCW && m_dAngCenDeg > 0)))
|
( ! bCCW && m_dAngCenDeg > 0)))
|
||||||
m_dAngCenDeg = - m_dAngCenDeg ;
|
m_dAngCenDeg = - m_dAngCenDeg ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -460,6 +476,8 @@ CurveArc::SetCPA( const Point3d& ptCen, const Point3d& ptStart, double dAngCenDe
|
|||||||
// assegno l'angolo al centro
|
// assegno l'angolo al centro
|
||||||
m_dAngCenDeg = dAngCenDeg ;
|
m_dAngCenDeg = dAngCenDeg ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -511,11 +529,12 @@ CurveArc::SetC2P( const Point3d& ptCen, const Point3d& ptStart, const Point3d& p
|
|||||||
if ( m_dRad < EPS_ZERO)
|
if ( m_dRad < EPS_ZERO)
|
||||||
return false ;
|
return false ;
|
||||||
m_VtS /= m_dRad ;
|
m_VtS /= m_dRad ;
|
||||||
// calcolo l'angolo al centro (la funzione trova sempre il più piccolo)
|
// calcolo l'angolo al centro (la funzione trova sempre il più piccolo)
|
||||||
bool bDet ;
|
bool bDet ;
|
||||||
if ( ! m_VtS.GetRotation( ( ptNearEnd - m_PtCen), m_VtN, m_dAngCenDeg, bDet) || ! bDet)
|
if ( ! m_VtS.GetRotation( ( ptNearEnd - m_PtCen), m_VtN, m_dAngCenDeg, bDet) || ! bDet)
|
||||||
return false ;
|
return false ;
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -584,6 +603,8 @@ CurveArc::CopyFrom( const CurveArc& caSrc)
|
|||||||
m_dThick = caSrc.m_dThick ;
|
m_dThick = caSrc.m_dThick ;
|
||||||
m_nTempProp[0] = caSrc.m_nTempProp[0] ;
|
m_nTempProp[0] = caSrc.m_nTempProp[0] ;
|
||||||
m_nTempProp[1] = caSrc.m_nTempProp[1] ;
|
m_nTempProp[1] = caSrc.m_nTempProp[1] ;
|
||||||
|
m_dTempParam[0] = caSrc.m_dTempParam[0] ;
|
||||||
|
m_dTempParam[1] = caSrc.m_dTempParam[1] ;
|
||||||
return Set( caSrc.m_PtCen, caSrc.m_VtN, caSrc.m_dRad,
|
return Set( caSrc.m_PtCen, caSrc.m_VtN, caSrc.m_dRad,
|
||||||
caSrc.m_VtS, caSrc.m_dAngCenDeg, caSrc.m_dDeltaN) ;
|
caSrc.m_VtS, caSrc.m_dAngCenDeg, caSrc.m_dDeltaN) ;
|
||||||
}
|
}
|
||||||
@@ -712,7 +733,7 @@ CurveArc::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
|||||||
// verifico lo stato
|
// verifico lo stato
|
||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico validità del frame
|
// verifico validità del frame
|
||||||
if ( frRef.GetType() == Frame3d::ERR)
|
if ( frRef.GetType() == Frame3d::ERR)
|
||||||
return false ;
|
return false ;
|
||||||
// assegno il box nel riferimento
|
// assegno il box nel riferimento
|
||||||
@@ -799,7 +820,7 @@ CurveArc::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// se c'è estrusione, devo tenerne conto
|
// se c'è estrusione, devo tenerne conto
|
||||||
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
|
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
|
||||||
Vector3d vtFrExtr = m_VtExtr ;
|
Vector3d vtFrExtr = m_VtExtr ;
|
||||||
vtFrExtr.ToGlob( frRef) ;
|
vtFrExtr.ToGlob( frRef) ;
|
||||||
@@ -817,7 +838,7 @@ bool
|
|||||||
CurveArc::Validate( void)
|
CurveArc::Validate( void)
|
||||||
{
|
{
|
||||||
if ( m_nStatus == TO_VERIFY) {
|
if ( m_nStatus == TO_VERIFY) {
|
||||||
// limito l'angolo al centro a un giro se è piatto ( non è elica)
|
// limito l'angolo al centro a un giro se è piatto ( non è elica)
|
||||||
if ( abs( m_dDeltaN) < EPS_SMALL) {
|
if ( abs( m_dDeltaN) < EPS_SMALL) {
|
||||||
if ( m_dAngCenDeg > ANG_FULL)
|
if ( m_dAngCenDeg > ANG_FULL)
|
||||||
m_dAngCenDeg = ANG_FULL ;
|
m_dAngCenDeg = ANG_FULL ;
|
||||||
@@ -1146,7 +1167,7 @@ CurveArc::ApproxWithLines( double dLinTol, double dAngTolDeg, int nType, PolyLin
|
|||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// se necessario, sistemo per convessità dalla parte ammessa
|
// se necessario, sistemo per convessità dalla parte ammessa
|
||||||
if ( nType == APL_RIGHT_CONVEX || nType == APL_LEFT_CONVEX) {
|
if ( nType == APL_RIGHT_CONVEX || nType == APL_LEFT_CONVEX) {
|
||||||
if ( ! PL.MakeConvex( vtExtr, ( nType == APL_LEFT_CONVEX)))
|
if ( ! PL.MakeConvex( vtExtr, ( nType == APL_LEFT_CONVEX)))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -1220,7 +1241,7 @@ CurveArc::CopyParamRange( double dUStart, double dUEnd) const
|
|||||||
return nullptr ;
|
return nullptr ;
|
||||||
// se il parametro start supera quello di end
|
// se il parametro start supera quello di end
|
||||||
if ( dUStart > dUEnd - EPS_PARAM) {
|
if ( dUStart > dUEnd - EPS_PARAM) {
|
||||||
// se curva aperta, il trim la cancella completamente quindi non resta alcunchè
|
// se curva aperta, il trim la cancella completamente quindi non resta alcunchè
|
||||||
if ( ! IsClosed())
|
if ( ! IsClosed())
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
// se curva chiusa, il trim si avvolge attorno al punto di giunzione
|
// se curva chiusa, il trim si avvolge attorno al punto di giunzione
|
||||||
@@ -1262,6 +1283,8 @@ CurveArc::Invert( void)
|
|||||||
// l'incremento sulla normale inverte il segno
|
// l'incremento sulla normale inverte il segno
|
||||||
m_dDeltaN = - m_dDeltaN ;
|
m_dDeltaN = - m_dDeltaN ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1295,6 +1318,8 @@ CurveArc::SimpleOffset( double dDist, int nType)
|
|||||||
// aggiorno il raggio
|
// aggiorno il raggio
|
||||||
m_dRad = dNewRad ;
|
m_dRad = dNewRad ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1306,7 +1331,7 @@ bool
|
|||||||
CurveArc::MyExtendedOffset( double dDist, bool bAll, int nType)
|
CurveArc::MyExtendedOffset( double dDist, bool bAll, int nType)
|
||||||
{
|
{
|
||||||
// bAll == true fa accettare raggi nulli ==> da usare solo internamente
|
// bAll == true fa accettare raggi nulli ==> da usare solo internamente
|
||||||
// quando si è sicuri di aumentare subito il raggio o di cancellare
|
// quando si è sicuri di aumentare subito il raggio o di cancellare
|
||||||
|
|
||||||
// la curva deve essere validata
|
// la curva deve essere validata
|
||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
@@ -1339,6 +1364,8 @@ CurveArc::MyExtendedOffset( double dDist, bool bAll, int nType)
|
|||||||
// aggiorno il raggio
|
// aggiorno il raggio
|
||||||
m_dRad = dNewRad ;
|
m_dRad = dNewRad ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1382,7 +1409,7 @@ CurveArc::ModifyEnd( const Point3d& ptNewEnd)
|
|||||||
ptOldEndIntr.ToLoc( frIntr) ;
|
ptOldEndIntr.ToLoc( frIntr) ;
|
||||||
Point3d ptEndIntr = ptNewEnd ;
|
Point3d ptEndIntr = ptNewEnd ;
|
||||||
ptEndIntr.ToLoc( frIntr) ;
|
ptEndIntr.ToLoc( frIntr) ;
|
||||||
// se coincidono nel piano XY, è cambiato solo il deltaN
|
// se coincidono nel piano XY, è cambiato solo il deltaN
|
||||||
if ( AreSamePointXYExact( ptOldEndIntr, ptEndIntr)) {
|
if ( AreSamePointXYExact( ptOldEndIntr, ptEndIntr)) {
|
||||||
m_dDeltaN += ptEndIntr.z - ptOldEndIntr.z ;
|
m_dDeltaN += ptEndIntr.z - ptOldEndIntr.z ;
|
||||||
}
|
}
|
||||||
@@ -1411,6 +1438,8 @@ CurveArc::ModifyEnd( const Point3d& ptNewEnd)
|
|||||||
m_dDeltaN = arcAux.m_dDeltaN ;
|
m_dDeltaN = arcAux.m_dDeltaN ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1496,6 +1525,8 @@ CurveArc::TrimStartAtLen( double dLenTrim)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1523,6 +1554,8 @@ CurveArc::TrimEndAtLen( double dLenTrim)
|
|||||||
m_dDeltaN *= dLenTrim / dLen ;
|
m_dDeltaN *= dLenTrim / dLen ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1566,6 +1599,8 @@ CurveArc::ExtendEndByLen( double dLenExt)
|
|||||||
else if ( abs( m_dAngCenDeg) > ANG_FULL)
|
else if ( abs( m_dAngCenDeg) > ANG_FULL)
|
||||||
m_dAngCenDeg = _copysign( ANG_FULL, m_dAngCenDeg) ;
|
m_dAngCenDeg = _copysign( ANG_FULL, m_dAngCenDeg) ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1580,6 +1615,10 @@ CurveArc::Translate( const Vector3d& vtMove)
|
|||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// traslo Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->Translate( vtMove) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1597,10 +1636,14 @@ CurveArc::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, dou
|
|||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// verifico validità dell'asse di rotazione
|
// verifico validità dell'asse di rotazione
|
||||||
if ( vtAx.IsSmall())
|
if ( vtAx.IsSmall())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// ruoto Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1630,6 +1673,8 @@ CurveArc::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dC
|
|||||||
// verifico non sia nulla
|
// verifico non sia nulla
|
||||||
if ( abs( dCoeffX) < EPS_ZERO || m_dRad * abs( dCoeffX) <= EPS_SMALL)
|
if ( abs( dCoeffX) < EPS_ZERO || m_dRad * abs( dCoeffX) <= EPS_SMALL)
|
||||||
return false ;
|
return false ;
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
// scalo il centro e le dimensioni lineari
|
// scalo il centro e le dimensioni lineari
|
||||||
@@ -1657,6 +1702,8 @@ CurveArc::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dC
|
|||||||
// verifico non sia nulla
|
// verifico non sia nulla
|
||||||
if ( abs( dCoeffY) < EPS_ZERO || m_dRad * abs( dCoeffY) <= EPS_SMALL)
|
if ( abs( dCoeffY) < EPS_ZERO || m_dRad * abs( dCoeffY) <= EPS_SMALL)
|
||||||
return false ;
|
return false ;
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
// scalo il centro e le dimensioni lineari
|
// scalo il centro e le dimensioni lineari
|
||||||
@@ -1684,6 +1731,8 @@ CurveArc::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dC
|
|||||||
// verifico non sia nulla
|
// verifico non sia nulla
|
||||||
if ( abs( dCoeffZ) < EPS_ZERO || m_dRad * abs( dCoeffZ) <= EPS_SMALL)
|
if ( abs( dCoeffZ) < EPS_ZERO || m_dRad * abs( dCoeffZ) <= EPS_SMALL)
|
||||||
return false ;
|
return false ;
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
// scalo il centro e le dimensioni lineari
|
// scalo il centro e le dimensioni lineari
|
||||||
@@ -1711,6 +1760,8 @@ CurveArc::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dC
|
|||||||
// verifico non sia nulla
|
// verifico non sia nulla
|
||||||
if ( abs( dCoeffX) < EPS_ZERO || m_dRad * abs( dCoeffX) <= EPS_SMALL)
|
if ( abs( dCoeffX) < EPS_ZERO || m_dRad * abs( dCoeffX) <= EPS_SMALL)
|
||||||
return false ;
|
return false ;
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
// scalo il centro e le dimensioni lineari
|
// scalo il centro e le dimensioni lineari
|
||||||
@@ -1740,10 +1791,12 @@ CurveArc::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
|||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// verifico validità del piano di specchiatura
|
// verifico validità del piano di specchiatura
|
||||||
if ( vtNorm.IsSmall())
|
if ( vtNorm.IsSmall())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1766,15 +1819,17 @@ CurveArc::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vt
|
|||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// verifico validità dei parametri
|
// verifico validità dei parametri
|
||||||
if ( vtNorm.IsSmall() || vtDir.IsSmall())
|
if ( vtNorm.IsSmall() || vtDir.IsSmall())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// possibile solo se l'arco è piatto e il piano di scorrimento coincide con quello dell'arco
|
// possibile solo se l'arco è piatto e il piano di scorrimento coincide con quello dell'arco
|
||||||
if ( ! ( abs( m_dDeltaN) < EPS_SMALL) ||
|
if ( ! ( abs( m_dDeltaN) < EPS_SMALL) ||
|
||||||
! AreSameOrOppositeVectorExact( m_VtN, vtNorm))
|
! AreSameOrOppositeVectorExact( m_VtN, vtNorm))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1798,14 +1853,18 @@ CurveArc::ToGlob( const Frame3d& frRef)
|
|||||||
// la curva deve essere validata
|
// la curva deve essere validata
|
||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico validità del frame
|
// verifico validità del frame
|
||||||
if ( frRef.GetType() == Frame3d::ERR)
|
if ( frRef.GetType() == Frame3d::ERR)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// se frame identità, non devo fare alcunché
|
// se frame identità, non devo fare alcunché
|
||||||
if ( IsGlobFrame( frRef))
|
if ( IsGlobFrame( frRef))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
|
// trasformo Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->ToGlob( frRef) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1823,14 +1882,18 @@ CurveArc::ToLoc( const Frame3d& frRef)
|
|||||||
// la curva deve essere validata
|
// la curva deve essere validata
|
||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico validità del frame
|
// verifico validità del frame
|
||||||
if ( frRef.GetType() == Frame3d::ERR)
|
if ( frRef.GetType() == Frame3d::ERR)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// se frame identità, non devo fare alcunché
|
// se frame identità, non devo fare alcunché
|
||||||
if ( IsGlobFrame( frRef))
|
if ( IsGlobFrame( frRef))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
|
// trasformo Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->ToLoc( frRef) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1848,14 +1911,18 @@ CurveArc::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
|||||||
// la curva deve essere validata
|
// la curva deve essere validata
|
||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico validità dei frame
|
// verifico validità dei frame
|
||||||
if ( frOri.GetType() == Frame3d::ERR || frDest.GetType() == Frame3d::ERR)
|
if ( frOri.GetType() == Frame3d::ERR || frDest.GetType() == Frame3d::ERR)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// se i due riferimenti coincidono, non devo fare alcunché
|
// se i due riferimenti coincidono, non devo fare alcunché
|
||||||
if ( AreSameFrame( frOri, frDest))
|
if ( AreSameFrame( frOri, frDest))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
|
// trasformo Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->LocToLoc( frOri, frDest) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1879,6 +1946,8 @@ CurveArc::InvertN( void)
|
|||||||
m_dAngCenDeg = - m_dAngCenDeg ;
|
m_dAngCenDeg = - m_dAngCenDeg ;
|
||||||
m_dDeltaN = - m_dDeltaN ;
|
m_dDeltaN = - m_dDeltaN ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1930,12 +1999,12 @@ CurveArc::MyCalcPointParamPosiz( const Point3d& ptP, double& dU, int& nPos, doub
|
|||||||
// verifica posizione punto su arco
|
// verifica posizione punto su arco
|
||||||
nPos = PP_NULL ; // fuori
|
nPos = PP_NULL ; // fuori
|
||||||
if ( abs( DiffAngle( dAngDeg, 0) * DEGTORAD * m_dRad) < dLinTol) {
|
if ( abs( DiffAngle( dAngDeg, 0) * DEGTORAD * m_dRad) < dLinTol) {
|
||||||
nPos = ( IsACircle() ? PP_MID : PP_START) ; // se cerchio è interno, altrimenti vicino a inizio
|
nPos = ( IsACircle() ? PP_MID : PP_START) ; // se cerchio è interno, altrimenti vicino a inizio
|
||||||
dU = AngleNearAngle( dAngDeg, 0) / m_dAngCenDeg ;
|
dU = AngleNearAngle( dAngDeg, 0) / m_dAngCenDeg ;
|
||||||
dU = max( dU, 0.) ;
|
dU = max( dU, 0.) ;
|
||||||
}
|
}
|
||||||
else if ( abs( DiffAngle( dAngDeg, m_dAngCenDeg) * DEGTORAD * m_dRad) < dLinTol) {
|
else if ( abs( DiffAngle( dAngDeg, m_dAngCenDeg) * DEGTORAD * m_dRad) < dLinTol) {
|
||||||
nPos = ( IsACircle() ? PP_MID : PP_END) ; // se cerchio è interno, altrimenti vicino a fine
|
nPos = ( IsACircle() ? PP_MID : PP_END) ; // se cerchio è interno, altrimenti vicino a fine
|
||||||
dU = AngleNearAngle( dAngDeg, m_dAngCenDeg) / m_dAngCenDeg ;
|
dU = AngleNearAngle( dAngDeg, m_dAngCenDeg) / m_dAngCenDeg ;
|
||||||
dU = min( dU, 1.) ;
|
dU = min( dU, 1.) ;
|
||||||
}
|
}
|
||||||
@@ -1952,13 +2021,15 @@ CurveArc::ChangeRadius( double dNewRadius)
|
|||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// verifico validità del raggio
|
// verifico validità del raggio
|
||||||
if ( ! ( dNewRadius > EPS_SMALL && dNewRadius < MAX_ARC_RAD))
|
if ( ! ( dNewRadius > EPS_SMALL && dNewRadius < MAX_ARC_RAD))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// cambio il raggio
|
// cambio il raggio
|
||||||
m_dRad = dNewRadius ;
|
m_dRad = dNewRadius ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1978,6 +2049,8 @@ CurveArc::ChangeDeltaN( double dNewDeltaN)
|
|||||||
// cambio il parametro
|
// cambio il parametro
|
||||||
m_dDeltaN = dNewDeltaN ;
|
m_dDeltaN = dNewDeltaN ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1994,13 +2067,15 @@ CurveArc::ChangeAngCenter( double dNewAngCenDeg)
|
|||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// verifico accettabilità angolo
|
// verifico accettabilità angolo
|
||||||
if ( ! ( abs( m_dAngCenDeg) > EPS_ANG_ZERO))
|
if ( ! ( abs( m_dAngCenDeg) > EPS_ANG_ZERO))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// cambio il parametro
|
// cambio il parametro
|
||||||
m_dAngCenDeg = dNewAngCenDeg ;
|
m_dAngCenDeg = dNewAngCenDeg ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -2025,6 +2100,8 @@ CurveArc::ChangeStartPoint( double dU)
|
|||||||
if ( ! vtDir.Normalize())
|
if ( ! vtDir.Normalize())
|
||||||
return false ;
|
return false ;
|
||||||
m_VtS = vtDir ;
|
m_VtS = vtDir ;
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
return true ;
|
return true ;
|
||||||
@@ -2044,6 +2121,8 @@ CurveArc::ToExplementary( void)
|
|||||||
// basta prendere l'angolo al centro che completa il giro
|
// basta prendere l'angolo al centro che completa il giro
|
||||||
m_dAngCenDeg = - _copysign( ANG_FULL, m_dAngCenDeg) + m_dAngCenDeg ;
|
m_dAngCenDeg = - _copysign( ANG_FULL, m_dAngCenDeg) + m_dAngCenDeg ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -2073,6 +2152,8 @@ CurveArc::Flip( void)
|
|||||||
m_VtS.Normalize() ;
|
m_VtS.Normalize() ;
|
||||||
m_dAngCenDeg = - m_dAngCenDeg ;
|
m_dAngCenDeg = - m_dAngCenDeg ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -2082,11 +2163,11 @@ CurveArc::Flip( void)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Oggetto locale per approssimazione di archi
|
// Oggetto locale per approssimazione di archi
|
||||||
// Approx interna è quella cordale standard.
|
// Approx interna è quella cordale standard.
|
||||||
// Approx esterna è quella tangente a inizio e fine con metà tratto e un punto in più.
|
// Approx esterna è quella tangente a inizio e fine con metà tratto e un punto in più.
|
||||||
// I punti si calcolano a partire dal triangolo tra due punti consecutivi interni e il centro,
|
// I punti si calcolano a partire dal triangolo tra due punti consecutivi interni e il centro,
|
||||||
// usando il versore medio dal centro e moltiplicandolo per il coefficiente ( 2 / ( 1 + cosA)).
|
// usando il versore medio dal centro e moltiplicandolo per il coefficiente ( 2 / ( 1 + cosA)).
|
||||||
// Il versore dell'ultimo punto è già stato calcolato per il penultimo.
|
// Il versore dell'ultimo punto è già stato calcolato per il penultimo.
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
ArcApproxer::ArcApproxer( double dLinTol, double dAngTolDeg, bool bInside, const CurveArc& arArc)
|
ArcApproxer::ArcApproxer( double dLinTol, double dAngTolDeg, bool bInside, const CurveArc& arArc)
|
||||||
{
|
{
|
||||||
@@ -2187,3 +2268,42 @@ ArcApproxer::GetPoint( double& dU, Point3d& ptP)
|
|||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
CurveArc::CalcVoronoiObject() const
|
||||||
|
{
|
||||||
|
if ( m_nStatus != OK)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
// creo oggetto vroni con la curva
|
||||||
|
m_pVoronoiObj = new( std::nothrow) Voronoi( this, false) ;
|
||||||
|
if ( m_pVoronoiObj == nullptr)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Voronoi*
|
||||||
|
CurveArc::GetVoronoiObject() const
|
||||||
|
{
|
||||||
|
if ( m_nStatus != OK)
|
||||||
|
return nullptr ;
|
||||||
|
|
||||||
|
// se non è stato calcolato, lo calcolo
|
||||||
|
if ( m_pVoronoiObj == nullptr)
|
||||||
|
CalcVoronoiObject() ;
|
||||||
|
|
||||||
|
// restituisco Voronoi
|
||||||
|
return m_pVoronoiObj ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void
|
||||||
|
CurveArc::ResetVoronoiObject() const
|
||||||
|
{
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
delete m_pVoronoiObj ;
|
||||||
|
m_pVoronoiObj = nullptr ;
|
||||||
|
}
|
||||||
|
|||||||
+17
-2
@@ -19,6 +19,8 @@
|
|||||||
#include "GeoObjRW.h"
|
#include "GeoObjRW.h"
|
||||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||||
|
|
||||||
|
class Voronoi ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
class CurveArc : public ICurveArc, public IGeoObjRW
|
class CurveArc : public ICurveArc, public IGeoObjRW
|
||||||
{
|
{
|
||||||
@@ -54,6 +56,11 @@ class CurveArc : public ICurveArc, public IGeoObjRW
|
|||||||
m_nTempProp[nPropInd] = nProp ; }
|
m_nTempProp[nPropInd] = nProp ; }
|
||||||
int GetTempProp( int nPropInd = 0) const override
|
int GetTempProp( int nPropInd = 0) const override
|
||||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||||
|
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||||
|
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||||
|
m_dTempParam[nParamInd] = dParam ; }
|
||||||
|
double GetTempParam( int nParamInd = 0) const override
|
||||||
|
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||||
|
|
||||||
public : // ICurve
|
public : // ICurve
|
||||||
bool IsSimple( void) const override
|
bool IsSimple( void) const override
|
||||||
@@ -179,11 +186,14 @@ class CurveArc : public ICurveArc, public IGeoObjRW
|
|||||||
public : // IGeoObjRW
|
public : // IGeoObjRW
|
||||||
int GetNgeId( void) const override ;
|
int GetNgeId( void) const override ;
|
||||||
bool Save( NgeWriter& ngeOut) const override ;
|
bool Save( NgeWriter& ngeOut) const override ;
|
||||||
|
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
|
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
bool Load( NgeReader& ngeIn) override ;
|
bool Load( NgeReader& ngeIn) override ;
|
||||||
|
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||||
|
|
||||||
public :
|
public :
|
||||||
CurveArc( void) ;
|
CurveArc( void) ;
|
||||||
CurveArc( const CurveArc& caSrc)
|
CurveArc( const CurveArc& caSrc) : m_pVoronoiObj( nullptr)
|
||||||
{ if ( ! CopyFrom( caSrc))
|
{ if ( ! CopyFrom( caSrc))
|
||||||
LOG_ERROR( GetEGkLogger(), "CurveArc : copy constructor error")}
|
LOG_ERROR( GetEGkLogger(), "CurveArc : copy constructor error")}
|
||||||
CurveArc& operator =( const CurveArc& caSrc)
|
CurveArc& operator =( const CurveArc& caSrc)
|
||||||
@@ -192,11 +202,14 @@ class CurveArc : public ICurveArc, public IGeoObjRW
|
|||||||
return *this ; }
|
return *this ; }
|
||||||
bool MyExtendedOffset( double dDist, bool bAll, int nType = OFF_FILLET) ;
|
bool MyExtendedOffset( double dDist, bool bAll, int nType = OFF_FILLET) ;
|
||||||
bool MyCalcPointParamPosiz( const Point3d& ptP, double& dU, int& nPos, double dLinTol) const ;
|
bool MyCalcPointParamPosiz( const Point3d& ptP, double& dU, int& nPos, double dLinTol) const ;
|
||||||
|
Voronoi* GetVoronoiObject( void) const ;
|
||||||
|
void ResetVoronoiObject( void) const ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool CopyFrom( const CurveArc& caSrc) ;
|
bool CopyFrom( const CurveArc& caSrc) ;
|
||||||
bool Validate( void) ;
|
bool Validate( void) ;
|
||||||
bool GetDir( double dU, Vector3d& vtDir) const ;
|
bool GetDir( double dU, Vector3d& vtDir) const ;
|
||||||
|
bool CalcVoronoiObject( void) const ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
||||||
@@ -212,7 +225,9 @@ class CurveArc : public ICurveArc, public IGeoObjRW
|
|||||||
double m_dDeltaN ; // variazione di quota lungo VtN della fine rispetto all'inizio
|
double m_dDeltaN ; // variazione di quota lungo VtN della fine rispetto all'inizio
|
||||||
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
|
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
|
||||||
double m_dThick ; // spessore
|
double m_dThick ; // spessore
|
||||||
int m_nTempProp[2] ; // vettore proprietŕ temporanee
|
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||||
|
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||||
|
mutable Voronoi* m_pVoronoiObj ; // Voronoi
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
+452
-48
@@ -2,7 +2,7 @@
|
|||||||
// EgalTech 2013-2013
|
// EgalTech 2013-2013
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : CurveAux.cpp Data : 22.11.13 Versione : 1.3a1
|
// File : CurveAux.cpp Data : 22.11.13 Versione : 1.3a1
|
||||||
// Contenuto : Implementazione di alcune funzioni di utilità per le curve.
|
// Contenuto : Implementazione di alcune funzioni di utilità per le curve.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "CurveArc.h"
|
#include "CurveArc.h"
|
||||||
#include "CurveBezier.h"
|
#include "CurveBezier.h"
|
||||||
#include "CurveComposite.h"
|
#include "CurveComposite.h"
|
||||||
|
#include "Voronoi.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||||
@@ -38,7 +39,7 @@ IsClosed( const ICurve& crvC)
|
|||||||
bool
|
bool
|
||||||
IsValidParam( const ICurve& crvC, double dPar, ICurve::Side nSide)
|
IsValidParam( const ICurve& crvC, double dPar, ICurve::Side nSide)
|
||||||
{
|
{
|
||||||
// recupero l'intervallo di validità del parametro
|
// recupero l'intervallo di validità del parametro
|
||||||
double dStart, dEnd ;
|
double dStart, dEnd ;
|
||||||
if ( ! crvC.GetDomain( dStart, dEnd))
|
if ( ! crvC.GetDomain( dStart, dEnd))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -59,11 +60,11 @@ IsValidParam( const ICurve& crvC, double dPar, ICurve::Side nSide)
|
|||||||
bool
|
bool
|
||||||
IsStartParam( const ICurve& crvC, double dPar)
|
IsStartParam( const ICurve& crvC, double dPar)
|
||||||
{
|
{
|
||||||
// recupero l'intervallo di validità del parametro
|
// recupero l'intervallo di validità del parametro
|
||||||
double dStart, dEnd ;
|
double dStart, dEnd ;
|
||||||
if ( ! crvC.GetDomain( dStart, dEnd))
|
if ( ! crvC.GetDomain( dStart, dEnd))
|
||||||
return false ;
|
return false ;
|
||||||
// se il parametro non è nell'intorno dell'inizio
|
// se il parametro non è nell'intorno dell'inizio
|
||||||
if ( abs( dPar - dStart) > EPS_PARAM)
|
if ( abs( dPar - dStart) > EPS_PARAM)
|
||||||
return false ;
|
return false ;
|
||||||
return true ;
|
return true ;
|
||||||
@@ -73,11 +74,11 @@ IsStartParam( const ICurve& crvC, double dPar)
|
|||||||
bool
|
bool
|
||||||
IsEndParam( const ICurve& crvC, double dPar)
|
IsEndParam( const ICurve& crvC, double dPar)
|
||||||
{
|
{
|
||||||
// recupero l'intervallo di validità del parametro
|
// recupero l'intervallo di validità del parametro
|
||||||
double dStart, dEnd ;
|
double dStart, dEnd ;
|
||||||
if ( ! crvC.GetDomain( dStart, dEnd))
|
if ( ! crvC.GetDomain( dStart, dEnd))
|
||||||
return false ;
|
return false ;
|
||||||
// se il parametro non è nell'intorno della fine
|
// se il parametro non è nell'intorno della fine
|
||||||
if ( abs( dPar - dEnd) > EPS_PARAM)
|
if ( abs( dPar - dEnd) > EPS_PARAM)
|
||||||
return false ;
|
return false ;
|
||||||
return true ;
|
return true ;
|
||||||
@@ -97,7 +98,7 @@ GetNearestExtremityToPoint( const Point3d& ptP, const ICurve& Curve, bool& bStar
|
|||||||
return false ;
|
return false ;
|
||||||
// se curva aperta
|
// se curva aperta
|
||||||
if ( ! AreSamePointApprox( ptStart, ptEnd)) {
|
if ( ! AreSamePointApprox( ptStart, ptEnd)) {
|
||||||
// è il più vicino tra inizio e fine
|
// è il più vicino tra inizio e fine
|
||||||
bStart = ( SqDist( ptP, ptStart) <= SqDist( ptP, ptEnd)) ;
|
bStart = ( SqDist( ptP, ptStart) <= SqDist( ptP, ptEnd)) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -185,7 +186,7 @@ GetPointTang( const ICurve& crvC, double dU, ICurve::Side nS, Point3d& ptPos, Ve
|
|||||||
return false ;
|
return false ;
|
||||||
double dUmod = dU + ( nS == ICurve::FROM_MINUS ? -1 : +1) * 100 * EPS_PARAM ;
|
double dUmod = dU + ( nS == ICurve::FROM_MINUS ? -1 : +1) * 100 * EPS_PARAM ;
|
||||||
Point3d ptDummy ;
|
Point3d ptDummy ;
|
||||||
// se anche la derivata seconda è nulla, provo a spostarmi di poco
|
// se anche la derivata seconda è nulla, provo a spostarmi di poco
|
||||||
if ( ! vtTang.Normalize( EPS_ZERO)) {
|
if ( ! vtTang.Normalize( EPS_ZERO)) {
|
||||||
if ( ! crvC.GetPointD1D2( dUmod, nS, ptDummy, &vtDummy, &vtTang))
|
if ( ! crvC.GetPointD1D2( dUmod, nS, ptDummy, &vtDummy, &vtTang))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -262,14 +263,14 @@ GetPointDiffGeom( const ICurve& crvC, double dU, ICurve::Side nS, CrvPointDiffGe
|
|||||||
bool
|
bool
|
||||||
ImproveCurveParamAtPoint( double& dU, const Point3d& ptP, const ICurve* pCrv)
|
ImproveCurveParamAtPoint( double& dU, const Point3d& ptP, const ICurve* pCrv)
|
||||||
{
|
{
|
||||||
// Da usare quando il parametro è già molto vicino a quello esatto
|
// Da usare quando il parametro è già molto vicino a quello esatto
|
||||||
|
|
||||||
// calcolo il punto della curva in corrispondenza al parametro
|
// calcolo il punto della curva in corrispondenza al parametro
|
||||||
Point3d ptQ ;
|
Point3d ptQ ;
|
||||||
Vector3d vtD ;
|
Vector3d vtD ;
|
||||||
if ( ! pCrv->GetPointD1D2( dU, ICurve::FROM_MINUS, ptQ, &vtD))
|
if ( ! pCrv->GetPointD1D2( dU, ICurve::FROM_MINUS, ptQ, &vtD))
|
||||||
return false ;
|
return false ;
|
||||||
// se sono uguali, è già tutto ok
|
// se sono uguali, è già tutto ok
|
||||||
if ( AreSamePointExact( ptP, ptQ))
|
if ( AreSamePointExact( ptP, ptQ))
|
||||||
return true ;
|
return true ;
|
||||||
// se derivata nulla, non posso migliorare
|
// se derivata nulla, non posso migliorare
|
||||||
@@ -331,7 +332,7 @@ CurveGetArea( const ICurve& crvC, Plane3d& plPlane, double& dArea)
|
|||||||
bool
|
bool
|
||||||
CurveDump( const ICurve& crvC, string& sOut, bool bMM, const char* szNewLine)
|
CurveDump( const ICurve& crvC, string& sOut, bool bMM, const char* szNewLine)
|
||||||
{
|
{
|
||||||
// verifico validità curva
|
// verifico validità curva
|
||||||
if ( ! crvC.IsValid())
|
if ( ! crvC.IsValid())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
@@ -402,9 +403,20 @@ CopyThickness( const ICurve* pSouCrv, ICurve* pDestCrv)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
ICurveBezier*
|
||||||
|
LineToBezierCurve( const ICurveLine* pCrvLine)
|
||||||
|
{
|
||||||
|
PtrOwner<ICurveBezier> pCrvBezier( CreateCurveBezier()) ;
|
||||||
|
// rendo tutte le curve di grado 2 e razionali così posso convertire anche archi e avere tutte curve dello stesso grado e razionali
|
||||||
|
pCrvBezier->Init( 2, true) ;
|
||||||
|
pCrvBezier->FromLine( *pCrvLine) ;
|
||||||
|
return Release( pCrvBezier) ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
ICurve*
|
ICurve*
|
||||||
ArcToBezierCurve( const ICurve* pCrv)
|
ArcToBezierCurve( const ICurve* pCrv, bool bDeg3OrDeg2)
|
||||||
{
|
{
|
||||||
// verifico sia un arco
|
// verifico sia un arco
|
||||||
const CurveArc* pArc = GetBasicCurveArc( pCrv) ;
|
const CurveArc* pArc = GetBasicCurveArc( pCrv) ;
|
||||||
@@ -412,7 +424,8 @@ ArcToBezierCurve( const ICurve* pCrv)
|
|||||||
return nullptr ;
|
return nullptr ;
|
||||||
|
|
||||||
// se angolo al centro sotto il limite, basta una curva
|
// se angolo al centro sotto il limite, basta una curva
|
||||||
if ( abs( pArc->GetAngCenter()) < BEZARC_ANG_CEN_MAX + EPS_ANG_SMALL) {
|
if ( ( abs( pArc->GetAngCenter()) < BEZARC_ANG_CEN_MAX + EPS_ANG_SMALL && abs( pArc->GetDeltaN()) < EPS_ZERO && ! bDeg3OrDeg2) ||
|
||||||
|
( abs( pArc->GetAngCenter()) < BEZARC_ANG_CEN_MAX + EPS_ANG_SMALL && bDeg3OrDeg2)) {
|
||||||
// creo la curva di Bezier equivalente all'arco
|
// creo la curva di Bezier equivalente all'arco
|
||||||
PtrOwner<CurveBezier> pCrvBez( CreateBasicCurveBezier()) ;
|
PtrOwner<CurveBezier> pCrvBez( CreateBasicCurveBezier()) ;
|
||||||
if ( IsNull( pCrvBez) || ! pCrvBez->FromArc( *pArc))
|
if ( IsNull( pCrvBez) || ! pCrvBez->FromArc( *pArc))
|
||||||
@@ -428,6 +441,8 @@ ArcToBezierCurve( const ICurve* pCrv)
|
|||||||
return nullptr ;
|
return nullptr ;
|
||||||
// inserisco nella CC le curve di Bezier equivalenti alle parti dell'arco
|
// inserisco nella CC le curve di Bezier equivalenti alle parti dell'arco
|
||||||
int nParts = (int) ceil( abs( pArc->GetAngCenter()) / ( BEZARC_ANG_CEN_MAX + EPS_ANG_SMALL)) ;
|
int nParts = (int) ceil( abs( pArc->GetAngCenter()) / ( BEZARC_ANG_CEN_MAX + EPS_ANG_SMALL)) ;
|
||||||
|
if ( ! bDeg3OrDeg2 && abs( pArc->GetDeltaN()) > EPS_ZERO)
|
||||||
|
nParts *= 2 ;
|
||||||
nParts = max( nParts, 2) ;
|
nParts = max( nParts, 2) ;
|
||||||
for ( int i = 0 ; i < nParts ; ++ i) {
|
for ( int i = 0 ; i < nParts ; ++ i) {
|
||||||
// copio l'arco originale
|
// copio l'arco originale
|
||||||
@@ -450,11 +465,265 @@ ArcToBezierCurve( const ICurve* pCrv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
ICurve*
|
||||||
|
CompositeToBezierCurve( const ICurveComposite* pCC)
|
||||||
|
{
|
||||||
|
// converto tutte le curve in bezier razionali di grado 2
|
||||||
|
PtrOwner<ICurveComposite> pCCBezier( CreateCurveComposite()) ;
|
||||||
|
for ( int i = 0 ; i < int( pCC->GetCurveCount()) ; ++i) {
|
||||||
|
PtrOwner<ICurve> pCrvNew ;
|
||||||
|
if ( pCC->GetCurve(i)->GetType() == CRV_ARC) {
|
||||||
|
const CurveArc* crArc = GetBasicCurveArc( pCC->GetCurve(i)) ;
|
||||||
|
ICurve* pCrvBezier = ArcToBezierCurve( crArc) ;
|
||||||
|
if ( pCrvBezier == nullptr)
|
||||||
|
return nullptr ;
|
||||||
|
// se la curva è di grado superiore al secondo allora devo ricondurla al secondo grado
|
||||||
|
pCrvNew.Set( pCrvBezier) ;
|
||||||
|
}
|
||||||
|
else if ( pCC->GetCurve(i)->GetType() == CRV_LINE) {
|
||||||
|
const CurveLine* crLine = GetBasicCurveLine( pCC->GetCurve(i)) ;
|
||||||
|
ICurve* pCrvBezier = LineToBezierCurve( crLine) ;
|
||||||
|
if ( pCrvBezier == nullptr)
|
||||||
|
return nullptr ;
|
||||||
|
pCrvNew.Set( pCrvBezier) ;
|
||||||
|
}
|
||||||
|
else if ( pCC->GetCurve(i)->GetType() == CRV_BEZIER ) {
|
||||||
|
const CurveBezier* crvBezier = GetBasicCurveBezier( pCC->GetCurve(i)) ;
|
||||||
|
ICurve* pCrvBezier = BezierToBasicBezierCurve( crvBezier) ;
|
||||||
|
if ( pCrvBezier == nullptr)
|
||||||
|
return nullptr ;
|
||||||
|
pCrvNew.Set( pCrvBezier) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
pCCBezier->AddCurve( Release( pCrvNew)) ;
|
||||||
|
}
|
||||||
|
return Release( pCCBezier) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
ICurve*
|
||||||
|
BezierToBasicBezierCurve( const ICurveBezier* pCrvBezier)
|
||||||
|
{
|
||||||
|
// resta da calcolare un errore sull'approssimazione oppure usare la tecnica di spezzare la curva originale in sottocurve e approssimarle con bezier cubiche
|
||||||
|
// per ridurre molto l'errore
|
||||||
|
|
||||||
|
// dovrei restituire una bezier di grado 2, razionale per poter essere uniforme con le altre curve trasmorate in bezier
|
||||||
|
PtrOwner<ICurveBezier> pCrvNew( pCrvBezier->Clone()) ;
|
||||||
|
int nDeg = pCrvBezier->GetDegree() ;
|
||||||
|
bool bRat = pCrvBezier->IsRational() ;
|
||||||
|
// se la curva è già nella forma giusta la restituisco
|
||||||
|
if ( nDeg == 2 && bRat)
|
||||||
|
return Release( pCrvNew) ;
|
||||||
|
// sennò la riduco di grado fino al 2
|
||||||
|
PtrOwner<ICurveBezier> pBasicBezier ( CreateCurveBezier()) ;
|
||||||
|
pBasicBezier->Init( 2, true) ;
|
||||||
|
double dW = 1 ;
|
||||||
|
if ( nDeg == 1) {
|
||||||
|
Point3d ptStart = pCrvBezier->GetControlPoint( 0) ;
|
||||||
|
Point3d ptEnd = pCrvBezier->GetControlPoint( 1) ;
|
||||||
|
pBasicBezier->SetControlPoint( 0, ptStart, dW) ;
|
||||||
|
pBasicBezier->SetControlPoint( 1, 0.5 * (ptStart + ptEnd), dW) ;
|
||||||
|
pBasicBezier->SetControlPoint( 2, ptEnd, dW) ;
|
||||||
|
return Release( pBasicBezier) ;
|
||||||
|
}
|
||||||
|
while ( nDeg > 2 ) {
|
||||||
|
pCrvNew.Set( BezierDecreaseDegree( pCrvNew, 1)) ;
|
||||||
|
if ( IsNull( pCrvNew) || ! pCrvNew->IsValid())
|
||||||
|
return nullptr ;
|
||||||
|
-- nDeg ;
|
||||||
|
}
|
||||||
|
for ( int i = 0 ; i < 3 ; ++i) {
|
||||||
|
Point3d ptCopy = pCrvNew->GetControlPoint( i) ;
|
||||||
|
if ( bRat)
|
||||||
|
dW = pCrvNew->GetControlWeight( i) ;
|
||||||
|
pBasicBezier->SetControlPoint( i, ptCopy, dW) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Release( pBasicBezier) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
ICurveBezier*
|
||||||
|
BezierIncreaseDegree(const ICurveBezier* pCrvBezier)
|
||||||
|
{
|
||||||
|
if ( pCrvBezier == nullptr)
|
||||||
|
return nullptr ;
|
||||||
|
// creo la versione con grado aumentato
|
||||||
|
PtrOwner<ICurveBezier> pNewBezier( CreateCurveBezier()) ;
|
||||||
|
int nDeg = pCrvBezier->GetDegree() + 1;
|
||||||
|
bool bRat = pCrvBezier->IsRational();
|
||||||
|
pNewBezier->Init( nDeg , bRat) ;
|
||||||
|
// prev e curr sono riferiti alla curva di partenza
|
||||||
|
// salvo il primo punto
|
||||||
|
Point3d ptCtrlPrev = pCrvBezier->GetControlPoint( 0) ;
|
||||||
|
double dWprev = 1 ;
|
||||||
|
if ( bRat ) {
|
||||||
|
dWprev = pCrvBezier->GetControlWeight( 0) ;
|
||||||
|
pNewBezier->SetControlPoint( 0, ptCtrlPrev, dWprev) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pNewBezier->SetControlPoint( 0, ptCtrlPrev) ;
|
||||||
|
// ciclo sui punti di controllo intermedi per calcolare quelli nuovi
|
||||||
|
Point3d ptCtrlCurr ;
|
||||||
|
double dWcurr ;
|
||||||
|
for ( double i = 1 ; i < nDeg ; ++i) {
|
||||||
|
ptCtrlCurr = pCrvBezier->GetControlPoint( int( i)) ;
|
||||||
|
Point3d ptNew = ( i / nDeg) * ptCtrlPrev + ( 1 - i / ( nDeg)) * ptCtrlCurr ;
|
||||||
|
if ( bRat) {
|
||||||
|
dWcurr = pCrvBezier->GetControlWeight( int( i)) ;
|
||||||
|
double dWnew = ( i / nDeg) * dWprev + ( 1 - i / ( nDeg)) * dWcurr ;
|
||||||
|
pNewBezier->SetControlPoint( int( i), ptNew, dWnew) ;
|
||||||
|
dWprev = dWnew ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pNewBezier->SetControlPoint( int( i), ptNew) ;
|
||||||
|
ptCtrlPrev = ptCtrlCurr ;
|
||||||
|
}
|
||||||
|
// salvo l'ultimo punto
|
||||||
|
ptCtrlCurr = pCrvBezier->GetControlPoint( nDeg - 1) ;
|
||||||
|
if ( bRat ) {
|
||||||
|
dWcurr = pCrvBezier->GetControlWeight( nDeg - 1) ;
|
||||||
|
pNewBezier->SetControlPoint( nDeg, ptCtrlCurr, dWcurr) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pNewBezier->SetControlPoint( nDeg, ptCtrlCurr) ;
|
||||||
|
return Release( pNewBezier) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
ICurveBezier*
|
||||||
|
BezierDecreaseDegree(const ICurveBezier* pCrvBezier, double dTol)
|
||||||
|
{
|
||||||
|
if ( pCrvBezier == nullptr)
|
||||||
|
return nullptr ;
|
||||||
|
PtrOwner<ICurveBezier> pNewBezier( CreateCurveBezier()) ;
|
||||||
|
int nDeg = pCrvBezier->GetDegree() - 1 ;
|
||||||
|
if ( nDeg == 0)
|
||||||
|
return nullptr ;
|
||||||
|
bool bRat = pCrvBezier->IsRational() ;
|
||||||
|
pNewBezier->Init( nDeg, bRat) ;
|
||||||
|
// prev e curr sono riferiti alla nuova curva
|
||||||
|
//salvo il primo punto
|
||||||
|
Point3d ptCtrlPrev = pCrvBezier->GetControlPoint( 0) ;
|
||||||
|
double dWprev = 1 ;
|
||||||
|
if ( bRat ) {
|
||||||
|
dWprev = pCrvBezier->GetControlWeight( 0) ;
|
||||||
|
pNewBezier->SetControlPoint( 0, ptCtrlPrev, dWprev) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pNewBezier->SetControlPoint( 0, ptCtrlPrev) ;
|
||||||
|
// ciclo sui punti intermedi per trovare i nuovi punti di controllo // equazioni da NURBS book
|
||||||
|
Point3d ptCtrlCurr ;
|
||||||
|
double dWcurr ;
|
||||||
|
int r = int (nDeg / 2) ;
|
||||||
|
// prima metà
|
||||||
|
for ( double i = 1 ; i < r ; ++i) {
|
||||||
|
double dAlpha = i / ( nDeg + 1) ;
|
||||||
|
// old è riferito alla curva originale
|
||||||
|
Point3d ptOld = pCrvBezier->GetControlPoint( int( i)) ;
|
||||||
|
ptCtrlCurr = ( ptOld + (- dAlpha * ptCtrlPrev)) / ( 1 - dAlpha) ;
|
||||||
|
if ( bRat) {
|
||||||
|
double dWold = pCrvBezier->GetControlWeight( int( i)) ;
|
||||||
|
dWcurr = ( dWold + (- dAlpha * dWprev)) / ( 1 - dAlpha) ;
|
||||||
|
pNewBezier->SetControlPoint( int( i), ptCtrlCurr, dWcurr) ;
|
||||||
|
dWprev = dWcurr ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pNewBezier->SetControlPoint( int( i), ptCtrlCurr) ;
|
||||||
|
ptCtrlPrev = ptCtrlCurr ;
|
||||||
|
}
|
||||||
|
// risolvo il punto di mezzo per il caso nDeg pari
|
||||||
|
if ( ( nDeg + 1) % 2 == 0) { // pari
|
||||||
|
double dAlpha = r / ( nDeg + 1.) ;
|
||||||
|
Point3d ptOld = pCrvBezier->GetControlPoint( r) ;
|
||||||
|
ptCtrlCurr = ( ptOld + (- dAlpha * ptCtrlPrev)) / ( 1 - dAlpha) ;
|
||||||
|
if ( bRat) {
|
||||||
|
double dWold = pCrvBezier->GetControlWeight( r) ;
|
||||||
|
dWcurr = ( dWold + (- dAlpha * dWprev)) / ( 1 - dAlpha) ;
|
||||||
|
pNewBezier->SetControlPoint( r, ptCtrlCurr, dWcurr) ;
|
||||||
|
dWprev = dWcurr ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pNewBezier->SetControlPoint( r, ptCtrlCurr) ;
|
||||||
|
}
|
||||||
|
// salvo l'ultimo punto
|
||||||
|
ptCtrlCurr = pCrvBezier->GetControlPoint( nDeg + 1) ;
|
||||||
|
if ( bRat ) {
|
||||||
|
dWcurr = pCrvBezier->GetControlWeight( nDeg + 1) ;
|
||||||
|
pNewBezier->SetControlPoint( nDeg, ptCtrlCurr, dWcurr) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pNewBezier->SetControlPoint( nDeg, ptCtrlCurr) ;
|
||||||
|
ptCtrlPrev = ptCtrlCurr ;
|
||||||
|
if ( bRat)
|
||||||
|
dWprev = dWcurr ;
|
||||||
|
// seconda metà
|
||||||
|
for ( double i = nDeg - 1 ; i > r ; --i) {
|
||||||
|
double dAlpha = ( i + 1) / ( nDeg + 1) ;
|
||||||
|
Point3d ptOld = pCrvBezier->GetControlPoint( int( i) + 1) ;
|
||||||
|
ptCtrlCurr = ( ptOld + ( - ( 1 - dAlpha) * ptCtrlPrev)) / dAlpha ;
|
||||||
|
if ( bRat) {
|
||||||
|
double dWold = pCrvBezier->GetControlWeight( int( i) + 1) ;
|
||||||
|
dWcurr = ( dWold - ( ( 1 - dAlpha) * dWprev)) / dAlpha ;
|
||||||
|
pNewBezier->SetControlPoint( int( i), ptCtrlCurr, dWcurr) ;
|
||||||
|
dWprev = dWcurr ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pNewBezier->SetControlPoint( int( i), ptCtrlCurr) ;
|
||||||
|
ptCtrlPrev = ptCtrlCurr ;
|
||||||
|
}
|
||||||
|
// risolvo il punto di mezzo per il caso nDeg dispari
|
||||||
|
// calcolo anche l'errore di approssimazione
|
||||||
|
double dErr = 0 ;
|
||||||
|
if ( (nDeg + 1) % 2 != 0) { // dispari
|
||||||
|
// puntdo di sinistra
|
||||||
|
double dAlpha = r / ( nDeg + 1.) ;
|
||||||
|
ptCtrlPrev = pNewBezier->GetControlPoint( r - 1) ;
|
||||||
|
Point3d ptOld = pCrvBezier->GetControlPoint( r) ;
|
||||||
|
Point3d ptL = ( ptOld + ( - dAlpha * ptCtrlPrev)) / ( 1 - dAlpha) ;
|
||||||
|
double dWL = 1 ;
|
||||||
|
if ( bRat) {
|
||||||
|
dWprev = pNewBezier->GetControlWeight( r - 1) ;
|
||||||
|
double dWold =pCrvBezier->GetControlWeight( r) ;
|
||||||
|
dWL = ( dWold - ( dAlpha * dWprev)) / ( 1 - dAlpha) ;
|
||||||
|
}
|
||||||
|
// punto di destra
|
||||||
|
dAlpha = ( r + 1.) / ( nDeg + 1.) ;
|
||||||
|
ptCtrlPrev = pNewBezier->GetControlPoint( r + 1) ;
|
||||||
|
ptOld = pCrvBezier->GetControlPoint( r + 1) ;
|
||||||
|
double dWR = 1 ;
|
||||||
|
if ( bRat) {
|
||||||
|
dWprev = pNewBezier->GetControlWeight( r + 1) ;
|
||||||
|
double dWold =pCrvBezier->GetControlWeight( r + 1) ;
|
||||||
|
dWR = ( dWold - ( ( 1 - dAlpha) * dWprev)) / dAlpha ;
|
||||||
|
}
|
||||||
|
Point3d ptR = ( ptOld + ( - ( 1 - dAlpha) * ptCtrlPrev)) / dAlpha ;
|
||||||
|
// calcolo il punto di mezzo e lo aggiungo
|
||||||
|
Point3d ptNew = ( ptL + ptR) / 2 ;
|
||||||
|
double dWnew = ( dWL + dWR) / 2 ;
|
||||||
|
if ( bRat)
|
||||||
|
pNewBezier->SetControlPoint( r, ptNew, dWnew) ;
|
||||||
|
else
|
||||||
|
pNewBezier->SetControlPoint( r, ptNew) ;
|
||||||
|
dErr = Dist( ptL, ptR) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ptCtrlCurr = pNewBezier->GetControlPoint( r + 1) ;
|
||||||
|
ptCtrlPrev = pNewBezier->GetControlPoint( r) ;
|
||||||
|
Point3d ptOld = pCrvBezier->GetControlPoint( r + 1) ;
|
||||||
|
dErr = Dist( ptOld, 0.5 * ( ptCtrlPrev + ptCtrlCurr)) ;
|
||||||
|
}
|
||||||
|
//// se l'approssimazione dà un errore troppo alto allora annullo tutto // da controllare
|
||||||
|
//if ( dErr > dTol)
|
||||||
|
// return nullptr ;
|
||||||
|
|
||||||
|
return Release( pNewBezier) ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
ICurve*
|
ICurve*
|
||||||
CurveToNoArcsCurve( const ICurve* pCrv)
|
CurveToNoArcsCurve( const ICurve* pCrv)
|
||||||
{
|
{
|
||||||
// verifico validità curva
|
// verifico validità curva
|
||||||
if ( pCrv == nullptr)
|
if ( pCrv == nullptr)
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
// se arco, devo trasformarlo in curva di Bezier (semplice o composta)
|
// se arco, devo trasformarlo in curva di Bezier (semplice o composta)
|
||||||
@@ -478,7 +747,7 @@ CurveToNoArcsCurve( const ICurve* pCrv)
|
|||||||
ICurve*
|
ICurve*
|
||||||
CurveToArcsPerpExtrCurve( const ICurve* pCrv, double dLinTol, double dAngTolDeg)
|
CurveToArcsPerpExtrCurve( const ICurve* pCrv, double dLinTol, double dAngTolDeg)
|
||||||
{
|
{
|
||||||
// verifico validità curva
|
// verifico validità curva
|
||||||
if ( pCrv == nullptr)
|
if ( pCrv == nullptr)
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
// se arco in piano non perpendicolare ad estrusione, curva composita o curva di Bezier trasformo
|
// se arco in piano non perpendicolare ad estrusione, curva composita o curva di Bezier trasformo
|
||||||
@@ -522,15 +791,90 @@ NurbsCurveCanonicalize( CNurbsData& cnData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// se periodica
|
// se periodica
|
||||||
if ( cnData.bPeriodic) {
|
if ( cnData.bPeriodic || ! cnData.bClamped) {
|
||||||
|
// se la curva è peridica verifco che effettivamente ci sia un numero di punti ripetituti uguale al grado della curva
|
||||||
|
// wrap della curva su se stessa
|
||||||
|
if ( cnData.bPeriodic ) {
|
||||||
|
bool bRepetead = true ;
|
||||||
|
for ( int i = 0 ; i < cnData.nDeg ; ++i) {
|
||||||
|
if ( ! AreSamePointApprox( cnData.vCP[i], cnData.vCP.end()[-cnData.nDeg + i]) ) {
|
||||||
|
bRepetead = false ;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ! bRepetead){
|
||||||
|
// salvo il vettore dei nodi in caso mi accorga di avere tra le mani una curva unclamped
|
||||||
|
DBLVECTOR vU = cnData.vU ;
|
||||||
|
// se il primo e l'ultimo punto non coincidono allora aggiungo il primo punto in fondo al vettore dei punti di controllo
|
||||||
|
if ( ! AreSamePointApprox( cnData.vCP[0], cnData.vCP.back()) ) {
|
||||||
|
cnData.vCP.push_back( cnData.vCP[0]) ;
|
||||||
|
if ( cnData.bRat)
|
||||||
|
cnData.vW.push_back( cnData.vW[0]) ;
|
||||||
|
}
|
||||||
|
// se effettivamente ho dei nodi in più da togliere allora li tolgo
|
||||||
|
if ( int( cnData.vU.size()) != int(cnData.vCP.size()) + cnData.nDeg - 1) {
|
||||||
|
// devo poi anche togliere i nodi di troppo // presuppongo che la convenzione sia che i nodi di troppo sono alla fine del vettore dei nodi
|
||||||
|
cnData.vU = DBLVECTOR( cnData.vU.begin(), cnData.vU.end() - cnData.nDeg) ;
|
||||||
|
// controllo eventualmente anche i nodi extra
|
||||||
|
// se ne ho due in più ne tolgo uno in cima e uno in fondo
|
||||||
|
if ( cnData.vU.size() == int( cnData.vCP.size()) + cnData.nDeg + 1 ) // significa che ci sono due nodi extra, uno all'inizio e uno alla fine, da togliere
|
||||||
|
cnData.vU = vector<double>( cnData.vU.begin() + 1, cnData.vU.end() - 1) ;
|
||||||
|
// se ne ho solo uno in più lo tolgo in cima
|
||||||
|
else if ( cnData.vU.size() == int( cnData.vCP.size()) + cnData.nDeg)
|
||||||
|
cnData.vU = vector<double>( cnData.vU.begin() + 1, cnData.vU.end()) ;
|
||||||
|
}
|
||||||
|
// controllo se il vettore dei nodi ha la giusta molteplicità all'inizio e alla fine, sennò ha comunque bisogno di essere resa non periodica
|
||||||
|
double dU0 = cnData.vU[0] ;
|
||||||
|
double dULast = cnData.vU.back() ;
|
||||||
|
bool bSame = true ;
|
||||||
|
for ( int i = 1 ; i < cnData.nDeg ; ++i ) {
|
||||||
|
bSame = bSame && abs(cnData.vU[i] - dU0) < EPS_SMALL ;
|
||||||
|
bSame = bSame && abs(cnData.vU.end()[-( i+ 1)] - dULast) < EPS_SMALL ;
|
||||||
|
}
|
||||||
|
if ( bSame) {
|
||||||
|
cnData.bPeriodic = false ;
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// aggiungo i punti ripetuti ( il primo l'ho già aggiunto)
|
||||||
|
for ( int i = 1 ; i < cnData.nDeg ; ++i ) {
|
||||||
|
cnData.vCP.push_back( cnData.vCP[i]) ;
|
||||||
|
if ( cnData.bRat)
|
||||||
|
cnData.vW.push_back( cnData.vW[i]) ;
|
||||||
|
}
|
||||||
|
// recupero il vettore dei nodi
|
||||||
|
cnData.vU = vU ;
|
||||||
|
// verifico se ho nodi extra
|
||||||
|
// se ne ho due in più ne tolgo uno in cima e uno in fondo
|
||||||
|
if ( cnData.vU.size() == int( cnData.vCP.size()) + cnData.nDeg + 1 ) // significa che ci sono due nodi extra, uno all'inizio e uno alla fine, da togliere
|
||||||
|
cnData.vU = vector<double>( cnData.vU.begin() + 1, cnData.vU.end() - 1) ;
|
||||||
|
// se ne ho solo uno in più lo tolgo in cima
|
||||||
|
else if ( cnData.vU.size() == int( cnData.vCP.size()) + cnData.nDeg)
|
||||||
|
cnData.vU = vector<double>( cnData.vU.begin() + 1, cnData.vU.end()) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// qui aggiungo un controllo se la curva è collassata in un punto ( ho un polo), lascio stare
|
||||||
|
bool bCollapsed = true ;
|
||||||
|
Point3d ptFirst = cnData.vCP.front() ;
|
||||||
|
for( int i = 1 ; i < int( cnData.vCP.size()) ; ++i) {
|
||||||
|
if ( ! AreSamePointApprox( ptFirst, cnData.vCP[i])) {
|
||||||
|
bCollapsed = false ;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( bCollapsed)
|
||||||
|
return false ;
|
||||||
|
|
||||||
// va trasformata in non-periodica (clamped)
|
// va trasformata in non-periodica (clamped)
|
||||||
// bisogna aumentare la molteplicità dei nodi u_p-1 e u_(m-p+1) fino ad arrivare al grado della nurbs
|
// bisogna aumentare la molteplicità dei nodi u_p-1 e u_(m-p+1) fino ad arrivare al grado della nurbs
|
||||||
// e poi scartare nodi e punti fuori dalla regione clamped ( al di fuori della regione u_p-1 -> u_(m-p+1))
|
// e poi scartare nodi e punti fuori dalla regione clamped ( al di fuori della regione u_p-1 -> u_(m-p+1))
|
||||||
|
|
||||||
// l'agoritmo per l'inserimento dei nodi l' A5.1 del libro delle Nurbs ( Piegl e Tiller), con qualche modifica
|
// l'agoritmo per l'inserimento dei nodi l' A5.1 del libro delle Nurbs ( Piegl e Tiller), con qualche modifica
|
||||||
// agli indici perché uso u_p-1 e u_(m-p+1), anziché u_p e u_m-p
|
// agli indici perché uso u_p-1 e u_(m-p+1), anziché u_p e u_m-p
|
||||||
|
|
||||||
// comincio ad aumentare la molteplictià del nodo u_m-p+1
|
// comincio ad aumentare la molteplictià del nodo u_m-p+1
|
||||||
int nCP = int( cnData.vCP.size()) ;
|
int nCP = int( cnData.vCP.size()) ;
|
||||||
int nU = nCP + cnData.nDeg - 1 ;
|
int nU = nCP + cnData.nDeg - 1 ;
|
||||||
int nDeg = cnData.nDeg ;
|
int nDeg = cnData.nDeg ;
|
||||||
@@ -539,12 +883,12 @@ NurbsCurveCanonicalize( CNurbsData& cnData)
|
|||||||
DBLVECTOR vBW ;
|
DBLVECTOR vBW ;
|
||||||
vBW.resize( nDeg + 1) ;
|
vBW.resize( nDeg + 1) ;
|
||||||
|
|
||||||
// trovo il nodo di cui aumentare la molteplicità e ne calcolo la molteplicità
|
// trovo il nodo di cui aumentare la molteplicità e ne calcolo la molteplicità
|
||||||
int b = nU - nDeg - 1 +1;
|
int b = nU - nDeg - 1 + 1 ;
|
||||||
int i = b ;
|
int i = b ;
|
||||||
while ( abs( cnData.vU[b] - cnData.vU[b - 1]) < EPS_ZERO)
|
while ( b > 0 && abs( cnData.vU[b] - cnData.vU[b - 1]) < EPS_ZERO)
|
||||||
-- b ;
|
-- b ;
|
||||||
int mult = min( i - b + 1, nDeg) ; // mi aspetto che sia 1, ma comunque sarà < nDeg
|
int mult = min( i - b + 1, nDeg) ; // mi aspetto che sia 1, ma comunque sarà < nDeg
|
||||||
// recupero i punti da modificare
|
// recupero i punti da modificare
|
||||||
if ( ! cnData.bRat) {
|
if ( ! cnData.bRat) {
|
||||||
for ( int i = 0 ; i <= nDeg - mult ; ++ i)
|
for ( int i = 0 ; i <= nDeg - mult ; ++ i)
|
||||||
@@ -558,7 +902,7 @@ NurbsCurveCanonicalize( CNurbsData& cnData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// salvo i punti inalterati
|
// salvo i punti inalterati
|
||||||
int r = nDeg - mult ; // numero di volte che dovrò inserire il nodo
|
int r = nDeg - mult ; // numero di volte che dovrò inserire il nodo
|
||||||
cnData.vCP.resize( nCP + r) ;
|
cnData.vCP.resize( nCP + r) ;
|
||||||
for ( int p = nCP - 1 ; p > b - mult ; --p) {
|
for ( int p = nCP - 1 ; p > b - mult ; --p) {
|
||||||
cnData.vCP[r + p] = cnData.vCP[p] ;
|
cnData.vCP[r + p] = cnData.vCP[p] ;
|
||||||
@@ -573,14 +917,11 @@ NurbsCurveCanonicalize( CNurbsData& cnData)
|
|||||||
// procedo all'inserimento
|
// procedo all'inserimento
|
||||||
int L = 0 ;
|
int L = 0 ;
|
||||||
double alpha ;
|
double alpha ;
|
||||||
double num, den ;
|
|
||||||
if ( mult < nDeg) {
|
if ( mult < nDeg) {
|
||||||
// inserisco il nodo r volte
|
// inserisco il nodo r volte
|
||||||
for ( int j = 1 ; j <= r ; ++ j) {
|
for ( int j = 1 ; j <= r ; ++ j) {
|
||||||
L = b - nDeg + j ;
|
L = b - nDeg + j ;
|
||||||
for ( int i = 0; i <= r - j ; ++i) {
|
for ( int i = 0; i <= r - j ; ++i) {
|
||||||
num = (cnData.vU[b] - cnData.vU[L + i]) ;
|
|
||||||
den = ( cnData.vU[i + b + 1] - cnData.vU[L + i]) ;
|
|
||||||
alpha = (cnData.vU[b] - cnData.vU[L + i])/ ( cnData.vU[i + b + 1] - cnData.vU[L + i]) ;
|
alpha = (cnData.vU[b] - cnData.vU[L + i])/ ( cnData.vU[i + b + 1] - cnData.vU[L + i]) ;
|
||||||
vBC[i] = alpha * vBC[i +1 ] + ( 1 - alpha) * vBC[i] ;
|
vBC[i] = alpha * vBC[i +1 ] + ( 1 - alpha) * vBC[i] ;
|
||||||
if ( cnData.bRat) {
|
if ( cnData.bRat) {
|
||||||
@@ -597,7 +938,7 @@ NurbsCurveCanonicalize( CNurbsData& cnData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// allungo il vettore dei nodi e sposto gli ultimi nodi
|
// allungo il vettore dei nodi e sposto gli ultimi nodi
|
||||||
cnData.vU.resize(nU + r) ;
|
cnData.vU.resize( nU + r) ;
|
||||||
for ( int p = nU - 1 ; p > b ; --p)
|
for ( int p = nU - 1 ; p > b ; --p)
|
||||||
cnData.vU[p + r] = cnData.vU[p] ;
|
cnData.vU[p + r] = cnData.vU[p] ;
|
||||||
// aggiungo i nodi nuovi
|
// aggiungo i nodi nuovi
|
||||||
@@ -606,12 +947,12 @@ NurbsCurveCanonicalize( CNurbsData& cnData)
|
|||||||
nU = nU + r ;
|
nU = nU + r ;
|
||||||
nCP = nCP + r ;
|
nCP = nCP + r ;
|
||||||
|
|
||||||
// aumento la molteplicità del punto u_p-1
|
// aumento la molteplicità del punto u_p-1
|
||||||
b = nDeg -1;
|
b = nDeg - 1 ;
|
||||||
i = b ;
|
i = b ;
|
||||||
while ( abs( cnData.vU[b] - cnData.vU[b - 1]) < EPS_ZERO)
|
while ( b > 0 && abs( cnData.vU[b] - cnData.vU[b - 1]) < EPS_ZERO)
|
||||||
-- b ;
|
-- b ;
|
||||||
mult = min( i - b + 1, nDeg) ; // mi aspetto che sia 1, ma comunque sarà < cnData.nDeg
|
mult = min( i - b + 1, nDeg) ; // mi aspetto che sia 1, ma comunque sarà < cnData.nDeg
|
||||||
// recupero i punti da modificare
|
// recupero i punti da modificare
|
||||||
if ( ! cnData.bRat) {
|
if ( ! cnData.bRat) {
|
||||||
for ( int i = 0 ; i <= nDeg - mult ; ++ i)
|
for ( int i = 0 ; i <= nDeg - mult ; ++ i)
|
||||||
@@ -721,10 +1062,10 @@ NurbsToBezierCurve( const CNurbsData& cnData)
|
|||||||
if ( ! bOk)
|
if ( ! bOk)
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
|
|
||||||
// se 1 solo intervallo, la Nurbs è già una curva di Bezier
|
// se 1 solo intervallo, la Nurbs è già una curva di Bezier
|
||||||
if ( nInt == 1) {
|
if ( nInt == 1) {
|
||||||
// creo la curva di Bezier
|
// creo la curva di Bezier
|
||||||
PtrOwner<ICurveBezier> pCrvBez( CreateCurveBezier()) ;
|
PtrOwner<CurveBezier> pCrvBez( CreateBasicCurveBezier()) ;
|
||||||
if ( IsNull( pCrvBez))
|
if ( IsNull( pCrvBez))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
// la inizializzo
|
// la inizializzo
|
||||||
@@ -740,15 +1081,15 @@ NurbsToBezierCurve( const CNurbsData& cnData)
|
|||||||
return nullptr ;
|
return nullptr ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// se non è una curva ma un punto, la invalido
|
// se non è una curva ma un punto, la invalido
|
||||||
if ( pCrvBez->IsAPoint())
|
if ( pCrvBez->IsAPoint())
|
||||||
pCrvBez->Init( cnData.nDeg, cnData.bRat) ;
|
pCrvBez->Init( cnData.nDeg, cnData.bRat) ;
|
||||||
// restituisco la curva
|
// restituisco la curva
|
||||||
return Release( pCrvBez) ;
|
return Release( pCrvBez) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// altrimenti è equivalente ad una curva composita, la creo
|
// altrimenti è equivalente ad una curva composita, la creo
|
||||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
PtrOwner<CurveComposite> pCrvCompo( CreateBasicCurveComposite()) ;
|
||||||
if ( IsNull( pCrvCompo))
|
if ( IsNull( pCrvCompo))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
|
|
||||||
@@ -779,7 +1120,6 @@ NurbsToBezierCurve( const CNurbsData& cnData)
|
|||||||
int b = cnData.nDeg ;
|
int b = cnData.nDeg ;
|
||||||
bool bPrevRejected = false ;
|
bool bPrevRejected = false ;
|
||||||
// ciclo
|
// ciclo
|
||||||
int n = 0 ; // debug
|
|
||||||
while ( b < nU - 1) {
|
while ( b < nU - 1) {
|
||||||
int i = b ;
|
int i = b ;
|
||||||
while ( b < nU - 1 && abs( cnData.vU[b+1] - cnData.vU[b]) < EPS_ZERO)
|
while ( b < nU - 1 && abs( cnData.vU[b+1] - cnData.vU[b]) < EPS_ZERO)
|
||||||
@@ -811,12 +1151,12 @@ NurbsToBezierCurve( const CNurbsData& cnData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// costruisco la curva di Bezier e la inserisco nella curva composita
|
// costruisco la curva di Bezier e la inserisco nella curva composita
|
||||||
PtrOwner<ICurveBezier> pCrvBez( CreateCurveBezier()) ;
|
PtrOwner<CurveBezier> pCrvBez( CreateBasicCurveBezier()) ;
|
||||||
if ( IsNull( pCrvBez))
|
if ( IsNull( pCrvBez))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
// se precedente saltata
|
// se precedente saltata
|
||||||
if ( bPrevRejected) {
|
if ( bPrevRejected) {
|
||||||
// prendo l'ultimo punto della curva composita per garantire la continuità
|
// prendo l'ultimo punto della curva composita per garantire la continuità
|
||||||
Point3d ptEnd ;
|
Point3d ptEnd ;
|
||||||
if ( pCrvCompo->GetEndPoint( ptEnd))
|
if ( pCrvCompo->GetEndPoint( ptEnd))
|
||||||
vBC[0] = ptEnd ;
|
vBC[0] = ptEnd ;
|
||||||
@@ -836,19 +1176,17 @@ NurbsToBezierCurve( const CNurbsData& cnData)
|
|||||||
return nullptr ;
|
return nullptr ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// se è una vera curva, la aggiungo alla curva composita
|
// se è una vera curva, la aggiungo alla curva composita
|
||||||
if ( ! pCrvBez->IsAPoint()) {
|
if ( ! pCrvBez->IsAPoint()) {
|
||||||
if ( ! pCrvCompo->AddCurve( Release( pCrvBez)))
|
if ( ! pCrvCompo->AddCurve( Release( pCrvBez)))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
bPrevRejected = false ;
|
bPrevRejected = false ;
|
||||||
}
|
}
|
||||||
// altrimenti è un punto, la cancello
|
// altrimenti è un punto, la cancello
|
||||||
else {
|
else {
|
||||||
pCrvBez.Reset() ;
|
pCrvBez.Reset() ;
|
||||||
bPrevRejected = true ;
|
bPrevRejected = true ;
|
||||||
}
|
}
|
||||||
// debug
|
|
||||||
++n ;
|
|
||||||
// inizializzazioni per la prossima curva di Bezier
|
// inizializzazioni per la prossima curva di Bezier
|
||||||
if ( b < nU - 1) {
|
if ( b < nU - 1) {
|
||||||
if ( ! cnData.bRat) {
|
if ( ! cnData.bRat) {
|
||||||
@@ -875,7 +1213,7 @@ NurbsToBezierCurve( const CNurbsData& cnData)
|
|||||||
// se la curva ha grado 1, manca da aggiungere l'ultimo tratto
|
// se la curva ha grado 1, manca da aggiungere l'ultimo tratto
|
||||||
if ( cnData.nDeg == 1 ) {
|
if ( cnData.nDeg == 1 ) {
|
||||||
// costruisco la curva di Bezier e la inserisco nella curva composita
|
// costruisco la curva di Bezier e la inserisco nella curva composita
|
||||||
PtrOwner<ICurveBezier> pCrvBez( CreateCurveBezier()) ;
|
PtrOwner<CurveBezier> pCrvBez( CreateBasicCurveBezier()) ;
|
||||||
if ( ! pCrvBez->Init( cnData.nDeg, cnData.bRat))
|
if ( ! pCrvBez->Init( cnData.nDeg, cnData.bRat))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
if ( ! cnData.bRat) {
|
if ( ! cnData.bRat) {
|
||||||
@@ -916,7 +1254,7 @@ FlattenCurve( const ICurve& crCrv, double dToler, double dAngToler, int nFlag)
|
|||||||
Point3d ptCen ;
|
Point3d ptCen ;
|
||||||
if ( ! crCrv.GetCentroid( ptCen))
|
if ( ! crCrv.GetCentroid( ptCen))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
// Verifico se curva già piatta
|
// Verifico se curva già piatta
|
||||||
PolyLine PL ;
|
PolyLine PL ;
|
||||||
if ( ! crCrv.ApproxWithLines( LIN_TOL_FINE, ANG_TOL_STD_DEG, ICurve::APL_SPECIAL_INT, PL))
|
if ( ! crCrv.ApproxWithLines( LIN_TOL_FINE, ANG_TOL_STD_DEG, ICurve::APL_SPECIAL_INT, PL))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
@@ -929,7 +1267,7 @@ FlattenCurve( const ICurve& crCrv, double dToler, double dAngToler, int nFlag)
|
|||||||
bFlat = false ;
|
bFlat = false ;
|
||||||
bPoint = PL.GetNextPoint( ptP) ;
|
bPoint = PL.GetNextPoint( ptP) ;
|
||||||
}
|
}
|
||||||
// Se curva già piatta, la copio ed esco
|
// Se curva già piatta, la copio ed esco
|
||||||
if ( bFlat) {
|
if ( bFlat) {
|
||||||
PtrOwner<ICurve> pCrv( crCrv.Clone()) ;
|
PtrOwner<ICurve> pCrv( crCrv.Clone()) ;
|
||||||
if ( IsNull( pCrv))
|
if ( IsNull( pCrv))
|
||||||
@@ -980,7 +1318,7 @@ ProjectCurveOnPlane( const ICurve& crCrv, const Plane3d& plPlane)
|
|||||||
// determino se curva piana e suo eventuale piano
|
// determino se curva piana e suo eventuale piano
|
||||||
Plane3d plCrv ;
|
Plane3d plCrv ;
|
||||||
if ( crCrv.IsFlat( plCrv, false, EPS_SMALL / 2)) {
|
if ( crCrv.IsFlat( plCrv, false, EPS_SMALL / 2)) {
|
||||||
// se il piano della curva è parallelo a quello di proiezione
|
// se il piano della curva è parallelo a quello di proiezione
|
||||||
if ( AreSameOrOppositeVectorExact( plCrv.GetVersN(), plPlane.GetVersN())) {
|
if ( AreSameOrOppositeVectorExact( plCrv.GetVersN(), plPlane.GetVersN())) {
|
||||||
// copio la curva
|
// copio la curva
|
||||||
PtrOwner<ICurve> pCrv( crCrv.Clone()) ;
|
PtrOwner<ICurve> pCrv( crCrv.Clone()) ;
|
||||||
@@ -1045,3 +1383,69 @@ AdjustCurveSlope( ICurveComposite* pCrv, double dNini, double dNfin)
|
|||||||
pCrv->ModifyEnd( ptFin) ;
|
pCrv->ModifyEnd( ptFin) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Voronoi*
|
||||||
|
GetCurveVoronoi( const ICurve& crvC)
|
||||||
|
{
|
||||||
|
switch ( crvC.GetType()) {
|
||||||
|
case CRV_LINE : return GetBasicCurveLine( &crvC)->GetVoronoiObject() ;
|
||||||
|
case CRV_ARC : return GetBasicCurveArc( &crvC)->GetVoronoiObject() ;
|
||||||
|
case CRV_BEZIER : return GetBasicCurveBezier( &crvC)->GetVoronoiObject() ;
|
||||||
|
case CRV_COMPO : return GetBasicCurveComposite( &crvC)->GetVoronoiObject() ;
|
||||||
|
}
|
||||||
|
return nullptr ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
CalcCurveVoronoiDiagram( const ICurve& crvC, ICURVEPOVECTOR& vCrvs, int nBound)
|
||||||
|
{
|
||||||
|
Voronoi* pVoronoiObj = GetCurveVoronoi( crvC) ;
|
||||||
|
if ( pVoronoiObj == nullptr)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
return pVoronoiObj->CalcVoronoiDiagram( vCrvs, nBound) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
CalcCurveMedialAxis( const ICurve& crvC, ICURVEPOVECTOR& vCrvs, int nSide)
|
||||||
|
{
|
||||||
|
Voronoi* pVoronoiObj = GetCurveVoronoi( crvC) ;
|
||||||
|
if ( pVoronoiObj == nullptr)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
return pVoronoiObj->CalcMedialAxis( vCrvs, nSide) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
CalcCurveFatCurve( const ICurve& crvC, ICURVEPOVECTOR& vCrvs, double dRadius, bool bSquareEnds, bool bSquareMids)
|
||||||
|
{
|
||||||
|
Voronoi* pVoronoiObj = GetCurveVoronoi( crvC) ;
|
||||||
|
if ( pVoronoiObj == nullptr)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
return pVoronoiObj->CalcFatCurve( vCrvs, dRadius, bSquareEnds, bSquareMids) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void
|
||||||
|
ResetCurveVoronoi( const ICurve& crvC)
|
||||||
|
{
|
||||||
|
switch ( crvC.GetType()) {
|
||||||
|
case CRV_LINE :
|
||||||
|
GetBasicCurveLine( &crvC)->ResetVoronoiObject() ;
|
||||||
|
break ;
|
||||||
|
case CRV_ARC :
|
||||||
|
GetBasicCurveArc( &crvC)->ResetVoronoiObject() ;
|
||||||
|
break ;
|
||||||
|
case CRV_BEZIER :
|
||||||
|
GetBasicCurveBezier( &crvC)->ResetVoronoiObject() ;
|
||||||
|
break ;
|
||||||
|
case CRV_COMPO :
|
||||||
|
GetBasicCurveComposite( &crvC)->ResetVoronoiObject() ;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||||
|
|
||||||
|
class Voronoi ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool IsClosed( const ICurve& crvC) ;
|
bool IsClosed( const ICurve& crvC) ;
|
||||||
bool IsValidParam( const ICurve& crvC, double dPar, ICurve::Side nSide) ;
|
bool IsValidParam( const ICurve& crvC, double dPar, ICurve::Side nSide) ;
|
||||||
@@ -31,3 +33,4 @@ bool CurveGetArea( const ICurve& crvC, Plane3d& plPlane, double& dArea) ;
|
|||||||
bool CurveDump( const ICurve& crvC, std::string& sOut, bool bMM, const char* szNewLine) ;
|
bool CurveDump( const ICurve& crvC, std::string& sOut, bool bMM, const char* szNewLine) ;
|
||||||
bool CopyExtrusion( const ICurve* pSouCrv, ICurve* pDestCrv) ;
|
bool CopyExtrusion( const ICurve* pSouCrv, ICurve* pDestCrv) ;
|
||||||
bool CopyThickness( const ICurve* pSouCrv, ICurve* pDestCrv) ;
|
bool CopyThickness( const ICurve* pSouCrv, ICurve* pDestCrv) ;
|
||||||
|
Voronoi* GetCurveVoronoi( const ICurve& crvC) ;
|
||||||
|
|||||||
+154
-10
@@ -19,19 +19,23 @@
|
|||||||
#include "BiArcs.h"
|
#include "BiArcs.h"
|
||||||
#include "GeoConst.h"
|
#include "GeoConst.h"
|
||||||
#include "PolygonPlane.h"
|
#include "PolygonPlane.h"
|
||||||
#include "DistPointLine.h"
|
|
||||||
#include "GeoObjFactory.h"
|
#include "GeoObjFactory.h"
|
||||||
#include "NgeWriter.h"
|
#include "NgeWriter.h"
|
||||||
#include "NgeReader.h"
|
#include "NgeReader.h"
|
||||||
#include "PolynomialPoint3d.h"
|
#include "PolynomialPoint3d.h"
|
||||||
#include "Bernstein.h"
|
#include "Bernstein.h"
|
||||||
#include "deCasteljau.h"
|
#include "deCasteljau.h"
|
||||||
|
#include "Voronoi.h"
|
||||||
|
#include "IntersLineLine.h"
|
||||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||||
#include "/EgtDev/Include/ENkPolynomial.h"
|
#include "/EgtDev/Include/ENkPolynomial.h"
|
||||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
|
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||||
|
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
@@ -45,15 +49,14 @@ GEOOBJ_REGISTER( CRV_BEZIER, NGE_C_BEZ, CurveBezier) ;
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
CurveBezier::CurveBezier( void)
|
CurveBezier::CurveBezier( void)
|
||||||
: m_nStatus( TO_VERIFY), m_nDeg(), m_bRat( false), m_dParSing( -2),
|
: m_nStatus( TO_VERIFY), m_nDeg(), m_bRat( false), m_dParSing( -2),
|
||||||
m_VtExtr(), m_dThick()
|
m_VtExtr(), m_dThick(), m_nTempProp{0,0}, m_dTempParam{0.0,0.0}, m_pVoronoiObj( nullptr)
|
||||||
{
|
{
|
||||||
m_nTempProp[0] = 0 ;
|
|
||||||
m_nTempProp[1] = 0 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
CurveBezier::~CurveBezier( void)
|
CurveBezier::~CurveBezier( void)
|
||||||
{
|
{
|
||||||
|
ResetVoronoiObject() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -77,6 +80,8 @@ CurveBezier::Init( int nDeg, bool bIsRational)
|
|||||||
m_vWeCtrl.clear() ;
|
m_vWeCtrl.clear() ;
|
||||||
m_nStatus = TO_VERIFY ;
|
m_nStatus = TO_VERIFY ;
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -101,6 +106,8 @@ CurveBezier::SetControlPoint( int nInd, const Point3d& ptCtrl)
|
|||||||
// annullo analisi presenza singolarità
|
// annullo analisi presenza singolarità
|
||||||
m_dParSing = - 2 ;
|
m_dParSing = - 2 ;
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -126,6 +133,8 @@ CurveBezier::SetControlPoint( int nInd, const Point3d& ptCtrl, double dW)
|
|||||||
// annullo analisi presenza singolarità
|
// annullo analisi presenza singolarità
|
||||||
m_dParSing = - 2 ;
|
m_dParSing = - 2 ;
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -189,6 +198,35 @@ CurveBezier::FromArc( const ICurveArc& crArc)
|
|||||||
SetControlPoint( 1, ptNew1, dW) ;
|
SetControlPoint( 1, ptNew1, dW) ;
|
||||||
SetControlPoint( 2, ptNew2, dW) ;
|
SetControlPoint( 2, ptNew2, dW) ;
|
||||||
SetControlPoint( 3, ptEnd, 1) ;
|
SetControlPoint( 3, ptEnd, 1) ;
|
||||||
|
|
||||||
|
//// anziché usare una bezier cubica approssimo le eliche con più bezier quadratiche razionali.
|
||||||
|
//// più è grande l'angolo al centro dell'arco e maggiore sarà l'errore di approssimazione
|
||||||
|
//
|
||||||
|
// // quadratica razionale
|
||||||
|
// // peso del punto di controllo intermedio
|
||||||
|
// double dW = dCosAhalf ;
|
||||||
|
// // calcolo dei punti di controllo
|
||||||
|
// Point3d ptStart ;
|
||||||
|
// crArc.GetStartPoint( ptStart) ;
|
||||||
|
// Point3d ptEnd ;
|
||||||
|
// crArc.GetEndPoint( ptEnd) ;
|
||||||
|
// // Point3d ptMed = Media( ptStart, ptEnd, 0.5) ;
|
||||||
|
// //Vector3d vtDir = ptMed - crArc.GetCenter() ;
|
||||||
|
// // Point3d ptNew = crArc.GetCenter() + vtDir / ( dCosAhalf * dCosAhalf) ;
|
||||||
|
// Vector3d vtStart ; crArc.GetStartDir( vtStart) ;
|
||||||
|
// Vector3d vtEnd ; crArc.GetEndDir( vtEnd) ;
|
||||||
|
// PtrOwner<CurveLine> pCrvLine1( CreateBasicCurveLine()) ;
|
||||||
|
// pCrvLine1->SetPVL( ptStart, vtStart, 10) ;
|
||||||
|
// PtrOwner<CurveLine> pCrvLine2( CreateBasicCurveLine()) ;
|
||||||
|
// pCrvLine2->SetPVL( ptEnd, vtEnd, 10) ;
|
||||||
|
// IntersLineLine ill( *pCrvLine1, *pCrvLine2, false) ;
|
||||||
|
// IntCrvCrvInfo iccInfo ; ill.GetIntCrvCrvInfo( iccInfo) ;
|
||||||
|
// Point3d ptNew = 0.5 * (iccInfo.IciA->ptI + iccInfo.IciB->ptI) ;
|
||||||
|
// // inserimento nella curva dei punti di controllo con i pesi
|
||||||
|
// Init( 2, true) ;
|
||||||
|
// SetControlPoint( 0, ptStart, 1) ;
|
||||||
|
// SetControlPoint( 1, ptNew, dW) ;
|
||||||
|
// SetControlPoint( 2, ptEnd, 1) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copio estrusione e spessore
|
// copio estrusione e spessore
|
||||||
@@ -198,6 +236,30 @@ CurveBezier::FromArc( const ICurveArc& crArc)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
CurveBezier::FromLine( const ICurveLine& crLine)
|
||||||
|
{
|
||||||
|
if ( ! crLine.IsValid())
|
||||||
|
return false ;
|
||||||
|
double dWeight = 1 ;
|
||||||
|
int nCount = 0 ;
|
||||||
|
Point3d ptStart ; crLine.GetStartPoint( ptStart) ;
|
||||||
|
SetControlPoint( nCount, ptStart, dWeight) ;
|
||||||
|
++nCount ;
|
||||||
|
double dPart = 1. / m_nDeg ;
|
||||||
|
for ( int i = 1 ; i < m_nDeg ; ++i) {
|
||||||
|
double dU = i * dPart ;
|
||||||
|
Point3d ptMid ; crLine.GetPointD1D2( dU, ICurve::FROM_MINUS, ptMid) ;
|
||||||
|
SetControlPoint( nCount, ptMid, dWeight) ;
|
||||||
|
++nCount ;
|
||||||
|
}
|
||||||
|
Point3d ptEnd ; crLine.GetEndPoint( ptEnd) ;
|
||||||
|
SetControlPoint( nCount, ptEnd, dWeight) ;
|
||||||
|
++nCount ;
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
CurveBezier::IsAPoint( void) const
|
CurveBezier::IsAPoint( void) const
|
||||||
@@ -287,6 +349,8 @@ CurveBezier::CopyFrom( const CurveBezier& cbSrc)
|
|||||||
m_dThick = cbSrc.m_dThick ;
|
m_dThick = cbSrc.m_dThick ;
|
||||||
m_nTempProp[0] = cbSrc.m_nTempProp[0] ;
|
m_nTempProp[0] = cbSrc.m_nTempProp[0] ;
|
||||||
m_nTempProp[1] = cbSrc.m_nTempProp[1] ;
|
m_nTempProp[1] = cbSrc.m_nTempProp[1] ;
|
||||||
|
m_dTempParam[0] = cbSrc.m_dTempParam[0] ;
|
||||||
|
m_dTempParam[1] = cbSrc.m_dTempParam[1] ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,9 +504,8 @@ CurveBezier::Validate( void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_nStatus == TO_VERIFY)
|
if ( m_nStatus == TO_VERIFY)
|
||||||
m_nStatus = ( ( m_nDeg > 0 && m_vPtCtrl.size() > 0) ? OK : ERR) ;
|
m_nStatus = ( ( m_nDeg >= 1 && m_vPtCtrl.size() >= 2) ? OK : ERR) ;
|
||||||
|
|
||||||
return ( m_nStatus == OK) ;
|
return ( m_nStatus == OK) ;
|
||||||
}
|
}
|
||||||
@@ -620,7 +683,7 @@ CurveBezier::GetMidPoint( Point3d& ptMid) const
|
|||||||
return false ;
|
return false ;
|
||||||
// determino il valore del parametro a metà lunghezza
|
// determino il valore del parametro a metà lunghezza
|
||||||
double dLen, dMid ;
|
double dLen, dMid ;
|
||||||
if ( ! GetLength( dLen) || ! GetParamAtLength( 0.5 * dLen, dMid))
|
if ( ! GetLengthAtParam( 1, dLen) || ! GetParamAtLength( 0.5 * dLen, dMid))
|
||||||
return false ;
|
return false ;
|
||||||
// calcolo il punto
|
// calcolo il punto
|
||||||
return GetPointD1D2( dMid, ptMid) ;
|
return GetPointD1D2( dMid, ptMid) ;
|
||||||
@@ -657,7 +720,7 @@ CurveBezier::GetMidDir( Vector3d& vtDir) const
|
|||||||
return false ;
|
return false ;
|
||||||
// determino il valore del parametro a metà lunghezza
|
// determino il valore del parametro a metà lunghezza
|
||||||
double dLen, dMid ;
|
double dLen, dMid ;
|
||||||
if ( ! GetLength( dLen) || ! GetParamAtLength( 0.5 * dLen, dMid))
|
if ( ! GetLengthAtParam( 1, dLen) || ! GetParamAtLength( 0.5 * dLen, dMid))
|
||||||
return false ;
|
return false ;
|
||||||
// calcolo la direzione
|
// calcolo la direzione
|
||||||
return ::GetTang( *this, dMid, FROM_MINUS, vtDir) ;
|
return ::GetTang( *this, dMid, FROM_MINUS, vtDir) ;
|
||||||
@@ -1607,6 +1670,8 @@ CurveBezier::Invert( void)
|
|||||||
for ( int i = 0 ; i < nMid ; ++ i)
|
for ( int i = 0 ; i < nMid ; ++ i)
|
||||||
swap( m_vPtCtrl[i], m_vPtCtrl[m_nDeg-i]) ;
|
swap( m_vPtCtrl[i], m_vPtCtrl[m_nDeg-i]) ;
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1624,6 +1689,8 @@ CurveBezier::ModifyStart( const Point3d& ptNewStart)
|
|||||||
// modifico il primo punto di controllo
|
// modifico il primo punto di controllo
|
||||||
m_vPtCtrl[0] = ptNewStart ;
|
m_vPtCtrl[0] = ptNewStart ;
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1641,6 +1708,8 @@ CurveBezier::ModifyEnd( const Point3d& ptNewEnd)
|
|||||||
// modifico l'ultimo punto di controllo
|
// modifico l'ultimo punto di controllo
|
||||||
m_vPtCtrl[m_nDeg] = ptNewEnd ;
|
m_vPtCtrl[m_nDeg] = ptNewEnd ;
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1665,6 +1734,8 @@ CurveBezier::TrimStartAtParam( double dUTrim)
|
|||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1689,6 +1760,8 @@ CurveBezier::TrimEndAtParam( double dUTrim)
|
|||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1755,7 +1828,7 @@ CurveBezier::ExtendStartByLen( double dLenExt)
|
|||||||
return false ;
|
return false ;
|
||||||
// determino la lunghezza originale della curva
|
// determino la lunghezza originale della curva
|
||||||
double dLen ;
|
double dLen ;
|
||||||
if ( ! GetLength( dLen))
|
if ( ! GetLengthAtParam( 1, dLen))
|
||||||
return false ;
|
return false ;
|
||||||
// stimo il valore del parametro al nuovo punto iniziale
|
// stimo il valore del parametro al nuovo punto iniziale
|
||||||
double dUTrim = - dLenExt / dLen ;
|
double dUTrim = - dLenExt / dLen ;
|
||||||
@@ -1789,6 +1862,9 @@ CurveBezier::ExtendStartByLen( double dLenExt)
|
|||||||
m_vWeCtrl[i] = vWeCtrl[i] ;
|
m_vWeCtrl[i] = vWeCtrl[i] ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
return true ;
|
return true ;
|
||||||
@@ -1803,7 +1879,7 @@ CurveBezier::ExtendEndByLen( double dLenExt)
|
|||||||
return false ;
|
return false ;
|
||||||
// determino la lunghezza originale della curva
|
// determino la lunghezza originale della curva
|
||||||
double dLen ;
|
double dLen ;
|
||||||
if ( ! GetLength( dLen))
|
if ( ! GetLengthAtParam( 1, dLen))
|
||||||
return false ;
|
return false ;
|
||||||
// stimo il valore del parametro al nuovo punto finale
|
// stimo il valore del parametro al nuovo punto finale
|
||||||
double dUTrim = 1 + dLenExt / dLen ;
|
double dUTrim = 1 + dLenExt / dLen ;
|
||||||
@@ -1837,6 +1913,9 @@ CurveBezier::ExtendEndByLen( double dLenExt)
|
|||||||
m_vWeCtrl[i] = vWeCtrl[i] ;
|
m_vWeCtrl[i] = vWeCtrl[i] ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
return true ;
|
return true ;
|
||||||
@@ -1850,6 +1929,10 @@ CurveBezier::Translate( const Vector3d& vtMove)
|
|||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// traslo Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->Translate( vtMove) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1872,6 +1955,10 @@ CurveBezier::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng,
|
|||||||
if ( vtAx.IsSmall())
|
if ( vtAx.IsSmall())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// ruoto Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1914,6 +2001,8 @@ CurveBezier::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double
|
|||||||
if ( ! bOk)
|
if ( ! bOk)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1943,6 +2032,8 @@ CurveBezier::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
|||||||
if ( vtNorm.IsSmall())
|
if ( vtNorm.IsSmall())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1967,6 +2058,8 @@ CurveBezier::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d&
|
|||||||
if ( vtNorm.IsSmall() || vtDir.IsSmall())
|
if ( vtNorm.IsSmall() || vtDir.IsSmall())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// imposto ricalcolo Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1999,6 +2092,10 @@ CurveBezier::ToGlob( const Frame3d& frRef)
|
|||||||
if ( IsGlobFrame( frRef))
|
if ( IsGlobFrame( frRef))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
|
// trasformo Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->ToGlob( frRef) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -2026,6 +2123,10 @@ CurveBezier::ToLoc( const Frame3d& frRef)
|
|||||||
if ( IsGlobFrame( frRef))
|
if ( IsGlobFrame( frRef))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
|
// trasformo Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->ToLoc( frRef) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -2053,6 +2154,10 @@ CurveBezier::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
|||||||
if ( AreSameFrame( frOri, frDest))
|
if ( AreSameFrame( frOri, frDest))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
|
// trasformo Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->LocToLoc( frOri, frDest) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -2064,3 +2169,42 @@ CurveBezier::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
|||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
CurveBezier::CalcVoronoiObject() const
|
||||||
|
{
|
||||||
|
if ( m_nStatus != OK)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
// creo oggetto vroni con la curva
|
||||||
|
m_pVoronoiObj = new( std::nothrow) Voronoi( this, false) ;
|
||||||
|
if ( m_pVoronoiObj == nullptr)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Voronoi*
|
||||||
|
CurveBezier::GetVoronoiObject() const
|
||||||
|
{
|
||||||
|
if ( m_nStatus != OK)
|
||||||
|
return nullptr ;
|
||||||
|
|
||||||
|
// se non è stato calcolato, lo calcolo
|
||||||
|
if ( m_pVoronoiObj == nullptr)
|
||||||
|
CalcVoronoiObject() ;
|
||||||
|
|
||||||
|
// restituisco Voronoi
|
||||||
|
return m_pVoronoiObj ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void
|
||||||
|
CurveBezier::ResetVoronoiObject() const
|
||||||
|
{
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
delete m_pVoronoiObj ;
|
||||||
|
m_pVoronoiObj = nullptr ;
|
||||||
|
}
|
||||||
|
|||||||
+21
-6
@@ -19,7 +19,8 @@
|
|||||||
#include "DllMain.h"
|
#include "DllMain.h"
|
||||||
#include "GeoObjRW.h"
|
#include "GeoObjRW.h"
|
||||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
|
||||||
|
class Voronoi ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
class CurveBezier : public ICurveBezier, public IGeoObjRW
|
class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||||
@@ -56,6 +57,11 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
|||||||
m_nTempProp[nPropInd] = nProp ; }
|
m_nTempProp[nPropInd] = nProp ; }
|
||||||
int GetTempProp( int nPropInd = 0) const override
|
int GetTempProp( int nPropInd = 0) const override
|
||||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||||
|
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||||
|
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||||
|
m_dTempParam[nParamInd] = dParam ; }
|
||||||
|
double GetTempParam( int nParamInd = 0) const override
|
||||||
|
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||||
|
|
||||||
public : // ICurve
|
public : // ICurve
|
||||||
bool IsSimple( void) const override { return true ; }
|
bool IsSimple( void) const override { return true ; }
|
||||||
@@ -111,7 +117,7 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
|||||||
ICurve* CopyParamRange( double dUStart, double dUEnd) const override ;
|
ICurve* CopyParamRange( double dUStart, double dUEnd) const override ;
|
||||||
bool Invert( void) override ;
|
bool Invert( void) override ;
|
||||||
bool SimpleOffset( double dDist, int nType = OFF_FILLET) override
|
bool SimpleOffset( double dDist, int nType = OFF_FILLET) override
|
||||||
{ return false ; } // l'offset di crvBezier non è crvBezier tranne in casi molto particolari
|
{ return false ; } // l'offset di crvBezier non è crvBezier tranne in casi molto particolari
|
||||||
bool ModifyStart( const Point3d& ptNewStart) override ;
|
bool ModifyStart( const Point3d& ptNewStart) override ;
|
||||||
bool ModifyEnd( const Point3d& ptNewEnd) override ;
|
bool ModifyEnd( const Point3d& ptNewEnd) override ;
|
||||||
bool SetExtrusion( const Vector3d& vtExtr) override
|
bool SetExtrusion( const Vector3d& vtExtr) override
|
||||||
@@ -132,6 +138,7 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
|||||||
bool SetControlPoint( int nInd, const Point3d& ptCtrl) override ;
|
bool SetControlPoint( int nInd, const Point3d& ptCtrl) override ;
|
||||||
bool SetControlPoint( int nInd, const Point3d& ptCtrl, double dW) override ;
|
bool SetControlPoint( int nInd, const Point3d& ptCtrl, double dW) override ;
|
||||||
bool FromArc( const ICurveArc& crArc) override ;
|
bool FromArc( const ICurveArc& crArc) override ;
|
||||||
|
bool FromLine( const ICurveLine& crLine) override ;
|
||||||
int GetDegree( void) const override
|
int GetDegree( void) const override
|
||||||
{ return m_nDeg ; }
|
{ return m_nDeg ; }
|
||||||
bool IsRational( void) const override
|
bool IsRational( void) const override
|
||||||
@@ -145,11 +152,14 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
|||||||
public : // IGeoObjRW
|
public : // IGeoObjRW
|
||||||
int GetNgeId( void) const override ;
|
int GetNgeId( void) const override ;
|
||||||
bool Save( NgeWriter& ngeOut) const override ;
|
bool Save( NgeWriter& ngeOut) const override ;
|
||||||
|
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
|
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
bool Load( NgeReader& ngeIn) override ;
|
bool Load( NgeReader& ngeIn) override ;
|
||||||
|
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||||
|
|
||||||
public :
|
public :
|
||||||
CurveBezier( void) ;
|
CurveBezier( void) ;
|
||||||
CurveBezier( const CurveBezier& cbSrc)
|
CurveBezier( const CurveBezier& cbSrc) : m_pVoronoiObj( nullptr)
|
||||||
{ if ( ! CopyFrom( cbSrc))
|
{ if ( ! CopyFrom( cbSrc))
|
||||||
LOG_ERROR( GetEGkLogger(), "CurveBezier : copy constructor error")}
|
LOG_ERROR( GetEGkLogger(), "CurveBezier : copy constructor error")}
|
||||||
CurveBezier& operator =( const CurveBezier& cbSrc)
|
CurveBezier& operator =( const CurveBezier& cbSrc)
|
||||||
@@ -158,6 +168,8 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
|||||||
return *this ; }
|
return *this ; }
|
||||||
bool ApproxWithLines( int nStep, PolyLine& PL) const ;
|
bool ApproxWithLines( int nStep, PolyLine& PL) const ;
|
||||||
bool GetApproxLength( double& dLen) const ;
|
bool GetApproxLength( double& dLen) const ;
|
||||||
|
Voronoi* GetVoronoiObject( void) const ;
|
||||||
|
void ResetVoronoiObject( void) const ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool CopyFrom( const CurveBezier& cbSrc) ;
|
bool CopyFrom( const CurveBezier& cbSrc) ;
|
||||||
@@ -175,22 +187,25 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
|||||||
bool BiArcOrSplit(int nLev, PolyLine& PL, double dLinTol, double dAngTolDeg, PolyArc& PA) const;
|
bool BiArcOrSplit(int nLev, PolyLine& PL, double dLinTol, double dAngTolDeg, PolyArc& PA) const;
|
||||||
bool ToPowerBase( PolynomialPoint3d& pol3P) const ;
|
bool ToPowerBase( PolynomialPoint3d& pol3P) const ;
|
||||||
bool ToPowerBase( PolynomialPoint3d& pol3Num, Polynomial& polDen) const ;
|
bool ToPowerBase( PolynomialPoint3d& pol3Num, Polynomial& polDen) const ;
|
||||||
|
bool CalcVoronoiObject( void) const ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
||||||
static const int MAXDEG = 11 ;
|
static const int MAXDEG = 21 ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||||
Status m_nStatus ; // stato
|
Status m_nStatus ; // stato
|
||||||
int m_nDeg ; // grado
|
int m_nDeg ; // grado
|
||||||
bool m_bRat ; // flag di razionale/polinomiale
|
bool m_bRat ; // flag di razionale/polinomiale
|
||||||
mutable double m_dParSing ; // eventuale parametro della singolarità (-1=no, -2=da calcolare)
|
mutable double m_dParSing ; // eventuale parametro della singolarità (-1=no, -2=da calcolare)
|
||||||
PNTVECTOR m_vPtCtrl ; // vettore dei punti di controllo
|
PNTVECTOR m_vPtCtrl ; // vettore dei punti di controllo
|
||||||
DBLVECTOR m_vWeCtrl ; // vettore dei pesi di controllo
|
DBLVECTOR m_vWeCtrl ; // vettore dei pesi di controllo
|
||||||
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
|
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
|
||||||
double m_dThick ; // spessore
|
double m_dThick ; // spessore
|
||||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||||
|
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||||
|
mutable Voronoi* m_pVoronoiObj ; // Voronoi
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
+1
-1
@@ -16,8 +16,8 @@
|
|||||||
#include "CurveComposite.h"
|
#include "CurveComposite.h"
|
||||||
#include "CalcDerivate.h"
|
#include "CalcDerivate.h"
|
||||||
#include "BiArcs.h"
|
#include "BiArcs.h"
|
||||||
#include "DistPointLine.h"
|
|
||||||
#include "RemoveCurveDefects.h"
|
#include "RemoveCurveDefects.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkCurveByApprox.h"
|
#include "/EgtDev/Include/EGkCurveByApprox.h"
|
||||||
#include "/EgtDev/Include/EGkPolyLine.h"
|
#include "/EgtDev/Include/EGkPolyLine.h"
|
||||||
#include "/EgtDev/Include/EGkPolyArc.h"
|
#include "/EgtDev/Include/EGkPolyArc.h"
|
||||||
|
|||||||
+5
-5
@@ -14,10 +14,10 @@
|
|||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "CalcDerivate.h"
|
#include "CalcDerivate.h"
|
||||||
|
#include "CurveBezier.h"
|
||||||
|
#include "CurveComposite.h"
|
||||||
#include "/EgtDev/Include/EGkCurveByInterp.h"
|
#include "/EgtDev/Include/EGkCurveByInterp.h"
|
||||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
|
||||||
#include "/EgtDev/Include/EGkBiArcs.h"
|
#include "/EgtDev/Include/EGkBiArcs.h"
|
||||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ CurveByInterp::GetCurve( int nMethod, int nType)
|
|||||||
// se richiesti biarchi
|
// se richiesti biarchi
|
||||||
if ( nType == BIARCS) {
|
if ( nType == BIARCS) {
|
||||||
// creo la curva composita
|
// creo la curva composita
|
||||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
PtrOwner<CurveComposite> pCrvCompo( CreateBasicCurveComposite()) ;
|
||||||
if ( IsNull( pCrvCompo))
|
if ( IsNull( pCrvCompo))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
// ciclo sugli intervalli
|
// ciclo sugli intervalli
|
||||||
@@ -83,13 +83,13 @@ CurveByInterp::GetCurve( int nMethod, int nType)
|
|||||||
// se richieste curve di Bezier cubiche
|
// se richieste curve di Bezier cubiche
|
||||||
if ( nType == CUBIC_BEZIERS) {
|
if ( nType == CUBIC_BEZIERS) {
|
||||||
// creo la curva composita
|
// creo la curva composita
|
||||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
PtrOwner<CurveComposite> pCrvCompo( CreateBasicCurveComposite()) ;
|
||||||
if ( IsNull( pCrvCompo))
|
if ( IsNull( pCrvCompo))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
// ciclo sugli intervalli
|
// ciclo sugli intervalli
|
||||||
for ( int i = 1 ; i < int( m_vPnt.size()) ; ++ i) {
|
for ( int i = 1 ; i < int( m_vPnt.size()) ; ++ i) {
|
||||||
// creo una curva di Bezier cubica per ogni intervallo
|
// creo una curva di Bezier cubica per ogni intervallo
|
||||||
PtrOwner<ICurveBezier> pCBez( CreateCurveBezier()) ;
|
PtrOwner<CurveBezier> pCBez( CreateBasicCurveBezier()) ;
|
||||||
if ( IsNull( pCBez))
|
if ( IsNull( pCBez))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
pCBez->Init( 3, false) ;
|
pCBez->Init( 3, false) ;
|
||||||
|
|||||||
+373
-149
File diff suppressed because it is too large
Load Diff
+32
-7
@@ -21,6 +21,8 @@
|
|||||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
|
class Voronoi ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
class CurveComposite : public ICurveComposite, public IGeoObjRW
|
class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||||
{
|
{
|
||||||
@@ -56,6 +58,11 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
|||||||
m_nTempProp[nPropInd] = nProp ; }
|
m_nTempProp[nPropInd] = nProp ; }
|
||||||
int GetTempProp( int nPropInd = 0) const override
|
int GetTempProp( int nPropInd = 0) const override
|
||||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||||
|
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||||
|
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||||
|
m_dTempParam[nParamInd] = dParam ; }
|
||||||
|
double GetTempParam( int nParamInd = 0) const override
|
||||||
|
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||||
|
|
||||||
public : // ICurve
|
public : // ICurve
|
||||||
bool IsSimple( void) const override
|
bool IsSimple( void) const override
|
||||||
@@ -143,7 +150,7 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
|||||||
bool IsParamAtJoint( double dU) const override ;
|
bool IsParamAtJoint( double dU) const override ;
|
||||||
ICurve* RemoveFirstOrLastCurve( bool bLast = true) override ;
|
ICurve* RemoveFirstOrLastCurve( bool bLast = true) override ;
|
||||||
bool ChangeStartPoint( double dU) override ;
|
bool ChangeStartPoint( double dU) override ;
|
||||||
bool AddPoint( const Point3d& ptStart) override ;
|
bool AddPoint( const Point3d& ptStart) override ; // funzione per aggiungere il ptStart prima di usare la funzione AddLine
|
||||||
bool AddLine( const Point3d& ptNew, bool bEndOrStart = true) override ;
|
bool AddLine( const Point3d& ptNew, bool bEndOrStart = true) override ;
|
||||||
bool AddLineTg( double dLen, bool bEndOrStart = true) override ;
|
bool AddLineTg( double dLen, bool bEndOrStart = true) override ;
|
||||||
bool AddArc2P( const Point3d& ptOther, const Point3d& ptNew, bool bEndOrStart = true) override ;
|
bool AddArc2P( const Point3d& ptOther, const Point3d& ptNew, bool bEndOrStart = true) override ;
|
||||||
@@ -158,6 +165,7 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
|||||||
bool ArcsBezierCurvesToArcsPerpExtr( double dLinTol, double dAngTolDeg) override ;
|
bool ArcsBezierCurvesToArcsPerpExtr( double dLinTol, double dAngTolDeg) override ;
|
||||||
bool StraightArcsToLines( double dLinTol, double dAngTolDeg) override ;
|
bool StraightArcsToLines( double dLinTol, double dAngTolDeg) override ;
|
||||||
bool MergeCurves( double dLinTol, double dAngTolDeg, bool bStartEnd = true, bool bNeedSameProp = false) override ;
|
bool MergeCurves( double dLinTol, double dAngTolDeg, bool bStartEnd = true, bool bNeedSameProp = false) override ;
|
||||||
|
bool RemoveSmallParts( double dLinTol, double dAngTolDeg) override ;
|
||||||
bool RemoveSmallDefects( double dLinTol, double dAngTolDeg, bool bAlsoSpikes = false) override ;
|
bool RemoveSmallDefects( double dLinTol, double dAngTolDeg, bool bAlsoSpikes = false) override ;
|
||||||
bool RemoveUndercutOnY( double dLinTol, double dAngTolDeg) override ;
|
bool RemoveUndercutOnY( double dLinTol, double dAngTolDeg) override ;
|
||||||
bool IsAPoint( void) const override ;
|
bool IsAPoint( void) const override ;
|
||||||
@@ -165,17 +173,24 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
|||||||
bool IsACircle( double dLinTol, Point3d& ptCen, Vector3d& vtN, double& dRad, bool& bCCW) const override ;
|
bool IsACircle( double dLinTol, Point3d& ptCen, Vector3d& vtN, double& dRad, bool& bCCW) const override ;
|
||||||
bool IsARectangle( double dLinTol, Point3d& ptP, Vector3d& vtL1, Vector3d& vtL2) const override ;
|
bool IsARectangle( double dLinTol, Point3d& ptP, Vector3d& vtL1, Vector3d& vtL2) const override ;
|
||||||
bool IsATrapezoid( double dLinTol, Point3d& ptP, Vector3d& vtB1, Vector3d& vtL1, Vector3d& vtB2) const override ;
|
bool IsATrapezoid( double dLinTol, Point3d& ptP, Vector3d& vtB1, Vector3d& vtL1, Vector3d& vtB2) const override ;
|
||||||
bool SetCurveTempProp( int nCrv, int nProp, int nPropNum = 0) override ;
|
bool SetCurveTempProp( int nCrv, int nProp, int nPropInd = 0) override ;
|
||||||
bool GetCurveTempProp( int nCrv, int& nProp, int nPropNum = 0) const override ;
|
bool GetCurveTempProp( int nCrv, int& nProp, int nPropInd = 0) const override ;
|
||||||
|
bool SetCurveTempParam( int nCrv, double dParam, int nParamInd = 0) override ;
|
||||||
|
bool GetCurveTempParam( int nCrv, double& dParam, int nParamInd = 0) const override ;
|
||||||
|
bool FromPoint( Point3d& ptStart) override ; // funzione per settare la curva ad un unico punto
|
||||||
|
bool GetOnlyPoint( Point3d& ptStart) const override ; // funzione per recuperare l'unico punto da cui è composta la curva ( degenere)
|
||||||
|
|
||||||
public : // IGeoObjRW
|
public : // IGeoObjRW
|
||||||
int GetNgeId( void) const override ;
|
int GetNgeId( void) const override ;
|
||||||
bool Save( NgeWriter& ngeOut) const override ;
|
bool Save( NgeWriter& ngeOut) const override ;
|
||||||
|
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
|
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
bool Load( NgeReader& ngeIn) override ;
|
bool Load( NgeReader& ngeIn) override ;
|
||||||
|
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||||
|
|
||||||
public :
|
public :
|
||||||
CurveComposite( void) ;
|
CurveComposite( void) ;
|
||||||
CurveComposite( const CurveComposite& ccSrc)
|
CurveComposite( const CurveComposite& ccSrc) : m_pVoronoiObj( nullptr)
|
||||||
{ if ( ! CopyFrom( ccSrc))
|
{ if ( ! CopyFrom( ccSrc))
|
||||||
LOG_ERROR( GetEGkLogger(), "CurveComposite : copy constructor error") }
|
LOG_ERROR( GetEGkLogger(), "CurveComposite : copy constructor error") }
|
||||||
CurveComposite& operator =( const CurveComposite& ccSrc)
|
CurveComposite& operator =( const CurveComposite& ccSrc)
|
||||||
@@ -184,22 +199,25 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
|||||||
return *this ; }
|
return *this ; }
|
||||||
bool RelocateFrom( CurveComposite& ccSrc) ;
|
bool RelocateFrom( CurveComposite& ccSrc) ;
|
||||||
bool GetApproxLength( double& dLen) const ;
|
bool GetApproxLength( double& dLen) const ;
|
||||||
|
Voronoi* GetVoronoiObject( void) const ;
|
||||||
|
void ResetVoronoiObject( void) const ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool CopyFrom( const CurveComposite& ccSrc) ;
|
bool CopyFrom( const CurveComposite& ccSrc) ;
|
||||||
bool Validate( void) ;
|
bool Validate( void) ;
|
||||||
|
bool TestClosure( void) ;
|
||||||
bool AddCurveByRelocate( CurveComposite& ccSrc, bool bEndOrStart = true, double dLinTol = EPS_SMALL) ;
|
bool AddCurveByRelocate( CurveComposite& ccSrc, bool bEndOrStart = true, double dLinTol = EPS_SMALL) ;
|
||||||
bool AddSimpleCurve( ICurve* pSmplCrv, bool bEndOrStart = true, double dLinTol = EPS_SMALL) ;
|
bool AddSimpleCurve( ICurve* pSmplCrv, bool bEndOrStart = true, double dLinTol = EPS_SMALL) ;
|
||||||
bool GetIndSCurveAndLocPar( double dU, Side nS, int& nSCrv, double& dLocU) const ;
|
bool GetIndSCurveAndLocPar( double dU, Side nS, int& nSCrv, double& dLocU) const ;
|
||||||
bool SimpleOffsetXY( double dDist, int nType = OFF_FILLET) ;
|
bool SimpleOffsetXY( double dDist, int nType = OFF_FILLET) ;
|
||||||
bool IsOneCircle( Point3d& ptCen, Vector3d& vtN, double& dRad, bool& bCCW) const ;
|
bool IsOneCircle( Point3d& ptCen, Vector3d& vtN, double& dRad, bool& bCCW) const ;
|
||||||
|
bool CalcVoronoiObject( void) const ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2, IS_A_POINT = 3} ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
typedef std::deque<ICurve*> PCRVSMPL_DEQUE ;
|
typedef std::deque<ICurve*> PCRVSMPL_DEQUE ;
|
||||||
typedef PCRVSMPL_DEQUE::iterator PCSD_ITER ;
|
|
||||||
typedef PCRVSMPL_DEQUE::const_iterator PCSD_CONST_ITER ;
|
typedef PCRVSMPL_DEQUE::const_iterator PCSD_CONST_ITER ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
@@ -209,7 +227,9 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
|||||||
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
|
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
|
||||||
double m_dThick ; // spessore
|
double m_dThick ; // spessore
|
||||||
Point3d m_ptStart ; // punto iniziale per composita vuota per Add di linee o archi
|
Point3d m_ptStart ; // punto iniziale per composita vuota per Add di linee o archi
|
||||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||||
|
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||||
|
mutable Voronoi* m_pVoronoiObj ; // Voronoi
|
||||||
mutable PCSD_CONST_ITER m_Iter ; // iteratore
|
mutable PCSD_CONST_ITER m_Iter ; // iteratore
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -250,6 +270,11 @@ inline CurveComposite* ConvertCurveToBasicComposite( IGeoObj* pGObj)
|
|||||||
if ( nProp != 0)
|
if ( nProp != 0)
|
||||||
pCrvCo->SetTempProp( nProp, i) ;
|
pCrvCo->SetTempProp( nProp, i) ;
|
||||||
}
|
}
|
||||||
|
for ( int i = 0 ; i < 2 ; ++ i) {
|
||||||
|
double dParam = pCrv->GetTempParam( i) ;
|
||||||
|
if ( abs( dParam) > EPS_SMALL)
|
||||||
|
pCrvCo->SetTempParam( dParam, i) ;
|
||||||
|
}
|
||||||
pCrvCo->AddCurve( pCrv) ;
|
pCrvCo->AddCurve( pCrv) ;
|
||||||
return pCrvCo ;
|
return pCrvCo ;
|
||||||
}
|
}
|
||||||
|
|||||||
+110
-20
@@ -14,10 +14,11 @@
|
|||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "CurveLine.h"
|
#include "CurveLine.h"
|
||||||
#include "DistPointLine.h"
|
|
||||||
#include "GeoObjFactory.h"
|
#include "GeoObjFactory.h"
|
||||||
#include "NgeWriter.h"
|
#include "NgeWriter.h"
|
||||||
#include "NgeReader.h"
|
#include "NgeReader.h"
|
||||||
|
#include "Voronoi.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
@@ -30,15 +31,15 @@ GEOOBJ_REGISTER( CRV_LINE, NGE_C_LIN, CurveLine) ;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
CurveLine::CurveLine( void)
|
CurveLine::CurveLine( void)
|
||||||
: m_nStatus( TO_VERIFY), m_PtStart(), m_PtEnd(), m_VtExtr(), m_dThick()
|
: m_nStatus( TO_VERIFY), m_PtStart(), m_PtEnd(), m_VtExtr(), m_dThick(),
|
||||||
|
m_nTempProp{0,0}, m_dTempParam{0.0,0.0}, m_pVoronoiObj( nullptr)
|
||||||
{
|
{
|
||||||
m_nTempProp[0] = 0 ;
|
|
||||||
m_nTempProp[1] = 0 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
CurveLine::~CurveLine( void)
|
CurveLine::~CurveLine( void)
|
||||||
{
|
{
|
||||||
|
ResetVoronoiObject() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -50,6 +51,8 @@ CurveLine::Set( const Point3d& ptStart, const Point3d& ptEnd)
|
|||||||
m_PtEnd = ptEnd ;
|
m_PtEnd = ptEnd ;
|
||||||
m_nStatus = TO_VERIFY ;
|
m_nStatus = TO_VERIFY ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -69,6 +72,8 @@ CurveLine::SetPVL( const Point3d& ptStart, const Vector3d& vtDir, double dLen)
|
|||||||
m_PtEnd = ptStart + vtDelta ;
|
m_PtEnd = ptStart + vtDelta ;
|
||||||
m_nStatus = TO_VERIFY ;
|
m_nStatus = TO_VERIFY ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -86,6 +91,8 @@ CurveLine::SetPDL( const Point3d& ptStart, double dDirAngDeg, double dLen)
|
|||||||
m_PtEnd = ptStart + vtDelta ;
|
m_PtEnd = ptStart + vtDelta ;
|
||||||
m_nStatus = TO_VERIFY ;
|
m_nStatus = TO_VERIFY ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -128,6 +135,8 @@ CurveLine::CopyFrom( const CurveLine& clSrc)
|
|||||||
m_dThick = clSrc.m_dThick ;
|
m_dThick = clSrc.m_dThick ;
|
||||||
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
|
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
|
||||||
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
|
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
|
||||||
|
m_dTempParam[0] = clSrc.m_dTempParam[0] ;
|
||||||
|
m_dTempParam[1] = clSrc.m_dTempParam[1] ;
|
||||||
return Set( clSrc.m_PtStart, clSrc.m_PtEnd) ;
|
return Set( clSrc.m_PtStart, clSrc.m_PtEnd) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +162,7 @@ CurveLine::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
|||||||
// dati generali di una curva
|
// dati generali di una curva
|
||||||
if ( ! CurveDump( *this, sOut, bMM, szNewLine))
|
if ( ! CurveDump( *this, sOut, bMM, szNewLine))
|
||||||
return false ;
|
return false ;
|
||||||
// parametri : sono già compresi nei dati generali (PS e PE)
|
// parametri : sono già compresi nei dati generali (PS e PE)
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -214,7 +223,7 @@ CurveLine::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
|
|||||||
return false ;
|
return false ;
|
||||||
// assegno il box in locale
|
// assegno il box in locale
|
||||||
b3Loc.Set( m_PtStart, m_PtEnd) ;
|
b3Loc.Set( m_PtStart, m_PtEnd) ;
|
||||||
// se c'è estrusione, devo tenerne conto
|
// se c'è estrusione, devo tenerne conto
|
||||||
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
|
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
|
||||||
Point3d ptMinExtr = b3Loc.GetMin() + m_VtExtr * m_dThick ;
|
Point3d ptMinExtr = b3Loc.GetMin() + m_VtExtr * m_dThick ;
|
||||||
Point3d ptMaxExtr = b3Loc.GetMax() + m_VtExtr * m_dThick ;
|
Point3d ptMaxExtr = b3Loc.GetMax() + m_VtExtr * m_dThick ;
|
||||||
@@ -232,7 +241,7 @@ CurveLine::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
|||||||
// verifico lo stato
|
// verifico lo stato
|
||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico validità del frame
|
// verifico validità del frame
|
||||||
if ( frRef.GetType() == Frame3d::ERR)
|
if ( frRef.GetType() == Frame3d::ERR)
|
||||||
return false ;
|
return false ;
|
||||||
// porto gli estremi nel riferimento passato
|
// porto gli estremi nel riferimento passato
|
||||||
@@ -242,7 +251,7 @@ CurveLine::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
|||||||
ptFrEnd.ToGlob( frRef) ;
|
ptFrEnd.ToGlob( frRef) ;
|
||||||
// assegno il box nel riferimento
|
// assegno il box nel riferimento
|
||||||
b3Ref.Set( ptFrStart, ptFrEnd) ;
|
b3Ref.Set( ptFrStart, ptFrEnd) ;
|
||||||
// se c'è estrusione, devo tenerne conto
|
// se c'è estrusione, devo tenerne conto
|
||||||
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
|
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
|
||||||
Vector3d vtFrExtr = m_VtExtr ;
|
Vector3d vtFrExtr = m_VtExtr ;
|
||||||
vtFrExtr.ToGlob( frRef) ;
|
vtFrExtr.ToGlob( frRef) ;
|
||||||
@@ -381,7 +390,7 @@ CurveLine::GetLength( double& dLen) const
|
|||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// la lunghezza è la distanza tra gli estremi
|
// la lunghezza è la distanza tra gli estremi
|
||||||
dLen = Dist( m_PtStart, m_PtEnd) ;
|
dLen = Dist( m_PtStart, m_PtEnd) ;
|
||||||
|
|
||||||
return ( dLen > EPS_SMALL) ;
|
return ( dLen > EPS_SMALL) ;
|
||||||
@@ -407,7 +416,7 @@ CurveLine::GetLengthAtParam( double dU, double& dLen) const
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// la lunghezza totale è la distanza tra gli estremi
|
// la lunghezza totale è la distanza tra gli estremi
|
||||||
double dTotLen = Dist( m_PtStart, m_PtEnd) ;
|
double dTotLen = Dist( m_PtStart, m_PtEnd) ;
|
||||||
|
|
||||||
// fine
|
// fine
|
||||||
@@ -439,7 +448,7 @@ CurveLine::GetParamAtLength( double dLen, double& dU) const
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// la lunghezza totale è la distanza tra gli estremi
|
// la lunghezza totale è la distanza tra gli estremi
|
||||||
double dTotLen = Dist( m_PtStart, m_PtEnd) ;
|
double dTotLen = Dist( m_PtStart, m_PtEnd) ;
|
||||||
|
|
||||||
// se dopo fine, errore
|
// se dopo fine, errore
|
||||||
@@ -558,6 +567,8 @@ CurveLine::Invert( void)
|
|||||||
// inverto i punti estremi
|
// inverto i punti estremi
|
||||||
swap( m_PtStart, m_PtEnd) ;
|
swap( m_PtStart, m_PtEnd) ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -589,6 +600,8 @@ CurveLine::SimpleOffset( double dDist, int nType)
|
|||||||
m_PtStart += vtDir * dDist ;
|
m_PtStart += vtDir * dDist ;
|
||||||
m_PtEnd += vtDir * dDist ;
|
m_PtEnd += vtDir * dDist ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -609,6 +622,8 @@ CurveLine::ModifyStart( const Point3d& ptNewStart)
|
|||||||
// assegno il nuovo inizio
|
// assegno il nuovo inizio
|
||||||
m_PtStart = ptNewStart ;
|
m_PtStart = ptNewStart ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -629,6 +644,8 @@ CurveLine::ModifyEnd( const Point3d& ptNewEnd)
|
|||||||
// assegno la nuova fine
|
// assegno la nuova fine
|
||||||
m_PtEnd = ptNewEnd ;
|
m_PtEnd = ptNewEnd ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -704,6 +721,8 @@ CurveLine::TrimStartAtLen( double dLenTrim)
|
|||||||
if ( dLenTrim > EPS_ZERO)
|
if ( dLenTrim > EPS_ZERO)
|
||||||
m_PtStart = Media( m_PtStart, m_PtEnd, ( dLenTrim / dLen)) ;
|
m_PtStart = Media( m_PtStart, m_PtEnd, ( dLenTrim / dLen)) ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -728,6 +747,8 @@ CurveLine::TrimEndAtLen( double dLenTrim)
|
|||||||
if ( ( dLen - dLenTrim) > EPS_ZERO)
|
if ( ( dLen - dLenTrim) > EPS_ZERO)
|
||||||
m_PtEnd = Media( m_PtStart, m_PtEnd, ( dLenTrim / dLen)) ;
|
m_PtEnd = Media( m_PtStart, m_PtEnd, ( dLenTrim / dLen)) ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -750,6 +771,8 @@ CurveLine::ExtendStartByLen( double dLenExt)
|
|||||||
// sposto il punto iniziale
|
// sposto il punto iniziale
|
||||||
m_PtStart -= vtDir * dLenExt ;
|
m_PtStart -= vtDir * dLenExt ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -772,6 +795,8 @@ CurveLine::ExtendEndByLen( double dLenExt)
|
|||||||
// sposto il punto finale
|
// sposto il punto finale
|
||||||
m_PtEnd += vtDir * dLenExt ;
|
m_PtEnd += vtDir * dLenExt ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -786,6 +811,10 @@ CurveLine::Translate( const Vector3d& vtMove)
|
|||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// traslo Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->Translate( vtMove) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -803,10 +832,14 @@ CurveLine::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, do
|
|||||||
// la curva deve essere validata
|
// la curva deve essere validata
|
||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico validità dell'asse di rotazione
|
// verifico validità dell'asse di rotazione
|
||||||
if ( vtAx.IsSmall())
|
if ( vtAx.IsSmall())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// ruoto Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -838,6 +871,8 @@ CurveLine::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double d
|
|||||||
if ( AreSamePointApprox( ptNewStart, ptNewEnd))
|
if ( AreSamePointApprox( ptNewStart, ptNewEnd))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -863,10 +898,12 @@ CurveLine::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
|||||||
// la curva deve essere validata
|
// la curva deve essere validata
|
||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico validità del piano di specchiatura
|
// verifico validità del piano di specchiatura
|
||||||
if ( vtNorm.IsSmall())
|
if ( vtNorm.IsSmall())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -886,10 +923,12 @@ CurveLine::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& v
|
|||||||
// la curva deve essere validata
|
// la curva deve essere validata
|
||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico validità dei parametri
|
// verifico validità dei parametri
|
||||||
if ( vtNorm.IsSmall() || vtDir.IsSmall())
|
if ( vtNorm.IsSmall() || vtDir.IsSmall())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// imposto ricalcolo di Voronoi
|
||||||
|
ResetVoronoiObject() ;
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -914,14 +953,18 @@ CurveLine::ToGlob( const Frame3d& frRef)
|
|||||||
// la curva deve essere validata
|
// la curva deve essere validata
|
||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico validità del frame
|
// verifico validità del frame
|
||||||
if ( frRef.GetType() == Frame3d::ERR)
|
if ( frRef.GetType() == Frame3d::ERR)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// se frame identità, non devo fare alcunché
|
// se frame identità, non devo fare alcunché
|
||||||
if ( IsGlobFrame( frRef))
|
if ( IsGlobFrame( frRef))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
|
// trasformo Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->ToGlob( frRef) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -936,14 +979,18 @@ CurveLine::ToLoc( const Frame3d& frRef)
|
|||||||
// la curva deve essere validata
|
// la curva deve essere validata
|
||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico validità del frame
|
// verifico validità del frame
|
||||||
if ( frRef.GetType() == Frame3d::ERR)
|
if ( frRef.GetType() == Frame3d::ERR)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// se frame identità, non devo fare alcunché
|
// se frame identità, non devo fare alcunché
|
||||||
if ( IsGlobFrame( frRef))
|
if ( IsGlobFrame( frRef))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
|
// trasformo Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->ToLoc( frRef) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -958,14 +1005,18 @@ CurveLine::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
|||||||
// la curva deve essere validata
|
// la curva deve essere validata
|
||||||
if ( m_nStatus != OK)
|
if ( m_nStatus != OK)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico validità dei frame
|
// verifico validità dei frame
|
||||||
if ( frOri.GetType() == Frame3d::ERR || frDest.GetType() == Frame3d::ERR)
|
if ( frOri.GetType() == Frame3d::ERR || frDest.GetType() == Frame3d::ERR)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// se i due riferimenti coincidono, non devo fare alcunché
|
// se i due riferimenti coincidono, non devo fare alcunché
|
||||||
if ( AreSameFrame( frOri, frDest))
|
if ( AreSameFrame( frOri, frDest))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
|
// trasformo Voronoi
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
m_pVoronoiObj->LocToLoc( frOri, frDest) ;
|
||||||
|
|
||||||
// imposto ricalcolo della grafica
|
// imposto ricalcolo della grafica
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
@@ -1001,3 +1052,42 @@ CurveLine::CalcPointParamPosiz( const Point3d& ptP, bool bOnXY, double& dU, int&
|
|||||||
nPos = ICurve::PP_MID ; // nell'interno
|
nPos = ICurve::PP_MID ; // nell'interno
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
CurveLine::CalcVoronoiObject() const
|
||||||
|
{
|
||||||
|
if ( m_nStatus != OK)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
// creo oggetto vroni con la curva
|
||||||
|
m_pVoronoiObj = new( std::nothrow) Voronoi( this, false) ;
|
||||||
|
if ( m_pVoronoiObj == nullptr)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Voronoi*
|
||||||
|
CurveLine::GetVoronoiObject() const
|
||||||
|
{
|
||||||
|
if ( m_nStatus != OK)
|
||||||
|
return nullptr ;
|
||||||
|
|
||||||
|
// se non è stato calcolato, lo calcolo
|
||||||
|
if ( m_pVoronoiObj == nullptr)
|
||||||
|
CalcVoronoiObject() ;
|
||||||
|
|
||||||
|
// restituisco Voronoi
|
||||||
|
return m_pVoronoiObj ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void
|
||||||
|
CurveLine::ResetVoronoiObject() const
|
||||||
|
{
|
||||||
|
if ( m_pVoronoiObj != nullptr)
|
||||||
|
delete m_pVoronoiObj ;
|
||||||
|
m_pVoronoiObj = nullptr ;
|
||||||
|
}
|
||||||
|
|||||||
+17
-2
@@ -19,6 +19,8 @@
|
|||||||
#include "GeoObjRW.h"
|
#include "GeoObjRW.h"
|
||||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||||
|
|
||||||
|
class Voronoi ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
class CurveLine : public ICurveLine, public IGeoObjRW
|
class CurveLine : public ICurveLine, public IGeoObjRW
|
||||||
{
|
{
|
||||||
@@ -54,6 +56,11 @@ class CurveLine : public ICurveLine, public IGeoObjRW
|
|||||||
m_nTempProp[nPropInd] = nProp ; }
|
m_nTempProp[nPropInd] = nProp ; }
|
||||||
int GetTempProp( int nPropInd = 0) const override
|
int GetTempProp( int nPropInd = 0) const override
|
||||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||||
|
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||||
|
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||||
|
m_dTempParam[nParamInd] = dParam ; }
|
||||||
|
double GetTempParam( int nParamInd = 0) const override
|
||||||
|
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||||
|
|
||||||
public : // ICurve
|
public : // ICurve
|
||||||
bool IsSimple( void) const override
|
bool IsSimple( void) const override
|
||||||
@@ -139,21 +146,27 @@ class CurveLine : public ICurveLine, public IGeoObjRW
|
|||||||
public : // IGeoObjRW
|
public : // IGeoObjRW
|
||||||
int GetNgeId( void) const override ;
|
int GetNgeId( void) const override ;
|
||||||
bool Save( NgeWriter& ngeOut) const override ;
|
bool Save( NgeWriter& ngeOut) const override ;
|
||||||
|
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
|
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
bool Load( NgeReader& ngeIn) override ;
|
bool Load( NgeReader& ngeIn) override ;
|
||||||
|
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||||
|
|
||||||
public :
|
public :
|
||||||
CurveLine( void) ;
|
CurveLine( void) ;
|
||||||
CurveLine( const CurveLine& clSrc)
|
CurveLine( const CurveLine& clSrc) : m_pVoronoiObj( nullptr)
|
||||||
{ if ( ! CopyFrom( clSrc))
|
{ if ( ! CopyFrom( clSrc))
|
||||||
LOG_ERROR( GetEGkLogger(), "CurveLine : copy constructor error") }
|
LOG_ERROR( GetEGkLogger(), "CurveLine : copy constructor error") }
|
||||||
CurveLine& operator =( const CurveLine& clSrc)
|
CurveLine& operator =( const CurveLine& clSrc)
|
||||||
{ if ( ! CopyFrom( clSrc))
|
{ if ( ! CopyFrom( clSrc))
|
||||||
LOG_ERROR( GetEGkLogger(), "CurveLine : copy error")
|
LOG_ERROR( GetEGkLogger(), "CurveLine : copy error")
|
||||||
return *this ; }
|
return *this ; }
|
||||||
|
Voronoi* GetVoronoiObject( void) const ;
|
||||||
|
void ResetVoronoiObject( void) const ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool CopyFrom( const CurveLine& clSrc) ;
|
bool CopyFrom( const CurveLine& clSrc) ;
|
||||||
bool Validate( void) ;
|
bool Validate( void) ;
|
||||||
|
bool CalcVoronoiObject( void) const ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
||||||
@@ -165,7 +178,9 @@ class CurveLine : public ICurveLine, public IGeoObjRW
|
|||||||
Point3d m_PtEnd ; // punto finale
|
Point3d m_PtEnd ; // punto finale
|
||||||
Vector3d m_VtExtr ; // vettore estrusione
|
Vector3d m_VtExtr ; // vettore estrusione
|
||||||
double m_dThick ; // spessore
|
double m_dThick ; // spessore
|
||||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||||
|
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||||
|
mutable Voronoi* m_pVoronoiObj ; // Voronoi
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
+7
-8
@@ -1,7 +1,7 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2020-2022
|
// EgalTech 2020-2024
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : DistLineLine.h Data : 12.08.22 Versione : 2.4h1
|
// File : DistLineLine.cpp Data : 10.05.24 Versione : 2.6e3
|
||||||
// Contenuto : Implementazione della classe distanza fra elementi lineari.
|
// Contenuto : Implementazione della classe distanza fra elementi lineari.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -12,11 +12,10 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "DistLineLine.h"
|
#include "/EgtDev/Include/EGkDistLineLine.h"
|
||||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||||
#include "/EgtDev/Include/EGkGeoCollection.h"
|
#include "/EgtDev/Include/EGkGeoCollection.h"
|
||||||
#include "/EgtDev/Include/EGkGeoConst.h"
|
#include "/EgtDev/Include/EGkGeoConst.h"
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
@@ -59,7 +58,7 @@ DistLineLine::DistLineLine( const Point3d& ptSt1, const Vector3d& vtD1, double d
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistLineLine::GetSqDist( double& dSqDist)
|
DistLineLine::GetSqDist( double& dSqDist) const
|
||||||
{
|
{
|
||||||
if ( m_dSqDist < 0)
|
if ( m_dSqDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -70,7 +69,7 @@ DistLineLine::GetSqDist( double& dSqDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistLineLine::GetDist( double& dDist)
|
DistLineLine::GetDist( double& dDist) const
|
||||||
{
|
{
|
||||||
if ( m_dSqDist < 0)
|
if ( m_dSqDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -83,7 +82,7 @@ DistLineLine::GetDist( double& dDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistLineLine::GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2)
|
DistLineLine::GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2) const
|
||||||
{
|
{
|
||||||
if ( m_dSqDist < 0)
|
if ( m_dSqDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -94,7 +93,7 @@ DistLineLine::GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistLineLine::GetPositionsAtMinDistPoints( double& dPos1, double& dPos2)
|
DistLineLine::GetPositionsAtMinDistPoints( double& dPos1, double& dPos2) const
|
||||||
{
|
{
|
||||||
if ( m_dSqDist < 0)
|
if ( m_dSqDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// EgalTech 2020-2020
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// File : DistLineLine.h Data : 06.11.20 Versione : 2.2k1
|
|
||||||
// Contenuto : Dichiarazione della classe distanza fra elementi lineari.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Modifiche : 06.11.20 LM Creazione modulo.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "/EgtDev/Include/EGkVector3d.h"
|
|
||||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
class DistLineLine
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
DistLineLine( const Point3d& ptSt1, const Point3d& ptEn1,
|
|
||||||
const Point3d& ptSt2, const Point3d& ptEn2,
|
|
||||||
bool bIsSegment1 = true, bool bIsSegment2 = true) ;
|
|
||||||
DistLineLine( const Point3d& ptSt1, const Vector3d& vtD1, double dLen1,
|
|
||||||
const Point3d& ptSt2, const Vector3d& vtD2, double dLen2,
|
|
||||||
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) ;
|
|
||||||
|
|
||||||
private :
|
|
||||||
void Calculate( const Point3d& ptSt1, const Vector3d& vtD1, double dLen1,
|
|
||||||
const Point3d& ptSt2, const Vector3d& vtD2, double dLen2,
|
|
||||||
bool bIsSegment1, bool bIsSegment2) ;
|
|
||||||
private:
|
|
||||||
double m_dSqDist ;
|
|
||||||
double m_dDist ;
|
|
||||||
double m_dPos1 ;
|
|
||||||
double m_dPos2 ;
|
|
||||||
Point3d m_ptMinDist1 ;
|
|
||||||
Point3d m_ptMinDist2 ;
|
|
||||||
} ;
|
|
||||||
+5
-6
@@ -122,14 +122,13 @@ DistPointArc::DistPointHelix( const Point3d& ptP, const ICurveArc& arArc)
|
|||||||
|
|
||||||
// cerco la minima distanza per la polilinea
|
// cerco la minima distanza per la polilinea
|
||||||
MDCVECTOR vApproxMin ;
|
MDCVECTOR vApproxMin ;
|
||||||
MDCVECTOR::iterator Iter ;
|
|
||||||
if ( ! CalcMinDistPointPolyLine( ptP, PL, dLinTol, vApproxMin))
|
if ( ! CalcMinDistPointPolyLine( ptP, PL, dLinTol, vApproxMin))
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
// raffino i punti trovati
|
// raffino i punti trovati
|
||||||
double dPolishedPar ;
|
double dPolishedPar ;
|
||||||
Point3d ptPolishedQ ;
|
Point3d ptPolishedQ ;
|
||||||
for ( Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
for ( auto Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||||
// eseguo raffinamento
|
// eseguo raffinamento
|
||||||
if ( PolishMinDistPointCurve( ptP, arArc, *Iter, dPolishedPar, ptPolishedQ)) {
|
if ( PolishMinDistPointCurve( ptP, arArc, *Iter, dPolishedPar, ptPolishedQ)) {
|
||||||
(*Iter).dDist = Dist( ptP, ptPolishedQ) ;
|
(*Iter).dDist = Dist( ptP, ptPolishedQ) ;
|
||||||
@@ -148,7 +147,7 @@ DistPointArc::DistPointHelix( const Point3d& ptP, const ICurveArc& arArc)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointArc::GetSqDist( double& dSqDist)
|
DistPointArc::GetSqDist( double& dSqDist) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -159,7 +158,7 @@ DistPointArc::GetSqDist( double& dSqDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointArc::GetDist( double& dDist)
|
DistPointArc::GetDist( double& dDist) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -170,7 +169,7 @@ DistPointArc::GetDist( double& dDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointArc::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
DistPointArc::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -185,7 +184,7 @@ DistPointArc::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointArc::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
DistPointArc::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
|
|||||||
+9
-8
@@ -27,17 +27,18 @@ class DistPointArc
|
|||||||
DistPointArc( const Point3d& ptP, const ICurveArc& arArc) ;
|
DistPointArc( const Point3d& ptP, const ICurveArc& arArc) ;
|
||||||
|
|
||||||
public :
|
public :
|
||||||
bool GetSqDist( double& dSqDist) ;
|
bool GetSqDist( double& dSqDist) const ;
|
||||||
bool GetDist( double& dDist) ;
|
bool GetDist( double& dDist) const ;
|
||||||
bool IsEpsilon( double dTol)
|
bool IsEpsilon( double dTol) const
|
||||||
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
||||||
bool IsSmall( void)
|
bool IsSmall( void) const
|
||||||
{ return IsEpsilon( EPS_SMALL) ; }
|
{ return IsEpsilon( EPS_SMALL) ; }
|
||||||
bool IsZero( void)
|
bool IsZero( void) const
|
||||||
{ return IsEpsilon( EPS_ZERO) ; }
|
{ return IsEpsilon( EPS_ZERO) ; }
|
||||||
int GetNbrMinDist( void) { return (int) m_Info.size() ; }
|
int GetNbrMinDist( void) const
|
||||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) ;
|
{ return (int) m_Info.size() ; }
|
||||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) ;
|
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const ;
|
||||||
|
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
DistPointArc( void) ;
|
DistPointArc( void) ;
|
||||||
|
|||||||
+3
-6
@@ -14,9 +14,9 @@
|
|||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "DllMain.h"
|
#include "DllMain.h"
|
||||||
#include "DistPointCrvAux.h"
|
|
||||||
#include "DistPointLine.h"
|
|
||||||
#include "GeoConst.h"
|
#include "GeoConst.h"
|
||||||
|
#include "DistPointCrvAux.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -156,13 +156,10 @@ bool
|
|||||||
FilterMinDistPointCurve( const Point3d& ptP, const ICurve& cCurve,
|
FilterMinDistPointCurve( const Point3d& ptP, const ICurve& cCurve,
|
||||||
const MDCVECTOR& vApproxMin, double& dMinDist, MDPCIVECTOR& Info)
|
const MDCVECTOR& vApproxMin, double& dMinDist, MDPCIVECTOR& Info)
|
||||||
{
|
{
|
||||||
MDCVECTOR::const_iterator Iter ;
|
|
||||||
|
|
||||||
|
|
||||||
// determino i minimi raffinati da tenere
|
// determino i minimi raffinati da tenere
|
||||||
bool bFound = false ;
|
bool bFound = false ;
|
||||||
bool bLastOnEnd = false ; // flag per ultimo punto su fine del suo intervallo
|
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
|
// altro punto con la stessa minima distanza
|
||||||
if ( bFound && abs( (*Iter).dDist - dMinDist) < EPS_SMALL) {
|
if ( bFound && abs( (*Iter).dDist - dMinDist) < EPS_SMALL) {
|
||||||
// se abbastanza lontano e non su bordi intervallino lo aggiungo
|
// 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
|
// cerco la minima distanza per la polilinea
|
||||||
MDCVECTOR vApproxMin ;
|
MDCVECTOR vApproxMin ;
|
||||||
MDCVECTOR::iterator Iter ;
|
|
||||||
if ( ! CalcMinDistPointPolyLine( ptP, PL, dLinTol, vApproxMin))
|
if ( ! CalcMinDistPointPolyLine( ptP, PL, dLinTol, vApproxMin))
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
@@ -52,7 +51,7 @@ DistPointCrvBezier::DistPointCrvBezier( const Point3d& ptP, const ICurveBezier&
|
|||||||
double dSingP ;
|
double dSingP ;
|
||||||
if ( CrvBez.GetSingularParam( dSingP) == 0)
|
if ( CrvBez.GetSingularParam( dSingP) == 0)
|
||||||
dSingP = - 1 ;
|
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
|
// imposto flag per singolarità agli estremi
|
||||||
(*Iter).bParMinSing = abs( (*Iter).dParMin - dSingP) < EPS_SMALL ;
|
(*Iter).bParMinSing = abs( (*Iter).dParMin - dSingP) < EPS_SMALL ;
|
||||||
(*Iter).bParMaxSing = abs( (*Iter).dParMax - 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
|
// raffino i punti trovati
|
||||||
double dPolishedPar ;
|
double dPolishedPar ;
|
||||||
Point3d ptPolishedQ ;
|
Point3d ptPolishedQ ;
|
||||||
for ( Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
for ( auto Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||||
// eseguo raffinamento
|
// eseguo raffinamento
|
||||||
if ( PolishMinDistPointCurve( ptP, CrvBez, *Iter, dPolishedPar, ptPolishedQ)) {
|
if ( PolishMinDistPointCurve( ptP, CrvBez, *Iter, dPolishedPar, ptPolishedQ)) {
|
||||||
(*Iter).dDist = Dist( ptP, ptPolishedQ) ;
|
(*Iter).dDist = Dist( ptP, ptPolishedQ) ;
|
||||||
@@ -80,7 +79,7 @@ DistPointCrvBezier::DistPointCrvBezier( const Point3d& ptP, const ICurveBezier&
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointCrvBezier::GetSqDist( double& dSqDist)
|
DistPointCrvBezier::GetSqDist( double& dSqDist) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -91,7 +90,7 @@ DistPointCrvBezier::GetSqDist( double& dSqDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointCrvBezier::GetDist( double& dDist)
|
DistPointCrvBezier::GetDist( double& dDist) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -102,7 +101,7 @@ DistPointCrvBezier::GetDist( double& dDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointCrvBezier::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
DistPointCrvBezier::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -117,7 +116,7 @@ DistPointCrvBezier::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointCrvBezier::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
DistPointCrvBezier::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
|
|||||||
@@ -27,17 +27,18 @@ class DistPointCrvBezier
|
|||||||
DistPointCrvBezier( const Point3d& ptP, const ICurveBezier& CrvBez) ;
|
DistPointCrvBezier( const Point3d& ptP, const ICurveBezier& CrvBez) ;
|
||||||
|
|
||||||
public :
|
public :
|
||||||
bool GetSqDist( double& dSqDist) ;
|
bool GetSqDist( double& dSqDist) const ;
|
||||||
bool GetDist( double& dDist) ;
|
bool GetDist( double& dDist) const ;
|
||||||
bool IsEpsilon( double dTol)
|
bool IsEpsilon( double dTol) const
|
||||||
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
||||||
bool IsSmall( void)
|
bool IsSmall( void) const
|
||||||
{ return IsEpsilon( EPS_SMALL) ; }
|
{ return IsEpsilon( EPS_SMALL) ; }
|
||||||
bool IsZero( void)
|
bool IsZero( void) const
|
||||||
{ return IsEpsilon( EPS_ZERO) ; }
|
{ return IsEpsilon( EPS_ZERO) ; }
|
||||||
int GetNbrMinDist( void) { return (int) m_Info.size() ; }
|
int GetNbrMinDist( void) const
|
||||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) ;
|
{ return (int) m_Info.size() ; }
|
||||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) ;
|
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const ;
|
||||||
|
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
DistPointCrvBezier( void) ;
|
DistPointCrvBezier( void) ;
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ DistPointCrvComposite::DistPointCrvComposite( const Point3d& ptP, const ICurveCo
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointCrvComposite::GetSqDist( double& dSqDist)
|
DistPointCrvComposite::GetSqDist( double& dSqDist) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -140,7 +140,7 @@ DistPointCrvComposite::GetSqDist( double& dSqDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointCrvComposite::GetDist( double& dDist)
|
DistPointCrvComposite::GetDist( double& dDist) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -151,7 +151,7 @@ DistPointCrvComposite::GetDist( double& dDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointCrvComposite::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
DistPointCrvComposite::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -166,7 +166,7 @@ DistPointCrvComposite::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointCrvComposite::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
DistPointCrvComposite::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
|
|||||||
@@ -26,17 +26,18 @@ class DistPointCrvComposite
|
|||||||
DistPointCrvComposite( const Point3d& ptP, const ICurveComposite& CrvCompo) ;
|
DistPointCrvComposite( const Point3d& ptP, const ICurveComposite& CrvCompo) ;
|
||||||
|
|
||||||
public :
|
public :
|
||||||
bool GetSqDist( double& dSqDist) ;
|
bool GetSqDist( double& dSqDist) const ;
|
||||||
bool GetDist( double& dDist) ;
|
bool GetDist( double& dDist) const ;
|
||||||
bool IsEpsilon( double dTol)
|
bool IsEpsilon( double dTol) const
|
||||||
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
||||||
bool IsSmall( void)
|
bool IsSmall( void) const
|
||||||
{ return IsEpsilon( EPS_SMALL) ; }
|
{ return IsEpsilon( EPS_SMALL) ; }
|
||||||
bool IsZero( void)
|
bool IsZero( void) const
|
||||||
{ return IsEpsilon( EPS_ZERO) ; }
|
{ return IsEpsilon( EPS_ZERO) ; }
|
||||||
int GetNbrMinDist( void) { return (int) m_Info.size() ; }
|
int GetNbrMinDist( void) const
|
||||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) ;
|
{ return (int) m_Info.size() ; }
|
||||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) ;
|
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const ;
|
||||||
|
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
DistPointCrvComposite( void) ;
|
DistPointCrvComposite( void) ;
|
||||||
|
|||||||
+10
-10
@@ -13,10 +13,10 @@
|
|||||||
|
|
||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "DistPointLine.h"
|
|
||||||
#include "DistPointArc.h"
|
#include "DistPointArc.h"
|
||||||
#include "DistPointCrvBezier.h"
|
#include "DistPointCrvBezier.h"
|
||||||
#include "DistPointCrvComposite.h"
|
#include "DistPointCrvComposite.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ DistPointCurve::CrvCompositeCalculate( const Point3d& ptP, const ICurve& Curve)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointCurve::GetSqDist( double& dSqDist)
|
DistPointCurve::GetSqDist( double& dSqDist) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -109,7 +109,7 @@ DistPointCurve::GetSqDist( double& dSqDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointCurve::GetDist( double& dDist)
|
DistPointCurve::GetDist( double& dDist) const
|
||||||
{
|
{
|
||||||
if ( m_dDist < 0)
|
if ( m_dDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -120,7 +120,7 @@ DistPointCurve::GetDist( double& dDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
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())
|
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||||
return false ;
|
return false ;
|
||||||
@@ -132,7 +132,7 @@ DistPointCurve::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
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())
|
if ( m_dDist < 0 || m_Info.empty())
|
||||||
return false ;
|
return false ;
|
||||||
@@ -166,7 +166,7 @@ DistPointCurve::GetMinDistPoint( double dNearParam, Point3d& ptMinDist, int& nFl
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
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())
|
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||||
return false ;
|
return false ;
|
||||||
@@ -178,7 +178,7 @@ DistPointCurve::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
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())
|
if ( m_dDist < 0 || m_Info.empty())
|
||||||
return false ;
|
return false ;
|
||||||
@@ -209,7 +209,7 @@ DistPointCurve::GetParamAtMinDistPoint( double dNearParam, double& dParam, int&
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
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())
|
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||||
return false ;
|
return false ;
|
||||||
@@ -257,7 +257,7 @@ DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
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())
|
if ( m_dDist < 0 || m_Info.empty())
|
||||||
return false ;
|
return false ;
|
||||||
@@ -278,7 +278,7 @@ DistPointCurve::GetSideAtMinDistPoint( double dNearParam, const Vector3d& vtN, i
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
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())
|
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||||
return false ;
|
return false ;
|
||||||
|
|||||||
+8
-8
@@ -1,19 +1,19 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2013-2013
|
// EgalTech 2013-2024
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : DistPointLine.cpp Data : 17.12.13 Versione : 1.4l1
|
// File : DistPointLine.cpp Data : 20.05.24 Versione : 2.6e5
|
||||||
// Contenuto : Implementazione della classe distanza punto da linea/segmento.
|
// Contenuto : Implementazione della classe distanza punto da linea/segmento.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Modifiche : 17.12.13 DS Creazione modulo.
|
// Modifiche : 17.12.13 DS Creazione modulo.
|
||||||
//
|
// 20.05.24 DS Reso pubblico in Include.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "DistPointLine.h"
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -95,7 +95,7 @@ DistPointLine::Calculate( const Point3d& ptP,
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointLine::GetSqDist( double& dSqDist)
|
DistPointLine::GetSqDist( double& dSqDist) const
|
||||||
{
|
{
|
||||||
if ( m_dSqDist < 0)
|
if ( m_dSqDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -106,7 +106,7 @@ DistPointLine::GetSqDist( double& dSqDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointLine::GetDist( double& dDist)
|
DistPointLine::GetDist( double& dDist) const
|
||||||
{
|
{
|
||||||
if ( m_dSqDist < 0)
|
if ( m_dSqDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -119,7 +119,7 @@ DistPointLine::GetDist( double& dDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointLine::GetMinDistPoint( Point3d& ptMinDist)
|
DistPointLine::GetMinDistPoint( Point3d& ptMinDist) const
|
||||||
{
|
{
|
||||||
if ( m_dSqDist < 0)
|
if ( m_dSqDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
@@ -130,7 +130,7 @@ DistPointLine::GetMinDistPoint( Point3d& ptMinDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointLine::GetParamAtMinDistPoint( double& dParam)
|
DistPointLine::GetParamAtMinDistPoint( double& dParam) const
|
||||||
{
|
{
|
||||||
if ( m_dSqDist < 0)
|
if ( m_dSqDist < 0)
|
||||||
return false ;
|
return false ;
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// EgalTech 2013-2014
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// File : DistPointLine.h Data : 02.01.14 Versione : 1.5a1
|
|
||||||
// Contenuto : Dichiarazione della classe distanza punto da linea/segmento.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Modifiche : 30.12.12 DS Creazione modulo.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
class DistPointLine
|
|
||||||
{
|
|
||||||
friend class DistPointCurve ;
|
|
||||||
|
|
||||||
public :
|
|
||||||
DistPointLine( const Point3d& ptP,
|
|
||||||
const ICurveLine& crvLine, bool bIsSegment = true) ;
|
|
||||||
DistPointLine( const Point3d& ptP,
|
|
||||||
const Point3d& ptIni, const Point3d& ptFin, bool bIsSegment = true) ;
|
|
||||||
DistPointLine( const Point3d& ptP,
|
|
||||||
const Point3d& ptIni, const Vector3d& vtDir, double dLen, bool bIsSegment = 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) ; }
|
|
||||||
int GetNbrMinDist( void)
|
|
||||||
{ return (( m_dSqDist < 0) ? 0 : 1) ; }
|
|
||||||
bool GetMinDistPoint( Point3d& ptMinDist) ;
|
|
||||||
bool GetParamAtMinDistPoint( double& dParam) ;
|
|
||||||
|
|
||||||
private :
|
|
||||||
DistPointLine( void) ;
|
|
||||||
void Calculate( const Point3d& ptP,
|
|
||||||
const Point3d& ptIni, const Vector3d& vtDir, double dLen, bool bIsSegment) ;
|
|
||||||
|
|
||||||
private :
|
|
||||||
double m_dSqDist ;
|
|
||||||
double m_dDist ;
|
|
||||||
double m_dParam ;
|
|
||||||
Point3d m_ptMinDist ;
|
|
||||||
} ;
|
|
||||||
|
|
||||||
+78
-11
@@ -15,6 +15,7 @@
|
|||||||
#include "SurfTriMesh.h"
|
#include "SurfTriMesh.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointTria.h"
|
#include "/EgtDev/Include/EGkDistPointTria.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
|
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
|
||||||
|
#include "/EgtDev/Include/EGkIntersLineTria.h"
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
@@ -93,6 +94,8 @@ DistPointSurfTm::Calculate( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
|||||||
{
|
{
|
||||||
// Inizializzo distanza non calcolata
|
// Inizializzo distanza non calcolata
|
||||||
m_dDist = - 1. ;
|
m_dDist = - 1. ;
|
||||||
|
// Controllo se la superficie è chiusa
|
||||||
|
m_bIsSurfClosed = tmSurf.IsClosed() ;
|
||||||
|
|
||||||
// Lavoro con l'oggetto superficie trimesh di base
|
// Lavoro con l'oggetto superficie trimesh di base
|
||||||
const SurfTriMesh* pStm = GetBasicSurfTriMesh( &tmSurf) ;
|
const SurfTriMesh* pStm = GetBasicSurfTriMesh( &tmSurf) ;
|
||||||
@@ -121,6 +124,9 @@ DistPointSurfTm::Calculate( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
|||||||
// Finché non si verifica la condizione di terminazione ingrandisco il box.
|
// Finché non si verifica la condizione di terminazione ingrandisco il box.
|
||||||
pStm->ResetTempInts() ;
|
pStm->ResetTempInts() ;
|
||||||
bool bContinue = true ;
|
bool bContinue = true ;
|
||||||
|
|
||||||
|
// creazione del vettore dei triangoli più vicini a ptP
|
||||||
|
vector<pair<int, Triangle3d>> vTria ; // <indice triangolo, Triangolo>
|
||||||
while ( bContinue) {
|
while ( bContinue) {
|
||||||
// Calcolo il box differenza con il precedente per non esplorare parti già considerate
|
// Calcolo il box differenza con il precedente per non esplorare parti già considerate
|
||||||
BOXVECTOR vBox ;
|
BOXVECTOR vBox ;
|
||||||
@@ -145,17 +151,23 @@ DistPointSurfTm::Calculate( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
|||||||
DistPointTriangle distPT( ptP, trCurTria) ;
|
DistPointTriangle distPT( ptP, trCurTria) ;
|
||||||
double dCurSqDist ;
|
double dCurSqDist ;
|
||||||
// Se la distanza del triangolo è valida e minore di quella attuale aggiorno
|
// Se la distanza del triangolo è valida e minore di quella attuale aggiorno
|
||||||
if ( distPT.GetSqDist( dCurSqDist) && dCurSqDist < dMinSqDist) {
|
if ( distPT.GetSqDist( dCurSqDist)) {
|
||||||
|
if ( abs( dCurSqDist - dMinSqDist) < EPS_SMALL) // se distanze uguali...
|
||||||
|
vTria.emplace_back( make_pair( nT, trCurTria)) ; // aggiungo il triangolo
|
||||||
|
else if ( dCurSqDist < dMinSqDist) { // se minore...
|
||||||
|
vTria.clear() ; // pulisco il vettore
|
||||||
dMinSqDist = dCurSqDist ;
|
dMinSqDist = dCurSqDist ;
|
||||||
nMinDistTriaIndex = nT ;
|
nMinDistTriaIndex = nT ;
|
||||||
distPT.GetMinDistPoint( ptMinDistPoint) ;
|
distPT.GetMinDistPoint( ptMinDistPoint) ;
|
||||||
|
vTria.emplace_back( make_pair( nT, trCurTria)) ; // aggiungo il triangolo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Se si verifica la condizione di terminazione arresto il ciclo altrimenti aggiorno i box
|
// Se si verifica la condizione di terminazione arresto il ciclo altrimenti aggiorno i box
|
||||||
if ( ! bCollide || dMinSqDist < EPS_SMALL * EPS_SMALL)
|
if ( ! bCollide || dMinSqDist < SQ_EPS_SMALL)
|
||||||
bContinue = false ;
|
bContinue = false ;
|
||||||
else {
|
else {
|
||||||
boxPPrev = boxP ;
|
boxPPrev = boxP ;
|
||||||
@@ -163,20 +175,75 @@ DistPointSurfTm::Calculate( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( nMinDistTriaIndex != SVT_NULL) {
|
// se non ho trovato nessun triangolo, esco
|
||||||
|
if ( nMinDistTriaIndex == SVT_NULL)
|
||||||
|
return ;
|
||||||
|
|
||||||
|
// salvo la distanza minima
|
||||||
m_dDist = sqrt( max( dMinSqDist, 0.)) ;
|
m_dDist = sqrt( max( dMinSqDist, 0.)) ;
|
||||||
m_nMinDistTriaIndex = nMinDistTriaIndex ;
|
// salvo il punto a distanza minima
|
||||||
m_ptMinDistPoint = ptMinDistPoint ;
|
m_ptMinDistPoint = ptMinDistPoint ;
|
||||||
Triangle3d trMinDistTria ;
|
// se il punto è sulla TriMesh...
|
||||||
pStm->GetTriangle( m_nMinDistTriaIndex, trMinDistTria) ;
|
if ( m_dDist < EPS_SMALL) {
|
||||||
trMinDistTria.Validate() ;
|
m_nMinDistTriaIndex = nMinDistTriaIndex ;
|
||||||
m_bIsInside = ( ( ptP - m_ptMinDistPoint) * trMinDistTria.GetN() < - EPS_SMALL) && pStm->IsClosed() ;
|
m_bIsInside = false ;
|
||||||
|
return ;
|
||||||
}
|
}
|
||||||
|
// se ho un solo triangolo, allora deduco le informazioni da lui
|
||||||
|
else if ( int( vTria.size()) == 1) {
|
||||||
|
m_nMinDistTriaIndex = vTria.back().first ;
|
||||||
|
m_bIsInside = ( ( ptP - m_ptMinDistPoint) * vTria.back().second.GetN() < - EPS_SMALL) ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// controllo se tutti i triangoli a minima distanza forniscono la stessa informazione
|
||||||
|
// ( il punto potrebbe essere esterno a tutti, interno a tutti o indefinito )
|
||||||
|
bool bInside = false ;
|
||||||
|
bool bOutside = false ;
|
||||||
|
for ( int i = 0 ; i < int( vTria.size()) ; ++ i) { // scorro i triangoli a minima distanza
|
||||||
|
if ( ( ptP - vTria[i].second.GetP( 0)) * vTria[i].second.GetN() < - EPS_SMALL)
|
||||||
|
bInside = true ;
|
||||||
|
else
|
||||||
|
bOutside = true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// inizializzo le variabili membro
|
||||||
|
m_nMinDistTriaIndex = nMinDistTriaIndex ;
|
||||||
|
m_bIsInside = false ;
|
||||||
|
|
||||||
|
// se le informazioni non sono coerenti, allora :
|
||||||
|
// 1) calcolo i centroidi dei triangoli in questione
|
||||||
|
// 2) ottengo il punto medio di questi centroidi
|
||||||
|
// 3) controllo quale triangolo interseca il segmento che parte da ptP e arriva a tale punto
|
||||||
|
// 4) userò questo triangolo per classificare ptP
|
||||||
|
if ( bOutside == bInside) {
|
||||||
|
// calcolo il baricentro complessivo
|
||||||
|
Point3d ptBar_tot ;
|
||||||
|
for ( auto& Tria : vTria)
|
||||||
|
ptBar_tot += Tria.second.GetCentroid() ;
|
||||||
|
ptBar_tot /= int( vTria.size()) ;
|
||||||
|
// per ogni triangolo, cerco quello che interseca il segmento
|
||||||
|
for ( auto& Tria : vTria) {
|
||||||
|
Point3d ptInters1, ptInters2 ;
|
||||||
|
int nType = IntersLineTria( ptP, ptBar_tot, Tria.second, ptInters1, ptInters2) ;
|
||||||
|
if ( nType == ILTT_IN) { // se intersezione ho finito
|
||||||
|
DistPointTriangle( ptP, Tria.second).GetMinDistPoint( m_ptMinDistPoint) ;
|
||||||
|
m_bIsInside = ( ( ptP - m_ptMinDistPoint) * Tria.second.GetN() < - EPS_SMALL) ;
|
||||||
|
m_nMinDistTriaIndex = Tria.first ;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // se informazioni coerenti
|
||||||
|
m_bIsInside = bInside ;
|
||||||
|
|
||||||
|
return ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointSurfTm::GetDist( double& dDist)
|
DistPointSurfTm::GetDist( double& dDist) const
|
||||||
{
|
{
|
||||||
// Distanza non valida
|
// Distanza non valida
|
||||||
if ( m_dDist < -EPS_ZERO)
|
if ( m_dDist < -EPS_ZERO)
|
||||||
@@ -188,7 +255,7 @@ DistPointSurfTm::GetDist( double& dDist)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointSurfTm::GetMinDistPoint( Point3d& ptMinDistPoint)
|
DistPointSurfTm::GetMinDistPoint( Point3d& ptMinDistPoint) const
|
||||||
{
|
{
|
||||||
// Distanza non valida
|
// Distanza non valida
|
||||||
if ( m_dDist < -EPS_ZERO)
|
if ( m_dDist < -EPS_ZERO)
|
||||||
@@ -200,7 +267,7 @@ DistPointSurfTm::GetMinDistPoint( Point3d& ptMinDistPoint)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DistPointSurfTm::GetMinDistTriaIndex( int& nMinDistIndex)
|
DistPointSurfTm::GetMinDistTriaIndex( int& nMinDistIndex) const
|
||||||
{
|
{
|
||||||
// Distanza non valida
|
// Distanza non valida
|
||||||
if ( m_dDist < -EPS_ZERO)
|
if ( m_dDist < -EPS_ZERO)
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "ProjPlane.h"
|
#include "ProjPlane.h"
|
||||||
#include "DistPointLine.h"
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointTria.h"
|
#include "/EgtDev/Include/EGkDistPointTria.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
+34
-3
@@ -238,7 +238,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
|||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||||
<OmitFramePointers>true</OmitFramePointers>
|
<OmitFramePointers>true</OmitFramePointers>
|
||||||
<FloatingPointModel>Precise</FloatingPointModel>
|
<FloatingPointModel>Precise</FloatingPointModel>
|
||||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||||
@@ -280,6 +280,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClCompile Include="Attribs.cpp" />
|
<ClCompile Include="Attribs.cpp" />
|
||||||
<ClCompile Include="BBox3d.cpp" />
|
<ClCompile Include="BBox3d.cpp" />
|
||||||
<ClCompile Include="BiArcs.cpp" />
|
<ClCompile Include="BiArcs.cpp" />
|
||||||
|
<ClCompile Include="CalcPocketing.cpp" />
|
||||||
<ClCompile Include="CAvSimpleSurfFrMove.cpp" />
|
<ClCompile Include="CAvSimpleSurfFrMove.cpp" />
|
||||||
<ClCompile Include="CAvToolSurfTm.cpp" />
|
<ClCompile Include="CAvToolSurfTm.cpp" />
|
||||||
<ClCompile Include="CAvToolTriangle.cpp" />
|
<ClCompile Include="CAvToolTriangle.cpp" />
|
||||||
@@ -308,12 +309,37 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClCompile Include="CurveByApprox.cpp" />
|
<ClCompile Include="CurveByApprox.cpp" />
|
||||||
<ClCompile Include="CurveByInterp.cpp" />
|
<ClCompile Include="CurveByInterp.cpp" />
|
||||||
<ClCompile Include="CurveCompositeOffset.cpp" />
|
<ClCompile Include="CurveCompositeOffset.cpp" />
|
||||||
|
<ClCompile Include="IntersCurveSurfTm.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IntersLineVolZmap.cpp" />
|
||||||
|
<ClCompile Include="IntersPlaneVolZmap.cpp" />
|
||||||
|
<ClCompile Include="IntersLineSurfBez.cpp" />
|
||||||
|
<ClCompile Include="PolygonElevation.cpp" />
|
||||||
|
<ClCompile Include="Quaternion.cpp" />
|
||||||
|
<ClCompile Include="RotationMinimizingFrame.cpp" />
|
||||||
|
<ClCompile Include="RotationXplaneFrame.cpp" />
|
||||||
|
<ClCompile Include="SbzStandard.cpp" />
|
||||||
|
<ClCompile Include="Voronoi.cpp" />
|
||||||
<ClInclude Include="..\Include\EGkCDeClosedSurfTmClosedSurfTm.h" />
|
<ClInclude Include="..\Include\EGkCDeClosedSurfTmClosedSurfTm.h" />
|
||||||
<ClInclude Include="..\Include\EGkCDeConeFrustumClosedSurfTm.h" />
|
<ClInclude Include="..\Include\EGkCDeConeFrustumClosedSurfTm.h" />
|
||||||
<ClInclude Include="..\Include\EGkCDeConvexTorusClosedSurfTm.h" />
|
<ClInclude Include="..\Include\EGkCDeConvexTorusClosedSurfTm.h" />
|
||||||
<ClInclude Include="..\Include\EGkCDeRectPrismoidClosedSurfTm.h" />
|
<ClInclude Include="..\Include\EGkCDeRectPrismoidClosedSurfTm.h" />
|
||||||
|
<ClInclude Include="..\Include\EGkDistLineLine.h" />
|
||||||
|
<ClInclude Include="..\Include\EGkDistPointLine.h" />
|
||||||
|
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h" />
|
||||||
<ClInclude Include="..\Include\EGkIntersLineBox.h" />
|
<ClInclude Include="..\Include\EGkIntersLineBox.h" />
|
||||||
|
<ClInclude Include="..\Include\EGkIntersLineVolZmap.h" />
|
||||||
<ClInclude Include="..\Include\EGkIntersPlaneBox.h" />
|
<ClInclude Include="..\Include\EGkIntersPlaneBox.h" />
|
||||||
|
<ClInclude Include="..\Include\EGkIntersPlaneVolZmap.h" />
|
||||||
|
<ClInclude Include="..\Include\EGkPolygonElevation.h" />
|
||||||
|
<ClInclude Include="..\Include\EGkQuaternion.h" />
|
||||||
|
<ClInclude Include="..\Include\EGkRotationMinimizingFrame.h" />
|
||||||
|
<ClInclude Include="..\Include\EGkRotationXplaneFrame.h" />
|
||||||
|
<ClInclude Include="..\Include\EGkSubtractProjectedFacesOnStmFace.h" />
|
||||||
<ClInclude Include="CDeBoxTria.h" />
|
<ClInclude Include="CDeBoxTria.h" />
|
||||||
<ClInclude Include="CDeCapsTria.h" />
|
<ClInclude Include="CDeCapsTria.h" />
|
||||||
<ClInclude Include="CDeConeFrustumTria.h" />
|
<ClInclude Include="CDeConeFrustumTria.h" />
|
||||||
@@ -342,6 +368,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClCompile Include="IntersPlaneTria.cpp" />
|
<ClCompile Include="IntersPlaneTria.cpp" />
|
||||||
<ClCompile Include="IntersSurfTmSurfTm.cpp" />
|
<ClCompile Include="IntersSurfTmSurfTm.cpp" />
|
||||||
<ClCompile Include="IntersTriaTria.cpp" />
|
<ClCompile Include="IntersTriaTria.cpp" />
|
||||||
|
<ClCompile Include="OffsetAux.cpp" />
|
||||||
|
<ClCompile Include="Tree.cpp" />
|
||||||
<ClCompile Include="MedialAxis.cpp" />
|
<ClCompile Include="MedialAxis.cpp" />
|
||||||
<ClCompile Include="OffsetCurve.cpp" />
|
<ClCompile Include="OffsetCurve.cpp" />
|
||||||
<ClCompile Include="DistPointArc.cpp" />
|
<ClCompile Include="DistPointArc.cpp" />
|
||||||
@@ -397,9 +425,11 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClCompile Include="OffsetCurveOnX.cpp" />
|
<ClCompile Include="OffsetCurveOnX.cpp" />
|
||||||
<ClCompile Include="Polygon3d.cpp" />
|
<ClCompile Include="Polygon3d.cpp" />
|
||||||
<ClCompile Include="AdjustLoops.cpp" />
|
<ClCompile Include="AdjustLoops.cpp" />
|
||||||
|
<ClCompile Include="ProjectCurveSurfTm.cpp" />
|
||||||
<ClCompile Include="RemoveCurveDefects.cpp" />
|
<ClCompile Include="RemoveCurveDefects.cpp" />
|
||||||
<ClCompile Include="SelfIntersCurve.cpp" />
|
<ClCompile Include="SelfIntersCurve.cpp" />
|
||||||
<ClCompile Include="SfrCreate.cpp" />
|
<ClCompile Include="SfrCreate.cpp" />
|
||||||
|
<ClCompile Include="SubtractProjectedFacesOnStmFace.cpp" />
|
||||||
<ClCompile Include="SurfAux.cpp" />
|
<ClCompile Include="SurfAux.cpp" />
|
||||||
<ClCompile Include="SurfBezier.cpp" />
|
<ClCompile Include="SurfBezier.cpp" />
|
||||||
<ClCompile Include="SurfFlatRegion.cpp" />
|
<ClCompile Include="SurfFlatRegion.cpp" />
|
||||||
@@ -440,6 +470,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClCompile Include="VolZmapGraphics.cpp" />
|
<ClCompile Include="VolZmapGraphics.cpp" />
|
||||||
<ClCompile Include="VolZmapVolume.cpp" />
|
<ClCompile Include="VolZmapVolume.cpp" />
|
||||||
<ClCompile Include="VolZmap.cpp" />
|
<ClCompile Include="VolZmap.cpp" />
|
||||||
|
<ClInclude Include="Voronoi.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\Include\EGkAngle.h" />
|
<ClInclude Include="..\Include\EGkAngle.h" />
|
||||||
@@ -566,12 +597,10 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClInclude Include="CAvSimpleSurfFrMove.h" />
|
<ClInclude Include="CAvSimpleSurfFrMove.h" />
|
||||||
<ClInclude Include="CAvToolSurfTm.h" />
|
<ClInclude Include="CAvToolSurfTm.h" />
|
||||||
<ClInclude Include="CreateCurveAux.h" />
|
<ClInclude Include="CreateCurveAux.h" />
|
||||||
<ClInclude Include="DistLineLine.h" />
|
|
||||||
<ClInclude Include="DistPointArc.h" />
|
<ClInclude Include="DistPointArc.h" />
|
||||||
<ClInclude Include="DistPointCrvAux.h" />
|
<ClInclude Include="DistPointCrvAux.h" />
|
||||||
<ClInclude Include="DistPointCrvBezier.h" />
|
<ClInclude Include="DistPointCrvBezier.h" />
|
||||||
<ClInclude Include="DistPointCrvComposite.h" />
|
<ClInclude Include="DistPointCrvComposite.h" />
|
||||||
<ClInclude Include="DistPointLine.h" />
|
|
||||||
<ClInclude Include="DllMain.h" />
|
<ClInclude Include="DllMain.h" />
|
||||||
<ClInclude Include="earcut.hpp" />
|
<ClInclude Include="earcut.hpp" />
|
||||||
<ClInclude Include="ExtDimension.h" />
|
<ClInclude Include="ExtDimension.h" />
|
||||||
@@ -610,6 +639,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClInclude Include="IntersLineSurfStd.h" />
|
<ClInclude Include="IntersLineSurfStd.h" />
|
||||||
<ClInclude Include="IntersLineTria.h" />
|
<ClInclude Include="IntersLineTria.h" />
|
||||||
<ClInclude Include="IterManager.h" />
|
<ClInclude Include="IterManager.h" />
|
||||||
|
<ClInclude Include="OffsetAux.h" />
|
||||||
|
<ClInclude Include="Tree.h" />
|
||||||
<ClInclude Include="Material.h" />
|
<ClInclude Include="Material.h" />
|
||||||
<ClInclude Include="FontNfe.h" />
|
<ClInclude Include="FontNfe.h" />
|
||||||
<ClInclude Include="MC_Tables.h" />
|
<ClInclude Include="MC_Tables.h" />
|
||||||
|
|||||||
+120
-33
@@ -43,7 +43,16 @@
|
|||||||
<Filter Include="File di origine\GeoOffset">
|
<Filter Include="File di origine\GeoOffset">
|
||||||
<UniqueIdentifier>{f07670fd-9429-4b7e-ac6d-1c0022e756fb}</UniqueIdentifier>
|
<UniqueIdentifier>{f07670fd-9429-4b7e-ac6d-1c0022e756fb}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="File di origine\GeoCollision">
|
<Filter Include="File di origine\GeoProject">
|
||||||
|
<UniqueIdentifier>{d96752da-1884-4a73-ba1b-5b20b606e469}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="File di origine\GeoElevation">
|
||||||
|
<UniqueIdentifier>{4c6a9dc5-8fac-4ecd-bde6-3e37e056712e}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="File di origine\GeoCollisionAvoid">
|
||||||
|
<UniqueIdentifier>{ae52e402-3063-45e3-b9f7-1710035a1f56}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="File di origine\GeoCollisionDetection">
|
||||||
<UniqueIdentifier>{865b76ee-b10d-41fc-861c-b48ce52fa277}</UniqueIdentifier>
|
<UniqueIdentifier>{865b76ee-b10d-41fc-861c-b48ce52fa277}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -267,6 +276,9 @@
|
|||||||
<ClCompile Include="IntersLineSurfTm.cpp">
|
<ClCompile Include="IntersLineSurfTm.cpp">
|
||||||
<Filter>File di origine\GeoInters</Filter>
|
<Filter>File di origine\GeoInters</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="IntersLineSurfBez.cpp">
|
||||||
|
<Filter>File di origine\GeoInters</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="CircleCenTgCurve.cpp">
|
<ClCompile Include="CircleCenTgCurve.cpp">
|
||||||
<Filter>File di origine\GeoCreate</Filter>
|
<Filter>File di origine\GeoCreate</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -366,17 +378,8 @@
|
|||||||
<ClCompile Include="IntersLineSurfStd.cpp">
|
<ClCompile Include="IntersLineSurfStd.cpp">
|
||||||
<Filter>File di origine\GeoInters</Filter>
|
<Filter>File di origine\GeoInters</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CAvToolTriangle.cpp">
|
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="CAvToolSurfTm.cpp">
|
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="CDeBoxTria.cpp">
|
<ClCompile Include="CDeBoxTria.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="CAvSimpleSurfFrMove.cpp">
|
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="IntersSurfTmSurfTm.cpp">
|
<ClCompile Include="IntersSurfTmSurfTm.cpp">
|
||||||
<Filter>File di origine\GeoInters</Filter>
|
<Filter>File di origine\GeoInters</Filter>
|
||||||
@@ -394,19 +397,19 @@
|
|||||||
<Filter>File di origine\Geo</Filter>
|
<Filter>File di origine\Geo</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeCylTria.cpp">
|
<ClCompile Include="CDeCylTria.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeBoxClosedSurfTm.cpp">
|
<ClCompile Include="CDeBoxClosedSurfTm.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeCylClosedSurfTm.cpp">
|
<ClCompile Include="CDeCylClosedSurfTm.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeSpheTria.cpp">
|
<ClCompile Include="CDeSpheTria.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeSpheClosedSurfTm.cpp">
|
<ClCompile Include="CDeSpheClosedSurfTm.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="SurfBezier.cpp">
|
<ClCompile Include="SurfBezier.cpp">
|
||||||
<Filter>File di origine\Geo</Filter>
|
<Filter>File di origine\Geo</Filter>
|
||||||
@@ -424,34 +427,34 @@
|
|||||||
<Filter>File di origine\GeoDist</Filter>
|
<Filter>File di origine\GeoDist</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeTriaTria.cpp">
|
<ClCompile Include="CDeTriaTria.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeConeTria.cpp">
|
<ClCompile Include="CDeConeTria.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeUtility.cpp">
|
<ClCompile Include="CDeUtility.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeClosedSurfTmClosedSurfTm.cpp">
|
<ClCompile Include="CDeClosedSurfTmClosedSurfTm.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeConeFrustumClosedSurfTm.cpp">
|
<ClCompile Include="CDeConeFrustumClosedSurfTm.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeConeFrustumTria.cpp">
|
<ClCompile Include="CDeConeFrustumTria.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeConvexTorusClosedSurfTm.cpp">
|
<ClCompile Include="CDeConvexTorusClosedSurfTm.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeConvexTorusTria.cpp">
|
<ClCompile Include="CDeConvexTorusTria.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeRectPrismoidClosedSurfTm.cpp">
|
<ClCompile Include="CDeRectPrismoidClosedSurfTm.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeRectPrismoidTria.cpp">
|
<ClCompile Include="CDeRectPrismoidTria.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="SurfTriMeshUtilities.cpp">
|
<ClCompile Include="SurfTriMeshUtilities.cpp">
|
||||||
<Filter>File di origine\Geo</Filter>
|
<Filter>File di origine\Geo</Filter>
|
||||||
@@ -463,7 +466,7 @@
|
|||||||
<Filter>File di origine\Base</Filter>
|
<Filter>File di origine\Base</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CDeCapsTria.cpp">
|
<ClCompile Include="CDeCapsTria.cpp">
|
||||||
<Filter>File di origine\GeoCollision</Filter>
|
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Circle2P.cpp">
|
<ClCompile Include="Circle2P.cpp">
|
||||||
<Filter>File di origine\GeoCreate</Filter>
|
<Filter>File di origine\GeoCreate</Filter>
|
||||||
@@ -471,6 +474,9 @@
|
|||||||
<ClCompile Include="MedialAxis.cpp">
|
<ClCompile Include="MedialAxis.cpp">
|
||||||
<Filter>File di origine\GeoOffset</Filter>
|
<Filter>File di origine\GeoOffset</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Tree.cpp">
|
||||||
|
<Filter>File di origine\Base</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="IntersLineCyl.cpp">
|
<ClCompile Include="IntersLineCyl.cpp">
|
||||||
<Filter>File di origine\GeoInters</Filter>
|
<Filter>File di origine\GeoInters</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -480,9 +486,57 @@
|
|||||||
<ClCompile Include="IntersLineCaps.cpp">
|
<ClCompile Include="IntersLineCaps.cpp">
|
||||||
<Filter>File di origine\GeoInters</Filter>
|
<Filter>File di origine\GeoInters</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="ProjectCurveSurfTm.cpp">
|
||||||
|
<Filter>File di origine\GeoProject</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="SubtractProjectedFacesOnStmFace.cpp">
|
||||||
|
<Filter>File di origine\GeoProject</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="SurfAux.cpp">
|
<ClCompile Include="SurfAux.cpp">
|
||||||
<Filter>File di origine\Geo</Filter>
|
<Filter>File di origine\Geo</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="CalcPocketing.cpp">
|
||||||
|
<Filter>File di origine\GeoOffset</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="OffsetAux.cpp">
|
||||||
|
<Filter>File di origine\GeoOffset</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="Voronoi.cpp">
|
||||||
|
<Filter>File di origine\Base</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="PolygonElevation.cpp">
|
||||||
|
<Filter>File di origine\GeoElevation</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IntersCurveSurfTm.cpp">
|
||||||
|
<Filter>File di origine\GeoInters</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="CAvSimpleSurfFrMove.cpp">
|
||||||
|
<Filter>File di origine\GeoCollisionAvoid</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="CAvToolSurfTm.cpp">
|
||||||
|
<Filter>File di origine\GeoCollisionAvoid</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="CAvToolTriangle.cpp">
|
||||||
|
<Filter>File di origine\GeoCollisionAvoid</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IntersLineVolZmap.cpp">
|
||||||
|
<Filter>File di origine\GeoInters</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IntersPlaneVolZmap.cpp">
|
||||||
|
<Filter>File di origine\GeoInters</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="SbzStandard.cpp">
|
||||||
|
<Filter>File di origine\GeoCreate</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="RotationMinimizingFrame.cpp">
|
||||||
|
<Filter>File di origine\Base</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="RotationXplaneFrame.cpp">
|
||||||
|
<Filter>File di origine\Base</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="Quaternion.cpp">
|
||||||
|
<Filter>File di origine\Base</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="stdafx.h">
|
<ClInclude Include="stdafx.h">
|
||||||
@@ -539,9 +593,6 @@
|
|||||||
<ClInclude Include="DistPointArc.h">
|
<ClInclude Include="DistPointArc.h">
|
||||||
<Filter>File di intestazione</Filter>
|
<Filter>File di intestazione</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="DistPointLine.h">
|
|
||||||
<Filter>File di intestazione</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="DistPointCrvBezier.h">
|
<ClInclude Include="DistPointCrvBezier.h">
|
||||||
<Filter>File di intestazione</Filter>
|
<Filter>File di intestazione</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -1064,9 +1115,6 @@
|
|||||||
<ClInclude Include="..\Include\EGkIntersPlaneBox.h">
|
<ClInclude Include="..\Include\EGkIntersPlaneBox.h">
|
||||||
<Filter>File di intestazione\Include</Filter>
|
<Filter>File di intestazione\Include</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="DistLineLine.h">
|
|
||||||
<Filter>File di intestazione</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="CDeUtility.h">
|
<ClInclude Include="CDeUtility.h">
|
||||||
<Filter>File di intestazione</Filter>
|
<Filter>File di intestazione</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -1115,6 +1163,9 @@
|
|||||||
<ClInclude Include="CDeCapsTria.h">
|
<ClInclude Include="CDeCapsTria.h">
|
||||||
<Filter>File di intestazione</Filter>
|
<Filter>File di intestazione</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Tree.h">
|
||||||
|
<Filter>File di intestazione</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="IntersLineCyl.h">
|
<ClInclude Include="IntersLineCyl.h">
|
||||||
<Filter>File di intestazione</Filter>
|
<Filter>File di intestazione</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -1127,6 +1178,42 @@
|
|||||||
<ClInclude Include="SurfAux.h">
|
<ClInclude Include="SurfAux.h">
|
||||||
<Filter>File di intestazione</Filter>
|
<Filter>File di intestazione</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="OffsetAux.h">
|
||||||
|
<Filter>File di intestazione</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Include\EGkPolygonElevation.h">
|
||||||
|
<Filter>File di intestazione\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Include\EGkSubtractProjectedFacesOnStmFace.h">
|
||||||
|
<Filter>File di intestazione\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Voronoi.h">
|
||||||
|
<Filter>File di intestazione</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h">
|
||||||
|
<Filter>File di intestazione\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Include\EGkIntersPlaneVolZmap.h">
|
||||||
|
<Filter>File di intestazione\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Include\EGkIntersLineVolZmap.h">
|
||||||
|
<Filter>File di intestazione\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Include\EGkRotationMinimizingFrame.h">
|
||||||
|
<Filter>File di intestazione\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Include\EGkRotationXplaneFrame.h">
|
||||||
|
<Filter>File di intestazione\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Include\EGkQuaternion.h">
|
||||||
|
<Filter>File di intestazione\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Include\EGkDistLineLine.h">
|
||||||
|
<Filter>File di intestazione\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Include\EGkDistPointLine.h">
|
||||||
|
<Filter>File di intestazione\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="EgtGeomKernel.rc">
|
<ResourceCompile Include="EgtGeomKernel.rc">
|
||||||
|
|||||||
+277
-175
@@ -2,7 +2,7 @@
|
|||||||
// EgalTech 2019-2019
|
// EgalTech 2019-2019
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : ExtDimension.cpp Data : 27.12.19 Versione : 2.2a1
|
// File : ExtDimension.cpp Data : 27.12.19 Versione : 2.2a1
|
||||||
// Contenuto : Implementazione della classe Dimension (quota).
|
// Contenuto : Implementazione della classe Dimension ( quota).
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -21,12 +21,14 @@
|
|||||||
#include "FontManager.h"
|
#include "FontManager.h"
|
||||||
#include "FontAux.h"
|
#include "FontAux.h"
|
||||||
#include "CurveArc.h"
|
#include "CurveArc.h"
|
||||||
|
#include "IntersLineLine.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
#include "/EgtDev/Include/EGkExtText.h"
|
#include "/EgtDev/Include/EGkExtText.h"
|
||||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||||
#include "/EgtDev/Include/EGkCurve.h"
|
#include "/EgtDev/Include/EGkCurve.h"
|
||||||
#include <new>
|
#include <new>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
@@ -50,10 +52,9 @@ GEOOBJ_REGISTER( EXT_DIMENSION, NGE_E_DIM, ExtDimension) ;
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
ExtDimension::ExtDimension( void)
|
ExtDimension::ExtDimension( void)
|
||||||
: m_dExtLineLen( STD_EXTLINELEN), m_dArrowLen( STD_ARROWLEN), m_dTextDist( STD_TEXTDIST),
|
: m_dExtLineLen( STD_EXTLINELEN), m_dArrowLen( STD_ARROWLEN), m_dTextDist( STD_TEXTDIST),
|
||||||
m_bLenIsMM( true), m_nDecDigit( STD_DECDIGIT), m_sFont( STD_FONT), m_dTextHeight( STD_TEXTHEIGHT)
|
m_bLenIsMM( true), m_nDecDigit( STD_DECDIGIT), m_sFont( STD_FONT), m_dTextHeight( STD_TEXTHEIGHT),
|
||||||
|
m_nTempProp{0,0}, m_dTempParam{0.0,0.0}
|
||||||
{
|
{
|
||||||
m_nTempProp[0] = 0 ;
|
|
||||||
m_nTempProp[1] = 0 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -94,7 +95,7 @@ ExtDimension::SetLinear( const Point3d& ptP1, const Point3d& ptP2, const Point3d
|
|||||||
// verifico che i punti di misura non siano coincidenti
|
// verifico che i punti di misura non siano coincidenti
|
||||||
if ( AreSamePointApprox( m_ptP1, m_ptP2))
|
if ( AreSamePointApprox( m_ptP1, m_ptP2))
|
||||||
return false ;
|
return false ;
|
||||||
// direzione di riferimento (nel piano perpendicolare a vtN)
|
// direzione di riferimento ( nel piano perpendicolare a vtN)
|
||||||
m_vtDir = vtDir ;
|
m_vtDir = vtDir ;
|
||||||
if ( m_vtDir.IsSmall())
|
if ( m_vtDir.IsSmall())
|
||||||
m_vtDir = m_ptP2 - m_ptP1 ;
|
m_vtDir = m_ptP2 - m_ptP1 ;
|
||||||
@@ -138,7 +139,7 @@ ExtDimension::SetLinear( const Point3d& ptP1, const Point3d& ptP2, const Point3d
|
|||||||
bool
|
bool
|
||||||
ExtDimension::SetRadial( const Point3d& ptCen, const Point3d& ptPos,
|
ExtDimension::SetRadial( const Point3d& ptCen, const Point3d& ptPos,
|
||||||
const Vector3d& vtN, const string& sText)
|
const Vector3d& vtN, const string& sText)
|
||||||
{
|
{ // il punto m_ptP6 viene utilizzato per il centro
|
||||||
// dichiaro quota non ancora determinata
|
// dichiaro quota non ancora determinata
|
||||||
m_nType = DT_NONE ;
|
m_nType = DT_NONE ;
|
||||||
// verifico la definizione del versore normale e del versore X
|
// verifico la definizione del versore normale e del versore X
|
||||||
@@ -146,20 +147,15 @@ ExtDimension::SetRadial( const Point3d& ptCen, const Point3d& ptPos,
|
|||||||
m_vtDir = ptPos - ptCen ;
|
m_vtDir = ptPos - ptCen ;
|
||||||
if ( ! m_vtN.Normalize() || ! m_vtDir.Normalize())
|
if ( ! m_vtN.Normalize() || ! m_vtDir.Normalize())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// porto i punti nel piano definito da ptCen e vtN
|
// porto i punti nel piano definito da ptCen e vtN
|
||||||
|
m_ptP6 = ptCen ;
|
||||||
|
m_ptPos = ptPos - ( ptPos - m_ptP6) * m_vtN * m_vtN ;
|
||||||
m_ptP1 = ptCen ;
|
m_ptP1 = ptCen ;
|
||||||
m_ptPos = ptPos - ( ptPos - m_ptP5) * m_vtN * m_vtN ;
|
|
||||||
m_ptP3 = m_ptP1 ;
|
|
||||||
m_ptP5 = m_ptP1 ;
|
m_ptP5 = m_ptP1 ;
|
||||||
m_ptP2 = m_ptPos ;
|
m_ptP2 = m_ptPos ;
|
||||||
m_ptP4 = m_ptPos ;
|
|
||||||
m_ptP6 = m_ptPos ;
|
|
||||||
|
|
||||||
// verifico che i punti di misura non siano coincidenti
|
// verifico che i punti di misura non siano coincidenti
|
||||||
if ( AreSamePointApprox( m_ptP5, m_ptPos))
|
if ( AreSamePointApprox( m_ptP6, m_ptPos))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// assegnazione del testo
|
// assegnazione del testo
|
||||||
m_sText = sText ;
|
m_sText = sText ;
|
||||||
// assegno il tipo
|
// assegno il tipo
|
||||||
@@ -175,7 +171,7 @@ ExtDimension::SetRadial( const Point3d& ptCen, const Point3d& ptPos,
|
|||||||
bool
|
bool
|
||||||
ExtDimension::SetDiametral( const Point3d& ptCen, const Point3d& ptPos,
|
ExtDimension::SetDiametral( const Point3d& ptCen, const Point3d& ptPos,
|
||||||
const Vector3d& vtN, const string& sText)
|
const Vector3d& vtN, const string& sText)
|
||||||
{
|
{ // il punto m_ptP6 viene utilizzato per il centro
|
||||||
// dichiaro quota non ancora determinata
|
// dichiaro quota non ancora determinata
|
||||||
m_nType = DT_NONE ;
|
m_nType = DT_NONE ;
|
||||||
// verifico la definizione del versore normale e del versore X
|
// verifico la definizione del versore normale e del versore X
|
||||||
@@ -183,21 +179,16 @@ ExtDimension::SetDiametral( const Point3d& ptCen, const Point3d& ptPos,
|
|||||||
m_vtDir = ptPos - ptCen ;
|
m_vtDir = ptPos - ptCen ;
|
||||||
if ( ! m_vtN.Normalize() || ! m_vtDir.Normalize())
|
if ( ! m_vtN.Normalize() || ! m_vtDir.Normalize())
|
||||||
return false ;
|
return false ;
|
||||||
|
// porto i punti nel piano definito da ptP6 e vtN
|
||||||
// porto i punti nel piano definito da ptP1 e vtN
|
m_ptP6 = ptCen ;
|
||||||
m_ptPos = ptPos - ( ptPos - ptCen) * m_vtN * m_vtN ;
|
m_ptPos = ptPos - ( ptPos - m_ptP6) * m_vtN * m_vtN ;
|
||||||
m_ptP2 = m_ptPos ;
|
m_ptP2 = m_ptPos ;
|
||||||
m_ptP6 = m_ptPos ;
|
|
||||||
m_ptP4 = m_ptPos ;
|
|
||||||
// ottengo il punto diametralmente opposto a ptPos
|
// ottengo il punto diametralmente opposto a ptPos
|
||||||
m_ptP1 = ptCen - ( m_ptPos - ptCen) ;
|
m_ptP1 = ptCen - ( m_ptPos - ptCen) ;
|
||||||
m_ptP5 = m_ptP1 ;
|
m_ptP5 = m_ptP1 ;
|
||||||
m_ptP3 = m_ptP1 ;
|
|
||||||
|
|
||||||
// verifico che i punti di misura non siano coincidenti
|
// verifico che i punti di misura non siano coincidenti
|
||||||
if ( AreSamePointApprox( m_ptP5, m_ptPos))
|
if ( AreSamePointApprox( m_ptP5, m_ptPos))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// assegnazione del testo
|
// assegnazione del testo
|
||||||
m_sText = sText ;
|
m_sText = sText ;
|
||||||
// assegno il tipo
|
// assegno il tipo
|
||||||
@@ -211,7 +202,7 @@ ExtDimension::SetDiametral( const Point3d& ptCen, const Point3d& ptPos,
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExtDimension::SetAngular( const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptV, const Point3d& ptPos,
|
ExtDimension::SetAngular( const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptPos,
|
||||||
const Vector3d& vtN, const string& sText)
|
const Vector3d& vtN, const string& sText)
|
||||||
{
|
{
|
||||||
// dichiaro quota non ancora determinata
|
// dichiaro quota non ancora determinata
|
||||||
@@ -220,35 +211,27 @@ ExtDimension::SetAngular( const Point3d& ptP1, const Point3d& ptP2, const Point3
|
|||||||
m_vtN = vtN ;
|
m_vtN = vtN ;
|
||||||
if ( ! m_vtN.Normalize())
|
if ( ! m_vtN.Normalize())
|
||||||
return false ;
|
return false ;
|
||||||
// porto i punti nel piano definito da P1 e N
|
// porto i punti e le direzioni nel piano definito da V e N
|
||||||
m_ptP1 = ptP1 ;
|
m_ptP6 = ptV ;
|
||||||
m_ptP2 = ptP2 - ( ptP2 - m_ptP1) * m_vtN * m_vtN ;
|
m_ptPos = ptPos - ( ptPos - m_ptP6) * m_vtN * m_vtN ;
|
||||||
m_ptP5 = ptV - ( ptV - m_ptP1) * m_vtN * m_vtN ;
|
m_vtDir = m_ptPos - m_ptP6 ;
|
||||||
m_ptPos = ptPos - ( ptPos - m_ptP1) * m_vtN * m_vtN ;
|
|
||||||
// verifico che i punti di misura non siano coincidenti
|
|
||||||
if ( AreSamePointApprox( m_ptP1, m_ptP2) || AreSamePointApprox( m_ptP1, m_ptP5) || AreSamePointApprox( m_ptP2, m_ptP5))
|
|
||||||
return false ;
|
|
||||||
// calcolo le direzioni su cui giacciono i due lati dell'angolo
|
|
||||||
Vector3d vtLine1 = m_ptP1 - m_ptP5 ;
|
|
||||||
Vector3d vtLine2 = m_ptP2 - m_ptP5 ;
|
|
||||||
double dLen1 = vtLine1.Len() ;
|
|
||||||
double dLen2 = vtLine2.Len() ;
|
|
||||||
if ( ! vtLine1.Normalize() || ! vtLine2.Normalize())
|
|
||||||
return false ;
|
|
||||||
// direzione di riferimento (nel piano perpendicolare a vtN)
|
|
||||||
m_vtDir = m_ptPos - m_ptP5 ;
|
|
||||||
double dLenDir = m_vtDir.Len() ;
|
double dLenDir = m_vtDir.Len() ;
|
||||||
|
Vector3d vtLine1 = OrthoCompo( ptP1 - m_ptP6, m_vtN) ;
|
||||||
|
Vector3d vtLine2 = OrthoCompo( ptP2 - m_ptP6, m_vtN) ;
|
||||||
|
// verifico che i punti di misura non siano coincidenti
|
||||||
|
if ( ! vtLine1.Normalize() || ! vtLine2.Normalize() || dLenDir < EPS_SMALL)
|
||||||
|
return false ;
|
||||||
|
|
||||||
// controllo se è testo o se è la misura
|
// controllo se è testo o se è la misura
|
||||||
double dHalfDist ;
|
|
||||||
double dFactor ;
|
double dFactor ;
|
||||||
if ( m_sCalcText.find( IS_MEASURE) != string::npos) {
|
if ( m_sCalcText.find( IS_MEASURE) != string::npos) {
|
||||||
dHalfDist = GetTextHalfDist( m_ptPos) ;
|
m_sCalcText = "300.00" ;
|
||||||
|
double dHalfDist = GetTextHalfDist( m_ptPos) ;
|
||||||
dFactor = 2.5 * dHalfDist ;
|
dFactor = 2.5 * dHalfDist ;
|
||||||
m_sCalcText = "" ;
|
m_sCalcText = "" ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dHalfDist = GetTextHalfDist( m_ptPos) ;
|
double dHalfDist = GetTextHalfDist( m_ptPos) ;
|
||||||
dFactor = 2.5 * dHalfDist ;
|
dFactor = 2.5 * dHalfDist ;
|
||||||
}
|
}
|
||||||
// allungo m_vtDir se è troppo vicino al centro
|
// allungo m_vtDir se è troppo vicino al centro
|
||||||
@@ -256,23 +239,17 @@ ExtDimension::SetAngular( const Point3d& ptP1, const Point3d& ptP2, const Point3
|
|||||||
Vector3d vtDir_n = m_vtDir ;
|
Vector3d vtDir_n = m_vtDir ;
|
||||||
if ( ! vtDir_n.Normalize())
|
if ( ! vtDir_n.Normalize())
|
||||||
return false ;
|
return false ;
|
||||||
m_ptPos = m_ptP5 + dFactor * vtDir_n ;
|
m_ptPos = m_ptP6 + dFactor * vtDir_n ;
|
||||||
// ricalcolo m_vtDir
|
// ricalcolo m_vtDir
|
||||||
m_vtDir = m_ptPos - m_ptP5 ;
|
m_vtDir = m_ptPos - m_ptP6 ;
|
||||||
dLenDir = m_vtDir.Len() ;
|
dLenDir = m_vtDir.Len() ;
|
||||||
}
|
}
|
||||||
|
// assegno gli altri punti notevoli della quotatura
|
||||||
// segnalo se i punti che definiscono i lati sono più lontani dal centro di ptPos
|
m_ptP1 = m_ptP6 ;
|
||||||
bool bPt1Close = false ;
|
m_ptP2 = m_ptP6 ;
|
||||||
bool bPt2Close = false ;
|
m_ptP5 = m_ptP6 + vtLine1 * dLenDir ;
|
||||||
if ( dLenDir < dLen1)
|
m_ptP3 = m_ptP6 + vtLine1 * ( dLenDir + m_dExtLineLen) ;
|
||||||
bPt1Close = true ;
|
m_ptP4 = m_ptP6 + vtLine2 * ( dLenDir + m_dExtLineLen) ;
|
||||||
if ( dLenDir < dLen2)
|
|
||||||
bPt2Close = true ;
|
|
||||||
m_ptP5 = m_ptP1 + ( dLenDir - dLen1) * vtLine1 ;
|
|
||||||
m_ptP6 = m_ptP2 + ( dLenDir - dLen2) * vtLine2 ;
|
|
||||||
m_ptP3 = m_ptP5 + ( bPt1Close ? - vtLine1 : vtLine1) * m_dExtLineLen ;
|
|
||||||
m_ptP4 = m_ptP6 + ( bPt2Close ? - vtLine2 : vtLine2) * m_dExtLineLen ;
|
|
||||||
|
|
||||||
// assegnazione del testo
|
// assegnazione del testo
|
||||||
m_sText = sText ;
|
m_sText = sText ;
|
||||||
@@ -282,7 +259,99 @@ ExtDimension::SetAngular( const Point3d& ptP1, const Point3d& ptP2, const Point3
|
|||||||
m_bToCalc = true ;
|
m_bToCalc = true ;
|
||||||
m_OGrMgr.Reset() ;
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
return true;
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
ExtDimension::SetAngularEx( const Point3d& ptV1, const Point3d& ptP1,
|
||||||
|
const Point3d& ptV2, const Point3d& ptP2, const Point3d& ptPos,
|
||||||
|
const Vector3d& vtN, const string& sText)
|
||||||
|
{
|
||||||
|
// dichiaro quota non ancora determinata
|
||||||
|
m_nType = DT_NONE ;
|
||||||
|
// verifico la definizione del versore normale
|
||||||
|
m_vtN = vtN ;
|
||||||
|
if ( ! m_vtN.Normalize())
|
||||||
|
return false ;
|
||||||
|
// calcolo l'intersezione tra le due linee
|
||||||
|
CurveLine Line1 ;
|
||||||
|
if ( ! Line1.Set( ptV1, ptP1) || ! Line1.SetExtrusion( m_vtN))
|
||||||
|
return false ;
|
||||||
|
CurveLine Line2 ;
|
||||||
|
if ( ! Line2.Set( ptV2, ptP2) || ! Line2.SetExtrusion( m_vtN))
|
||||||
|
return false ;
|
||||||
|
IntersLineLine IntLL( Line1, Line2, false) ;
|
||||||
|
IntCrvCrvInfo Info ;
|
||||||
|
if ( ! IntLL.GetIntCrvCrvInfo( Info) || Info.bOverlap)
|
||||||
|
return false ;
|
||||||
|
Point3d ptV = Media( Info.IciA[0].ptI, Info.IciB[0].ptI) ;
|
||||||
|
// porto i punti e le direzioni nel piano definito da V1 e N
|
||||||
|
m_ptP6 = ptV ;
|
||||||
|
m_ptPos = ptPos - ( ptPos - m_ptP6) * m_vtN * m_vtN ;
|
||||||
|
m_vtDir = m_ptPos - m_ptP6 ;
|
||||||
|
double dLenDir = m_vtDir.Len() ;
|
||||||
|
Vector3d vtLine1 = OrthoCompo( ptP1 - m_ptP6, m_vtN) ;
|
||||||
|
Vector3d vtLine2 = OrthoCompo( ptP2 - m_ptP6, m_vtN) ;
|
||||||
|
// verifico che i punti di misura non siano coincidenti
|
||||||
|
if ( ! vtLine1.Normalize() || ! vtLine2.Normalize() || dLenDir < EPS_SMALL)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
// controllo se è testo o se è la misura
|
||||||
|
double dFactor ;
|
||||||
|
if ( m_sCalcText.find( IS_MEASURE) != string::npos) {
|
||||||
|
m_sCalcText = "300.00" ;
|
||||||
|
double dHalfDist = GetTextHalfDist( m_ptPos) ;
|
||||||
|
dFactor = 2.5 * dHalfDist ;
|
||||||
|
m_sCalcText = "" ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
double dHalfDist = GetTextHalfDist( m_ptPos) ;
|
||||||
|
dFactor = 2.5 * dHalfDist ;
|
||||||
|
}
|
||||||
|
// allungo m_vtDir se è troppo vicino al centro
|
||||||
|
if ( m_vtDir.Len() < dFactor) {
|
||||||
|
Vector3d vtDir_n = m_vtDir ;
|
||||||
|
if ( ! vtDir_n.Normalize())
|
||||||
|
return false ;
|
||||||
|
m_ptPos = m_ptP6 + dFactor * vtDir_n ;
|
||||||
|
// ricalcolo m_vtDir
|
||||||
|
m_vtDir = m_ptPos - m_ptP6 ;
|
||||||
|
dLenDir = m_vtDir.Len() ;
|
||||||
|
}
|
||||||
|
// assegno gli altri punti notevoli della quotatura
|
||||||
|
// se i ptV concidono con l'intersezione tra le linee le sposto leggermente verso l'altro punto di quel lato
|
||||||
|
Point3d ptV1New = ptV1 ;
|
||||||
|
Point3d ptV2New = ptV2 ;
|
||||||
|
if ( AreSamePointApprox( ptV1, ptV)) {
|
||||||
|
Vector3d vtDir1 ; Line1.GetStartDir( vtDir1) ;
|
||||||
|
double dLen ; Line1.GetLength( dLen) ;
|
||||||
|
dLen = max( min( 1., dLen/ 10), 0.01) ;
|
||||||
|
ptV1New = ptV1 + vtDir1 * dLen ;
|
||||||
|
}
|
||||||
|
if ( AreSamePointApprox( ptV2, ptV)) {
|
||||||
|
Vector3d vtDir2 ; Line2.GetStartDir( vtDir2) ;
|
||||||
|
double dLen ; Line2.GetLength( dLen) ;
|
||||||
|
dLen = max( min( 1., dLen/ 10), 0.01) ;
|
||||||
|
ptV2New = ptV2 + vtDir2 * dLen ;
|
||||||
|
}
|
||||||
|
m_ptP1 = ptV1New - ( ptV1New - m_ptP6) * m_vtN * m_vtN ;
|
||||||
|
m_ptP2 = ptV2New - ( ptV2New - m_ptP6) * m_vtN * m_vtN ;
|
||||||
|
m_ptP5 = m_ptP6 + vtLine1 * dLenDir ;
|
||||||
|
double dLen1 = Dist( m_ptP6, m_ptP1) ;
|
||||||
|
m_ptP3 = m_ptP6 + vtLine1 * ( dLenDir + m_dExtLineLen * ( dLen1 < dLenDir ? 1 : -1)) ;
|
||||||
|
double dLen2 = Dist( m_ptP6, m_ptP2) ;
|
||||||
|
m_ptP4 = m_ptP6 + vtLine2 * ( dLenDir + m_dExtLineLen * ( dLen2 < dLenDir ? 1 : -1)) ;
|
||||||
|
|
||||||
|
// assegnazione del testo
|
||||||
|
m_sText = sText ;
|
||||||
|
// assegno il tipo
|
||||||
|
m_nType = DT_ANGULAR ;
|
||||||
|
// imposto da calcolare
|
||||||
|
m_bToCalc = true ;
|
||||||
|
m_OGrMgr.Reset() ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -333,6 +402,7 @@ ExtDimension::CopyFrom( const ExtDimension& clSrc)
|
|||||||
m_sCalcText = clSrc.m_sCalcText ;
|
m_sCalcText = clSrc.m_sCalcText ;
|
||||||
m_ptCalcPos = clSrc.m_ptCalcPos ;
|
m_ptCalcPos = clSrc.m_ptCalcPos ;
|
||||||
m_bCalcArrowIn = clSrc.m_bCalcArrowIn ;
|
m_bCalcArrowIn = clSrc.m_bCalcArrowIn ;
|
||||||
|
m_bCalcTextOn = clSrc.m_bCalcTextOn ;
|
||||||
m_ptCalcP7 = clSrc.m_ptCalcP7 ;
|
m_ptCalcP7 = clSrc.m_ptCalcP7 ;
|
||||||
m_ptCalcP8 = clSrc.m_ptCalcP8 ;
|
m_ptCalcP8 = clSrc.m_ptCalcP8 ;
|
||||||
m_dExtLineLen = clSrc.m_dExtLineLen ;
|
m_dExtLineLen = clSrc.m_dExtLineLen ;
|
||||||
@@ -344,6 +414,8 @@ ExtDimension::CopyFrom( const ExtDimension& clSrc)
|
|||||||
m_dTextHeight = clSrc.m_dTextHeight ;
|
m_dTextHeight = clSrc.m_dTextHeight ;
|
||||||
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
|
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
|
||||||
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
|
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
|
||||||
|
m_dTempParam[0] = clSrc.m_dTempParam[0] ;
|
||||||
|
m_dTempParam[1] = clSrc.m_dTempParam[1] ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,15 +451,15 @@ ExtDimension::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
|||||||
{
|
{
|
||||||
// parametri
|
// parametri
|
||||||
sOut += GetSubType() + szNewLine ;
|
sOut += GetSubType() + szNewLine ;
|
||||||
sOut += "VN(" + ToString( m_vtN, 3) + ") " + szNewLine ;
|
sOut += "VN( " + ToString( m_vtN, 3) + ") " + szNewLine ;
|
||||||
sOut += "VD(" + ToString( m_vtDir, 3) + ") " + szNewLine ;
|
sOut += "VD( " + ToString( m_vtDir, 3) + ") " + szNewLine ;
|
||||||
sOut += "P1(" + ToString( GetInUiUnits( m_ptP1, bMM), 3) + ") " + szNewLine ;
|
sOut += "P1( " + ToString( GetInUiUnits( m_ptP1, bMM), 3) + ") " + szNewLine ;
|
||||||
sOut += "P2(" + ToString( GetInUiUnits( m_ptP2, bMM), 3) + ") " + szNewLine ;
|
sOut += "P2( " + ToString( GetInUiUnits( m_ptP2, bMM), 3) + ") " + szNewLine ;
|
||||||
sOut += "P3(" + ToString( GetInUiUnits( m_ptP3, bMM), 3) + ") " + szNewLine ;
|
sOut += "P3( " + ToString( GetInUiUnits( m_ptP3, bMM), 3) + ") " + szNewLine ;
|
||||||
sOut += "P4(" + ToString( GetInUiUnits( m_ptP4, bMM), 3) + ") " + szNewLine ;
|
sOut += "P4( " + ToString( GetInUiUnits( m_ptP4, bMM), 3) + ") " + szNewLine ;
|
||||||
sOut += "P5(" + ToString( GetInUiUnits( m_ptP5, bMM), 3) + ") " + szNewLine ;
|
sOut += "P5( " + ToString( GetInUiUnits( m_ptP5, bMM), 3) + ") " + szNewLine ;
|
||||||
sOut += "P6(" + ToString( GetInUiUnits( m_ptP6, bMM), 3) + ") " + szNewLine ;
|
sOut += "P6( " + ToString( GetInUiUnits( m_ptP6, bMM), 3) + ") " + szNewLine ;
|
||||||
sOut += "Pos(" + ToString( GetInUiUnits( m_ptPos, bMM), 3) + ") " + szNewLine ;
|
sOut += "Pos( " + ToString( GetInUiUnits( m_ptPos, bMM), 3) + ") " + szNewLine ;
|
||||||
sOut += "Txt=" + m_sText + szNewLine ;
|
sOut += "Txt=" + m_sText + szNewLine ;
|
||||||
sOut += "El=" + ToString( GetInUiUnits( m_dExtLineLen, bMM), 3) +
|
sOut += "El=" + ToString( GetInUiUnits( m_dExtLineLen, bMM), 3) +
|
||||||
" Al=" + ToString( GetInUiUnits( m_dArrowLen, bMM), 3) +
|
" Al=" + ToString( GetInUiUnits( m_dArrowLen, bMM), 3) +
|
||||||
@@ -528,7 +600,7 @@ ExtDimension::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
else if ( m_nType == DT_RADIAL) {
|
else if ( m_nType == DT_RADIAL) {
|
||||||
b3Loc.Set( m_ptP5) ;
|
b3Loc.Set( m_ptP6) ;
|
||||||
b3Loc.Add( m_ptPos) ;
|
b3Loc.Add( m_ptPos) ;
|
||||||
// ingombro del testo
|
// ingombro del testo
|
||||||
BBox3d b3Text ;
|
BBox3d b3Text ;
|
||||||
@@ -537,7 +609,7 @@ ExtDimension::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
else if ( m_nType == DT_DIAMETRAL) {
|
else if ( m_nType == DT_DIAMETRAL) {
|
||||||
b3Loc.Set( m_ptP5) ;
|
b3Loc.Set( m_ptP6) ;
|
||||||
b3Loc.Add( m_ptPos) ;
|
b3Loc.Add( m_ptPos) ;
|
||||||
// ingombro del testo
|
// ingombro del testo
|
||||||
BBox3d b3Text ;
|
BBox3d b3Text ;
|
||||||
@@ -551,6 +623,7 @@ ExtDimension::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
|
|||||||
b3Loc.Add( m_ptP3) ;
|
b3Loc.Add( m_ptP3) ;
|
||||||
b3Loc.Add( m_ptP4) ;
|
b3Loc.Add( m_ptP4) ;
|
||||||
b3Loc.Set( m_ptP5) ;
|
b3Loc.Set( m_ptP5) ;
|
||||||
|
b3Loc.Set( m_ptP6) ;
|
||||||
b3Loc.Add( m_ptCalcP7) ;
|
b3Loc.Add( m_ptCalcP7) ;
|
||||||
b3Loc.Add( m_ptCalcP8) ;
|
b3Loc.Add( m_ptCalcP8) ;
|
||||||
// ingombro del testo
|
// ingombro del testo
|
||||||
@@ -574,7 +647,7 @@ ExtDimension::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
|||||||
Update() ;
|
Update() ;
|
||||||
// se valido
|
// se valido
|
||||||
if ( m_nType == DT_LINEAR) {
|
if ( m_nType == DT_LINEAR) {
|
||||||
// ingombro dei punti (portati nel riferimento passato)
|
// ingombro dei punti ( portati nel riferimento passato)
|
||||||
Point3d ptFrP1 = m_ptP1 ;
|
Point3d ptFrP1 = m_ptP1 ;
|
||||||
ptFrP1.ToGlob( frRef) ;
|
ptFrP1.ToGlob( frRef) ;
|
||||||
b3Ref.Set( ptFrP1) ;
|
b3Ref.Set( ptFrP1) ;
|
||||||
@@ -600,8 +673,8 @@ ExtDimension::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
else if ( m_nType == DT_RADIAL) {
|
else if ( m_nType == DT_RADIAL) {
|
||||||
// ingombro dei punti (portati nel riferimento passato)
|
// ingombro dei punti ( portati nel riferimento passato)
|
||||||
Point3d ptFrP5 = m_ptP5 ;
|
Point3d ptFrP5 = m_ptP6 ;
|
||||||
ptFrP5.ToGlob( frRef) ;
|
ptFrP5.ToGlob( frRef) ;
|
||||||
b3Ref.Set( ptFrP5) ;
|
b3Ref.Set( ptFrP5) ;
|
||||||
Point3d ptFrPos = m_ptPos ;
|
Point3d ptFrPos = m_ptPos ;
|
||||||
@@ -614,8 +687,8 @@ ExtDimension::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
else if ( m_nType == DT_DIAMETRAL) {
|
else if ( m_nType == DT_DIAMETRAL) {
|
||||||
// ingombro dei punti (portati nel riferimento passato)
|
// ingombro dei punti ( portati nel riferimento passato)
|
||||||
Point3d ptFrP5 = m_ptP5 ;
|
Point3d ptFrP5 = m_ptP6 ;
|
||||||
ptFrP5.ToGlob( frRef) ;
|
ptFrP5.ToGlob( frRef) ;
|
||||||
b3Ref.Set( ptFrP5) ;
|
b3Ref.Set( ptFrP5) ;
|
||||||
Point3d ptFrPos = m_ptPos ;
|
Point3d ptFrPos = m_ptPos ;
|
||||||
@@ -628,9 +701,6 @@ ExtDimension::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
else if ( m_nType == DT_ANGULAR) {
|
else if ( m_nType == DT_ANGULAR) {
|
||||||
Point3d ptFrP5 = m_ptP5 ;
|
|
||||||
ptFrP5.ToGlob( frRef) ;
|
|
||||||
b3Ref.Set( ptFrP5) ;
|
|
||||||
Point3d ptFrP1 = m_ptP1 ;
|
Point3d ptFrP1 = m_ptP1 ;
|
||||||
ptFrP1.ToGlob( frRef) ;
|
ptFrP1.ToGlob( frRef) ;
|
||||||
b3Ref.Add( ptFrP1) ;
|
b3Ref.Add( ptFrP1) ;
|
||||||
@@ -643,6 +713,12 @@ ExtDimension::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
|||||||
Point3d ptFrP4 = m_ptP4 ;
|
Point3d ptFrP4 = m_ptP4 ;
|
||||||
ptFrP4.ToGlob( frRef) ;
|
ptFrP4.ToGlob( frRef) ;
|
||||||
b3Ref.Add( ptFrP4) ;
|
b3Ref.Add( ptFrP4) ;
|
||||||
|
Point3d ptFrP5 = m_ptP5 ;
|
||||||
|
ptFrP5.ToGlob( frRef) ;
|
||||||
|
b3Ref.Set( ptFrP5) ;
|
||||||
|
Point3d ptFrP6 = m_ptP6 ;
|
||||||
|
ptFrP6.ToGlob( frRef) ;
|
||||||
|
b3Ref.Set( ptFrP6) ;
|
||||||
Point3d ptFrP7 = m_ptCalcP7 ;
|
Point3d ptFrP7 = m_ptCalcP7 ;
|
||||||
ptFrP7.ToGlob( frRef) ;
|
ptFrP7.ToGlob( frRef) ;
|
||||||
b3Ref.Add( ptFrP7) ;
|
b3Ref.Add( ptFrP7) ;
|
||||||
@@ -738,6 +814,8 @@ ExtDimension::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, doubl
|
|||||||
return false ;
|
return false ;
|
||||||
if ( ! m_ptP2.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ))
|
if ( ! m_ptP2.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ))
|
||||||
return false ;
|
return false ;
|
||||||
|
if ( ! m_ptP6.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ))
|
||||||
|
return false ;
|
||||||
if ( ! m_ptPos.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ))
|
if ( ! m_ptPos.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ))
|
||||||
return false ;
|
return false ;
|
||||||
// ricalcolo completamente la quota
|
// ricalcolo completamente la quota
|
||||||
@@ -745,11 +823,11 @@ ExtDimension::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, doubl
|
|||||||
case DT_LINEAR :
|
case DT_LINEAR :
|
||||||
return SetLinear( m_ptP1, m_ptP2, m_ptPos, m_vtN, m_vtDir, m_sText) ;
|
return SetLinear( m_ptP1, m_ptP2, m_ptPos, m_vtN, m_vtDir, m_sText) ;
|
||||||
case DT_RADIAL :
|
case DT_RADIAL :
|
||||||
return SetRadial( m_ptP5, m_ptPos, m_vtN, m_sText) ;
|
return SetRadial( m_ptP6, m_ptPos, m_vtN, m_sText) ;
|
||||||
case DT_DIAMETRAL :
|
case DT_DIAMETRAL :
|
||||||
return SetDiametral( m_ptP5, m_ptPos, m_vtN, m_sText) ;
|
return SetDiametral( m_ptP6, m_ptPos, m_vtN, m_sText) ;
|
||||||
case DT_ANGULAR :
|
case DT_ANGULAR :
|
||||||
return SetAngular( m_ptP5, m_ptP1, m_ptP2, m_ptPos, m_vtN, m_sText) ;
|
return SetAngular( m_ptP1, m_ptP6, m_ptP2, m_ptPos, m_vtN, m_sText) ;
|
||||||
default :
|
default :
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -826,6 +904,8 @@ ExtDimension::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d
|
|||||||
return false ;
|
return false ;
|
||||||
if ( ! m_ptP2.Shear( ptOn, vtNorm, vtDir, dCoeff))
|
if ( ! m_ptP2.Shear( ptOn, vtNorm, vtDir, dCoeff))
|
||||||
return false ;
|
return false ;
|
||||||
|
if ( ! m_ptP6.Shear( ptOn, vtNorm, vtDir, dCoeff))
|
||||||
|
return false ;
|
||||||
if ( ! m_ptPos.Shear( ptOn, vtNorm, vtDir, dCoeff))
|
if ( ! m_ptPos.Shear( ptOn, vtNorm, vtDir, dCoeff))
|
||||||
return false ;
|
return false ;
|
||||||
// ricalcolo completamente la quota
|
// ricalcolo completamente la quota
|
||||||
@@ -833,11 +913,11 @@ ExtDimension::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d
|
|||||||
case DT_LINEAR :
|
case DT_LINEAR :
|
||||||
return SetLinear( m_ptP1, m_ptP2, m_ptPos, m_vtN, m_vtDir, m_sText) ;
|
return SetLinear( m_ptP1, m_ptP2, m_ptPos, m_vtN, m_vtDir, m_sText) ;
|
||||||
case DT_RADIAL :
|
case DT_RADIAL :
|
||||||
return SetRadial( m_ptP5, m_ptPos, m_vtN, m_sText) ;
|
return SetRadial( m_ptP6, m_ptPos, m_vtN, m_sText) ;
|
||||||
case DT_DIAMETRAL :
|
case DT_DIAMETRAL :
|
||||||
return SetDiametral( m_ptP5, m_ptPos, m_vtN, m_sText) ;
|
return SetDiametral( m_ptP6, m_ptPos, m_vtN, m_sText) ;
|
||||||
case DT_ANGULAR :
|
case DT_ANGULAR :
|
||||||
return SetAngular( m_ptP5, m_ptP1, m_ptP2, m_ptPos, m_vtN, m_sText) ;
|
return SetAngular( m_ptP1, m_ptP6, m_ptP2, m_ptPos, m_vtN, m_sText) ;
|
||||||
default :
|
default :
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -1011,21 +1091,28 @@ ExtDimension::Update( void) const
|
|||||||
ReplaceString( m_sCalcText, IS_MEASURE, sVal) ;
|
ReplaceString( m_sCalcText, IS_MEASURE, sVal) ;
|
||||||
}
|
}
|
||||||
// punto di inserimento del testo
|
// punto di inserimento del testo
|
||||||
m_ptCalcPos = ( m_ptP5 + m_ptP6) / 2 ;
|
m_ptCalcPos = ( m_ptP5 + m_ptP2) / 2 ;
|
||||||
// alzo il testo dalla linea di misura
|
// alzo il testo dalla linea di misura
|
||||||
BBox3d b3Text ;
|
BBox3d b3Text ;
|
||||||
if ( ! GetTextMyBBox( b3Text) && ! b3Text.IsEmpty())
|
if ( ! GetTextMyBBox( b3Text) && ! b3Text.IsEmpty())
|
||||||
return false ;
|
return false ;
|
||||||
double dHeight = b3Text.GetMax().y - b3Text.GetMin().y ;
|
double dHeight = b3Text.GetMax().y - b3Text.GetMin().y ;
|
||||||
Vector3d vtPerpDir = m_ptPos - m_ptP5 ;
|
double dLength = b3Text.GetMax().x - b3Text.GetMin().x ;
|
||||||
vtPerpDir.Normalize() ;
|
Vector3d vtPerpDir = m_ptPos - m_ptP6 ;
|
||||||
if ( ! vtPerpDir.Rotate( m_vtN, 90))
|
if ( ! vtPerpDir.Normalize())
|
||||||
|
return false ;
|
||||||
|
// calcolo il frame dell'arco per valutare la posizione del testo
|
||||||
|
Frame3d frRef ;
|
||||||
|
if ( ! frRef.Set( m_ptP6, m_vtN))
|
||||||
|
return false ;
|
||||||
|
double dAngDeg = 0 ;
|
||||||
|
if ( ! m_vtDir.GetAngle( frRef.VersX(), dAngDeg) || ! vtPerpDir.Rotate( m_vtN, ( dAngDeg < 90 ? 90 : -90)))
|
||||||
return false ;
|
return false ;
|
||||||
m_ptCalcPos = m_ptCalcPos + 0.6 * dHeight * vtPerpDir ;
|
m_ptCalcPos = m_ptCalcPos + 0.6 * dHeight * vtPerpDir ;
|
||||||
// semidistanza di interruzione
|
// semidistanza di interruzione
|
||||||
double dHalfDist = GetTextHalfDist( m_ptCalcPos) ;
|
double dHalfDist = GetTextHalfDist( m_ptCalcPos, false) ;
|
||||||
// lunghezza della linea di misura
|
// lunghezza della linea di misura
|
||||||
double dLen = ( m_ptP6 - m_ptP5).Len() ;
|
double dLen = Dist( m_ptP1, m_ptP2) ;
|
||||||
// determino come orientare le frecce e dove mettere il testo
|
// determino come orientare le frecce e dove mettere il testo
|
||||||
if ( dLen - 2 * m_dArrowLen >= 2 * dHalfDist) {
|
if ( dLen - 2 * m_dArrowLen >= 2 * dHalfDist) {
|
||||||
m_bCalcArrowIn = true ;
|
m_bCalcArrowIn = true ;
|
||||||
@@ -1038,7 +1125,7 @@ ExtDimension::Update( void) const
|
|||||||
m_bCalcArrowIn = false ;
|
m_bCalcArrowIn = false ;
|
||||||
m_bCalcTextOn = true ;
|
m_bCalcTextOn = true ;
|
||||||
m_ptCalcP7 = m_ptP5 - m_vtDir * 2 * m_dArrowLen ;
|
m_ptCalcP7 = m_ptP5 - m_vtDir * 2 * m_dArrowLen ;
|
||||||
m_ptCalcP8 = m_ptP6 + m_vtDir * 2 * m_dArrowLen ;
|
m_ptCalcP8 = m_ptP2 + m_vtDir * 2 * m_dArrowLen ;
|
||||||
}
|
}
|
||||||
// stanno fuori sia le frecce sia il testo
|
// stanno fuori sia le frecce sia il testo
|
||||||
else {
|
else {
|
||||||
@@ -1046,8 +1133,18 @@ ExtDimension::Update( void) const
|
|||||||
m_bCalcTextOn = false ;
|
m_bCalcTextOn = false ;
|
||||||
// metto la quotatura dal lato di ptPos
|
// metto la quotatura dal lato di ptPos
|
||||||
Vector3d vtRad = m_ptPos - m_ptP5 ;
|
Vector3d vtRad = m_ptPos - m_ptP5 ;
|
||||||
vtRad.Normalize() ;
|
if ( ! vtRad.Normalize())
|
||||||
m_ptCalcPos = m_ptPos + vtRad * ( dHalfDist + 2 * m_dArrowLen) ;
|
return false ;
|
||||||
|
m_ptCalcPos = m_ptPos + vtRad * ( 2 * m_dArrowLen + m_dTextDist) ;
|
||||||
|
const double COMP_LIM = 0.1 ; // circa 5.7deg
|
||||||
|
if ( vtRad.x > COMP_LIM)
|
||||||
|
m_ptCalcPos += dLength / 2 * X_AX ;
|
||||||
|
else if ( vtRad.x < -COMP_LIM)
|
||||||
|
m_ptCalcPos -= dLength / 2 * X_AX ;
|
||||||
|
if ( vtRad.y > COMP_LIM)
|
||||||
|
m_ptCalcPos += dHeight / 2 * Y_AX ;
|
||||||
|
else if ( vtRad.y < -COMP_LIM)
|
||||||
|
m_ptCalcPos -= dHeight / 2 * Y_AX ;
|
||||||
}
|
}
|
||||||
// dichiaro ricalcolo eseguito
|
// dichiaro ricalcolo eseguito
|
||||||
m_bToCalc = false ;
|
m_bToCalc = false ;
|
||||||
@@ -1056,9 +1153,11 @@ ExtDimension::Update( void) const
|
|||||||
case DT_ANGULAR : {
|
case DT_ANGULAR : {
|
||||||
// angolo
|
// angolo
|
||||||
double dAngDeg, dAngDeg1, dAngDeg2 = 0 ;
|
double dAngDeg, dAngDeg1, dAngDeg2 = 0 ;
|
||||||
Vector3d vtLine1 = m_ptP1 - m_ptP5 ;
|
Vector3d vtLine1 = m_ptP3 - m_ptP6 ;
|
||||||
Vector3d vtLine2 = m_ptP2 - m_ptP5 ;
|
Vector3d vtLine2 = m_ptP4 - m_ptP6 ;
|
||||||
Vector3d vtLine3 = m_ptPos - m_ptP5 ;
|
Vector3d vtLine3 = m_ptPos - m_ptP6 ;
|
||||||
|
// calcolo gli angoli tra m_ptPos e i due punti che identificano i lati dell'angolo
|
||||||
|
// per capire se sto calcolando l'angolo interno o esterno
|
||||||
if ( ! vtLine1.GetAngle( vtLine2, dAngDeg) || ! vtLine1.GetAngle( vtLine3, dAngDeg1) || ! vtLine2.GetAngle( vtLine3, dAngDeg2))
|
if ( ! vtLine1.GetAngle( vtLine2, dAngDeg) || ! vtLine1.GetAngle( vtLine3, dAngDeg1) || ! vtLine2.GetAngle( vtLine3, dAngDeg2))
|
||||||
return false ;
|
return false ;
|
||||||
if ( dAngDeg < dAngDeg1 + dAngDeg2 - EPS_SMALL || dAngDeg > dAngDeg1 + dAngDeg2 + EPS_SMALL)
|
if ( dAngDeg < dAngDeg1 + dAngDeg2 - EPS_SMALL || dAngDeg > dAngDeg1 + dAngDeg2 + EPS_SMALL)
|
||||||
@@ -1066,14 +1165,16 @@ ExtDimension::Update( void) const
|
|||||||
// testo
|
// testo
|
||||||
m_sCalcText = m_sText ;
|
m_sCalcText = m_sText ;
|
||||||
if ( m_sCalcText.find( IS_MEASURE) != string::npos) {
|
if ( m_sCalcText.find( IS_MEASURE) != string::npos) {
|
||||||
// calcolo gli angoli tra m_ptPos e i due punti che identificano i lati dell'angolo
|
|
||||||
// per capire se sto calcolando l'angolo interno o esterno
|
|
||||||
string sAngDeg = ToString( dAngDeg, m_nDecDigit) ;
|
string sAngDeg = ToString( dAngDeg, m_nDecDigit) ;
|
||||||
ReplaceString( m_sCalcText, IS_MEASURE, sAngDeg + "°") ;
|
ReplaceString( m_sCalcText, IS_MEASURE, sAngDeg + "°") ;
|
||||||
}
|
}
|
||||||
|
// calcolo ptP5_bis
|
||||||
|
if ( ! vtLine2.Normalize())
|
||||||
|
return false ;
|
||||||
|
Point3d ptP5_bis = m_ptP6 + m_vtDir.Len() * vtLine2 ;
|
||||||
// calcolo l'arco su cui metterò la misura
|
// calcolo l'arco su cui metterò la misura
|
||||||
PtrOwner<CurveArc> pCrvPos( CreateBasicCurveArc()) ;
|
PtrOwner<CurveArc> pCrvPos( CreateBasicCurveArc()) ;
|
||||||
if ( IsNull( pCrvPos) || ! pCrvPos->Set3P( m_ptP6, m_ptPos, m_ptP5, false))
|
if ( IsNull( pCrvPos) || ! pCrvPos->Set3P( ptP5_bis, m_ptPos, m_ptP5, false))
|
||||||
return false ;
|
return false ;
|
||||||
// punto di inserimento del testo
|
// punto di inserimento del testo
|
||||||
pCrvPos->GetMidPoint( m_ptCalcPos) ;
|
pCrvPos->GetMidPoint( m_ptCalcPos) ;
|
||||||
@@ -1084,15 +1185,14 @@ ExtDimension::Update( void) const
|
|||||||
if ( ! pCrvPos->GetLength( dLen))
|
if ( ! pCrvPos->GetLength( dLen))
|
||||||
return false ;
|
return false ;
|
||||||
// calcolo anche lo spazio ad una distanza dal centro maggiorata
|
// calcolo anche lo spazio ad una distanza dal centro maggiorata
|
||||||
double dLenPos = 0 ;
|
double dDist = Dist( m_ptCalcPos, m_ptP6) ;
|
||||||
double dDist = Dist( m_ptCalcPos, m_ptP5) ;
|
double dLenPos = dDist * dAngDeg * DEGTORAD ;
|
||||||
dLenPos = dDist * dAngDeg * DEGTORAD ;
|
|
||||||
// determino come orientare le frecce e dove mettere il testo
|
// determino come orientare le frecce e dove mettere il testo
|
||||||
double dU ;
|
|
||||||
// frecce e testo dentro
|
// frecce e testo dentro
|
||||||
if ( dLen - 2 * m_dArrowLen >= 2 * dHalfDist) {
|
if ( dLen - 2 * m_dArrowLen >= 2 * dHalfDist) {
|
||||||
m_bCalcArrowIn = true ;
|
m_bCalcArrowIn = true ;
|
||||||
m_bCalcTextOn = true ;
|
m_bCalcTextOn = true ;
|
||||||
|
double dU ;
|
||||||
pCrvPos->GetParamAtLength( dLen / 2. + dHalfDist, dU) ;
|
pCrvPos->GetParamAtLength( dLen / 2. + dHalfDist, dU) ;
|
||||||
pCrvPos->GetPointD1D2( dU, ICurve::FROM_MINUS, m_ptCalcP7) ;
|
pCrvPos->GetPointD1D2( dU, ICurve::FROM_MINUS, m_ptCalcP7) ;
|
||||||
pCrvPos->GetParamAtLength( dLen / 2. - dHalfDist, dU) ;
|
pCrvPos->GetParamAtLength( dLen / 2. - dHalfDist, dU) ;
|
||||||
@@ -1103,12 +1203,11 @@ ExtDimension::Update( void) const
|
|||||||
else if ( dLen > 2 * dHalfDist || ( dLen < 2 * dHalfDist && dLenPos > 2 * dHalfDist)) {
|
else if ( dLen > 2 * dHalfDist || ( dLen < 2 * dHalfDist && dLenPos > 2 * dHalfDist)) {
|
||||||
m_bCalcArrowIn = false ;
|
m_bCalcArrowIn = false ;
|
||||||
m_bCalcTextOn = true ;
|
m_bCalcTextOn = true ;
|
||||||
|
double dU ;
|
||||||
pCrvPos->GetParamAtLength( dLen / 2. + dHalfDist, dU) ;
|
pCrvPos->GetParamAtLength( dLen / 2. + dHalfDist, dU) ;
|
||||||
pCrvPos->GetPointD1D2( dU, ICurve::FROM_MINUS, m_ptCalcP7) ;
|
pCrvPos->GetPointD1D2( dU, ICurve::FROM_MINUS, m_ptCalcP7) ;
|
||||||
pCrvPos->GetParamAtLength( dLen / 2. - dHalfDist, dU) ;
|
pCrvPos->GetParamAtLength( dLen / 2. - dHalfDist, dU) ;
|
||||||
pCrvPos->GetPointD1D2( dU, ICurve::FROM_MINUS, m_ptCalcP8) ;
|
pCrvPos->GetPointD1D2( dU, ICurve::FROM_MINUS, m_ptCalcP8) ;
|
||||||
//pCrvPosExt->GetStartPoint( m_ptCalcP8) ;
|
|
||||||
//pCrvPosExt->GetEndPoint( m_ptCalcP7) ;
|
|
||||||
if ( dLen < 2 * dHalfDist) {
|
if ( dLen < 2 * dHalfDist) {
|
||||||
m_ptCalcPos += ( m_ptCalcPos - m_ptP5) ;
|
m_ptCalcPos += ( m_ptCalcPos - m_ptP5) ;
|
||||||
m_bCalcTextOn = false ;
|
m_bCalcTextOn = false ;
|
||||||
@@ -1118,11 +1217,9 @@ ExtDimension::Update( void) const
|
|||||||
else {
|
else {
|
||||||
m_bCalcArrowIn = false ;
|
m_bCalcArrowIn = false ;
|
||||||
m_bCalcTextOn = false ;
|
m_bCalcTextOn = false ;
|
||||||
//pCrvPosExt->GetStartPoint( m_ptCalcP8) ;
|
|
||||||
//pCrvPosExt->GetEndPoint( m_ptCalcP7) ;
|
|
||||||
vtLine1.Normalize() ;
|
vtLine1.Normalize() ;
|
||||||
vtLine2.Normalize() ;
|
vtLine2.Normalize() ;
|
||||||
if ( Dist( m_ptPos, m_ptP5) < Dist( m_ptPos, m_ptP6)) {
|
if ( Dist( m_ptPos, m_ptP5) < Dist( m_ptPos, ptP5_bis)) {
|
||||||
Vector3d vtDirEnd ;
|
Vector3d vtDirEnd ;
|
||||||
pCrvPos->GetEndDir( vtDirEnd) ;
|
pCrvPos->GetEndDir( vtDirEnd) ;
|
||||||
m_ptCalcPos = m_ptP5 + dHalfDist * ( vtDirEnd + vtLine1) ;
|
m_ptCalcPos = m_ptP5 + dHalfDist * ( vtDirEnd + vtLine1) ;
|
||||||
@@ -1130,7 +1227,7 @@ ExtDimension::Update( void) const
|
|||||||
else {
|
else {
|
||||||
Vector3d vtDirStart ;
|
Vector3d vtDirStart ;
|
||||||
pCrvPos->GetStartDir( vtDirStart) ;
|
pCrvPos->GetStartDir( vtDirStart) ;
|
||||||
m_ptCalcPos = m_ptP6 + dHalfDist * ( - vtDirStart + vtLine2) ;
|
m_ptCalcPos = ptP5_bis + dHalfDist * ( - vtDirStart + vtLine2) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// dichiaro ricalcolo eseguito
|
// dichiaro ricalcolo eseguito
|
||||||
@@ -1155,11 +1252,17 @@ ExtDimension::GetMidPoint( Point3d& ptMid) const
|
|||||||
ptMid = ( m_ptP1 + m_ptP2) / 2;
|
ptMid = ( m_ptP1 + m_ptP2) / 2;
|
||||||
return true ;
|
return true ;
|
||||||
case DT_ANGULAR :
|
case DT_ANGULAR :
|
||||||
{ PtrOwner<CurveArc> pCrvPos( CreateBasicCurveArc()) ;
|
{ // calcolo ptP5_bis
|
||||||
if ( ! pCrvPos->Set3P( m_ptP6, m_ptPos, m_ptP5, false))
|
Vector3d vtLine2 = m_ptP2 - m_ptP6 ;
|
||||||
|
double dLen2 = vtLine2.Len() ;
|
||||||
|
if ( ! vtLine2.Normalize())
|
||||||
return false ;
|
return false ;
|
||||||
pCrvPos->GetMidPoint( ptMid) ;
|
Point3d ptP5_bis = m_ptP2 + ( m_vtDir.Len() - dLen2) * vtLine2 ;
|
||||||
return true ;
|
Vector3d vtMid = ( ptP5_bis + m_ptP5) / 2 - m_ptP6 ;
|
||||||
|
if ( ! vtMid.Normalize())
|
||||||
|
return false ;
|
||||||
|
ptMid = m_ptP6 + vtMid * m_vtDir.Len() ;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
default :
|
default :
|
||||||
return false ;
|
return false ;
|
||||||
@@ -1180,7 +1283,7 @@ ExtDimension::GetCenterPoint( Point3d& ptCen) const
|
|||||||
case DT_RADIAL :
|
case DT_RADIAL :
|
||||||
case DT_DIAMETRAL :
|
case DT_DIAMETRAL :
|
||||||
case DT_ANGULAR :
|
case DT_ANGULAR :
|
||||||
ptCen = m_ptP5 ;
|
ptCen = m_ptP6 ;
|
||||||
return true ;
|
return true ;
|
||||||
default :
|
default :
|
||||||
return false ;
|
return false ;
|
||||||
@@ -1198,80 +1301,74 @@ ExtDimension::ApproxWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST&
|
|||||||
case DT_LINEAR : {
|
case DT_LINEAR : {
|
||||||
// prima linea di riferimento
|
// prima linea di riferimento
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
lstPL.back().AddUPoint(0, m_ptP1) ;
|
lstPL.back().AddUPoint( 0, m_ptP1) ;
|
||||||
lstPL.back().AddUPoint(1, m_ptP3) ;
|
lstPL.back().AddUPoint( 1, m_ptP3) ;
|
||||||
// seconda linea di riferimento
|
// seconda linea di riferimento
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
lstPL.back().AddUPoint(0, m_ptP2) ;
|
lstPL.back().AddUPoint( 0, m_ptP2) ;
|
||||||
lstPL.back().AddUPoint(1, m_ptP4) ;
|
lstPL.back().AddUPoint( 1, m_ptP4) ;
|
||||||
// se non c'è testo, linea di misura intera
|
// se non c'è testo, linea di misura intera
|
||||||
if ( IsEmptyOrSpaces(m_sCalcText)) {
|
if ( IsEmptyOrSpaces( m_sCalcText)) {
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
lstPL.back().AddUPoint(0, m_ptP5) ;
|
lstPL.back().AddUPoint( 0, m_ptP5) ;
|
||||||
lstPL.back().AddUPoint(1, m_ptP6) ;
|
lstPL.back().AddUPoint( 1, m_ptP6) ;
|
||||||
}
|
}
|
||||||
// altrimenti, linea di misura divisa in due parti
|
// altrimenti, linea di misura divisa in due parti
|
||||||
else {
|
else {
|
||||||
// prima parte
|
// prima parte
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
lstPL.back().AddUPoint(0, m_ptP5) ;
|
lstPL.back().AddUPoint( 0, m_ptP5) ;
|
||||||
lstPL.back().AddUPoint(1, m_ptCalcP7) ;
|
lstPL.back().AddUPoint( 1, m_ptCalcP7) ;
|
||||||
// seconda parte
|
// seconda parte
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
lstPL.back().AddUPoint(0, m_ptP6) ;
|
lstPL.back().AddUPoint( 0, m_ptP6) ;
|
||||||
lstPL.back().AddUPoint(1, m_ptCalcP8) ;
|
lstPL.back().AddUPoint( 1, m_ptCalcP8) ;
|
||||||
}
|
}
|
||||||
// frecce
|
// frecce
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
GetArrowHead(m_ptP5, ( m_bCalcArrowIn ? -m_vtDir : m_vtDir), lstPL.back()) ;
|
GetArrowHead( m_ptP5, ( m_bCalcArrowIn ? -m_vtDir : m_vtDir), lstPL.back()) ;
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
GetArrowHead(m_ptP6, ( m_bCalcArrowIn ? m_vtDir : -m_vtDir), lstPL.back()) ;
|
GetArrowHead( m_ptP6, ( m_bCalcArrowIn ? m_vtDir : -m_vtDir), lstPL.back()) ;
|
||||||
// testo
|
// testo
|
||||||
POLYLINELIST lstTxt;
|
POLYLINELIST lstTxt;
|
||||||
if ( ApproxTextWithLines(dLinTol, dAngTolDeg, lstTxt))
|
if ( ApproxTextWithLines( dLinTol, dAngTolDeg, lstTxt))
|
||||||
lstPL.splice(lstPL.end(), lstTxt) ;
|
lstPL.splice( lstPL.end(), lstTxt) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
case DT_RADIAL :
|
case DT_RADIAL :
|
||||||
case DT_DIAMETRAL : {
|
case DT_DIAMETRAL : {
|
||||||
Vector3d vtRad = m_ptPos - m_ptP5 ;
|
|
||||||
vtRad.Normalize() ;
|
|
||||||
// prima linea di riferimento
|
// prima linea di riferimento
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
lstPL.back().AddUPoint(0, m_ptP1) ;
|
lstPL.back().AddUPoint( 0, m_ptP1) ;
|
||||||
lstPL.back().AddUPoint(1, m_ptP2) ;
|
lstPL.back().AddUPoint( 1, m_ptP2) ;
|
||||||
// freccia
|
// freccia
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
GetArrowHead(m_ptP6, ( m_bCalcArrowIn ? vtRad : - vtRad), lstPL.back()) ;
|
Vector3d vtRad = m_ptPos - m_ptP6 ;
|
||||||
Point3d ptArrowTail ;
|
vtRad.Normalize() ;
|
||||||
|
GetArrowHead( m_ptP2, ( m_bCalcArrowIn ? vtRad : - vtRad), lstPL.back()) ;
|
||||||
if ( ! m_bCalcArrowIn) {
|
if ( ! m_bCalcArrowIn) {
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
ptArrowTail = m_ptP6 + vtRad * m_dArrowLen * 2 ;
|
Point3d ptArrowTail = m_ptP2 + vtRad * m_dArrowLen * 2 ;
|
||||||
lstPL.back().AddUPoint(0, m_ptP6) ;
|
lstPL.back().AddUPoint( 0, m_ptP2) ;
|
||||||
lstPL.back().AddUPoint(1, ptArrowTail) ;
|
lstPL.back().AddUPoint( 1, ptArrowTail) ;
|
||||||
}
|
}
|
||||||
if ( m_nType == DT_DIAMETRAL) {
|
if ( m_nType == DT_DIAMETRAL) {
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
GetArrowHead(m_ptP5, ( m_bCalcArrowIn ? - vtRad : vtRad), lstPL.back()) ;
|
GetArrowHead( m_ptP5, ( m_bCalcArrowIn ? - vtRad : vtRad), lstPL.back()) ;
|
||||||
if ( ! m_bCalcArrowIn) {
|
if ( ! m_bCalcArrowIn) {
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
ptArrowTail = m_ptP5 - vtRad * m_dArrowLen * 2 ;
|
Point3d ptArrowTail = m_ptP5 - vtRad * m_dArrowLen * 2 ;
|
||||||
lstPL.back().AddUPoint(0, m_ptP5) ;
|
lstPL.back().AddUPoint( 0, m_ptP5) ;
|
||||||
lstPL.back().AddUPoint(1, ptArrowTail) ;
|
lstPL.back().AddUPoint( 1, ptArrowTail) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// testo
|
// testo
|
||||||
POLYLINELIST lstTxt;
|
POLYLINELIST lstTxt;
|
||||||
if ( ApproxTextWithLines(dLinTol, dAngTolDeg, lstTxt))
|
if ( ApproxTextWithLines( dLinTol, dAngTolDeg, lstTxt))
|
||||||
lstPL.splice(lstPL.end(), lstTxt) ;
|
lstPL.splice( lstPL.end(), lstTxt) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
case DT_ANGULAR : {
|
case DT_ANGULAR : {
|
||||||
// approssimerò l'arco con una polyline
|
|
||||||
PolyLine plApprox ;
|
|
||||||
// cerca nel geom kernel delle tolleranze standard
|
|
||||||
double dLinTol = 0.01 ;
|
|
||||||
double dAngTolDeg = 0.01 ;
|
|
||||||
// prima linea di riferimento
|
// prima linea di riferimento
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
lstPL.back().AddUPoint( 0, m_ptP1) ;
|
lstPL.back().AddUPoint( 0, m_ptP1) ;
|
||||||
@@ -1284,38 +1381,39 @@ ExtDimension::ApproxWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST&
|
|||||||
PtrOwner<CurveArc> pCrvPos( CreateBasicCurveArc()) ;
|
PtrOwner<CurveArc> pCrvPos( CreateBasicCurveArc()) ;
|
||||||
if ( IsNull( pCrvPos))
|
if ( IsNull( pCrvPos))
|
||||||
return false ;
|
return false ;
|
||||||
double dHalfDist = GetTextHalfDist( m_ptCalcPos) ;
|
// calcolo ptP5_bis
|
||||||
|
Vector3d vtLine2 = m_ptP4 - m_ptP6 ;
|
||||||
|
if ( ! vtLine2.Normalize())
|
||||||
|
return false ;
|
||||||
|
Point3d ptP5_bis = m_ptP6 + m_vtDir.Len() * vtLine2 ;
|
||||||
|
// approssimerò l'arco con una polyline
|
||||||
|
PolyLine plApprox ;
|
||||||
// se non ho testo
|
// se non ho testo
|
||||||
if ( IsEmptyOrSpaces( m_sCalcText)) {
|
if ( IsEmptyOrSpaces( m_sCalcText) || ! m_bCalcTextOn) {
|
||||||
if ( ! pCrvPos->SetC2PN( m_ptP5, m_ptP6, m_ptP5, m_vtN) || ! pCrvPos->ApproxWithLines(dLinTol, dAngTolDeg, ICurve::APL_STD, plApprox))
|
if ( ! pCrvPos->SetC2PN( m_ptP6, ptP5_bis, m_ptP5, m_vtN) || ! pCrvPos->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, plApprox))
|
||||||
return false ;
|
return false ;
|
||||||
lstPL.emplace_back( plApprox) ;
|
lstPL.emplace_back( plApprox) ;
|
||||||
}
|
}
|
||||||
// altrimenti, linea di misura divisa in due parti
|
// altrimenti, linea di misura divisa in due parti
|
||||||
else {
|
else {
|
||||||
// prima parte
|
// prima parte
|
||||||
if ( ! pCrvPos->SetC2PN( m_ptP5, m_ptP5, m_ptCalcP7, m_vtN) || ! pCrvPos->ApproxWithLines(dLinTol, dAngTolDeg, ICurve::APL_STD, plApprox))
|
if ( ! pCrvPos->SetC2PN( m_ptP6, m_ptP5, m_ptCalcP7, m_vtN) || ! pCrvPos->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, plApprox))
|
||||||
return false ;
|
return false ;
|
||||||
lstPL.emplace_back( plApprox) ;
|
lstPL.emplace_back( plApprox) ;
|
||||||
// seconda parte
|
// seconda parte
|
||||||
if ( ! pCrvPos->SetC2PN( m_ptP5, m_ptP6, m_ptCalcP8, m_vtN) || ! pCrvPos->ApproxWithLines(dLinTol, dAngTolDeg, ICurve::APL_STD, plApprox))
|
if ( ! pCrvPos->SetC2PN( m_ptP6, ptP5_bis, m_ptCalcP8, m_vtN) || ! pCrvPos->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, plApprox))
|
||||||
return false ;
|
return false ;
|
||||||
lstPL.emplace_back( plApprox) ;
|
lstPL.emplace_back( plApprox) ;
|
||||||
}
|
}
|
||||||
// frecce
|
// frecce
|
||||||
|
if ( ! pCrvPos->Set3P( ptP5_bis, m_ptPos, m_ptP5, false))
|
||||||
|
return false ;
|
||||||
Vector3d vtStartDir ;
|
Vector3d vtStartDir ;
|
||||||
Vector3d vtEndDir ;
|
Vector3d vtEndDir ;
|
||||||
if ( ! pCrvPos->Set3P( m_ptP6, m_ptPos, m_ptP5, false))
|
|
||||||
return false ;
|
|
||||||
pCrvPos->GetStartDir( vtStartDir) ;
|
pCrvPos->GetStartDir( vtStartDir) ;
|
||||||
pCrvPos->GetEndDir( vtEndDir) ;
|
pCrvPos->GetEndDir( vtEndDir) ;
|
||||||
//storto la punta delle frecce su una direzione mediata tra l'arco e la perpendicolare al lato
|
//storto la punta delle frecce su una direzione mediata tra l'arco e la perpendicolare al lato
|
||||||
double dFactor = 1 / ( 0.6 * m_vtDir.Len()) ; // questo fattore dipende direttamente dalla distanza di m_ptPos dal centro e smorza lo scostamento
|
double dFactor = 1 / ( 0.6 * m_vtDir.Len()) ;// questo fattore dipende direttamente dalla distanza di m_ptPos dal centro e smorza lo scostamento
|
||||||
Vector3d vtLine1 = m_ptP1 - m_ptP5 ;
|
|
||||||
Vector3d vtLine2 = m_ptP2 - m_ptP5 ;
|
|
||||||
vtLine1.Normalize() ;
|
|
||||||
vtLine2.Normalize() ;
|
|
||||||
// se però le frecce sono fuori non le storto e faccio le code dritte anziché curvilinee
|
// se però le frecce sono fuori non le storto e faccio le code dritte anziché curvilinee
|
||||||
if ( ! m_bCalcArrowIn) {
|
if ( ! m_bCalcArrowIn) {
|
||||||
Point3d ptArrowTail1, ptArrowTail2 ;
|
Point3d ptArrowTail1, ptArrowTail2 ;
|
||||||
@@ -1323,16 +1421,19 @@ ExtDimension::ApproxWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST&
|
|||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
lstPL.back().AddUPoint( 0, m_ptP5) ;
|
lstPL.back().AddUPoint( 0, m_ptP5) ;
|
||||||
lstPL.back().AddUPoint( 1, ptArrowTail1) ;
|
lstPL.back().AddUPoint( 1, ptArrowTail1) ;
|
||||||
ptArrowTail2 = m_ptP6 - vtStartDir * m_dArrowLen *2 ;
|
ptArrowTail2 = ptP5_bis - vtStartDir * m_dArrowLen *2 ;
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
lstPL.back().AddUPoint( 0, m_ptP6) ;
|
lstPL.back().AddUPoint( 0, ptP5_bis) ;
|
||||||
lstPL.back().AddUPoint( 1, ptArrowTail2) ;
|
lstPL.back().AddUPoint( 1, ptArrowTail2) ;
|
||||||
dFactor = 0 ;
|
dFactor = 0 ;
|
||||||
}
|
}
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
|
Vector3d vtLine1 = m_ptP3 - m_ptP6 ;
|
||||||
|
if ( ! vtLine1.Normalize())
|
||||||
|
return false ;
|
||||||
GetArrowHead( m_ptP5, ( m_bCalcArrowIn ? vtEndDir : - vtEndDir) + vtLine1 * dFactor, lstPL.back()) ;
|
GetArrowHead( m_ptP5, ( m_bCalcArrowIn ? vtEndDir : - vtEndDir) + vtLine1 * dFactor, lstPL.back()) ;
|
||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
GetArrowHead( m_ptP6, ( m_bCalcArrowIn ? - vtStartDir : vtStartDir) + vtLine2 * dFactor, lstPL.back()) ;
|
GetArrowHead( ptP5_bis, ( m_bCalcArrowIn ? - vtStartDir : vtStartDir) + vtLine2 * dFactor, lstPL.back()) ;
|
||||||
// testo
|
// testo
|
||||||
POLYLINELIST lstTxt ;
|
POLYLINELIST lstTxt ;
|
||||||
if ( ApproxTextWithLines( dLinTol, dAngTolDeg, lstTxt))
|
if ( ApproxTextWithLines( dLinTol, dAngTolDeg, lstTxt))
|
||||||
@@ -1346,23 +1447,25 @@ ExtDimension::ApproxWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST&
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
double
|
double
|
||||||
ExtDimension::GetTextHalfDist( const Point3d& ptText) const
|
ExtDimension::GetTextHalfDist( const Point3d& ptText, bool bUseRot) const
|
||||||
{
|
{
|
||||||
// semi distanza di interruzione
|
// semi distanza di interruzione
|
||||||
double dHalfDist = m_dTextHeight / 2 + m_dTextDist ;
|
double dHalfDist = m_dTextHeight / 2 + m_dTextDist ;
|
||||||
// recupero il box di ingombro del testo
|
// recupero il box di ingombro del testo
|
||||||
BBox3d b3Text ;
|
BBox3d b3Text ;
|
||||||
Vector3d vtDir = m_vtDir ;
|
|
||||||
if ( m_nType == DT_ANGULAR)
|
|
||||||
vtDir.Normalize() ;
|
|
||||||
if ( GetTextMyBBox( ptText, b3Text) && ! b3Text.IsEmpty()) {
|
if ( GetTextMyBBox( ptText, b3Text) && ! b3Text.IsEmpty()) {
|
||||||
double dHalfL = ( b3Text.GetMax().x - b3Text.GetMin().x) / 2 ;
|
double dHalfL = ( b3Text.GetMax().x - b3Text.GetMin().x) / 2 ;
|
||||||
double dHalfH = ( b3Text.GetMax().y - b3Text.GetMin().y) / 2 ;
|
double dHalfH = ( b3Text.GetMax().y - b3Text.GetMin().y) / 2 ;
|
||||||
dHalfDist = sqrt( dHalfL * dHalfL + dHalfH * dHalfH) ;
|
dHalfDist = sqrt( dHalfL * dHalfL + dHalfH * dHalfH) ;
|
||||||
if ( abs( vtDir.x) > EPS_ZERO)
|
if ( bUseRot) {
|
||||||
|
Vector3d vtDir = m_vtDir ;
|
||||||
|
vtDir.Normalize() ;
|
||||||
|
double dCoeff = ( dHalfH > 1 ? dHalfL / dHalfH : 0) ;
|
||||||
|
if ( abs( vtDir.x) > dCoeff * abs( vtDir.y))
|
||||||
dHalfDist = min( dHalfDist, dHalfL / abs( vtDir.x)) ;
|
dHalfDist = min( dHalfDist, dHalfL / abs( vtDir.x)) ;
|
||||||
if ( abs( vtDir.y) > EPS_ZERO)
|
else
|
||||||
dHalfDist = min( dHalfDist, dHalfH / abs( vtDir.y)) ;
|
dHalfDist = min( dHalfDist, dHalfH / abs( vtDir.y)) ;
|
||||||
|
}
|
||||||
dHalfDist += m_dTextDist ;
|
dHalfDist += m_dTextDist ;
|
||||||
}
|
}
|
||||||
return dHalfDist ;
|
return dHalfDist ;
|
||||||
@@ -1419,12 +1522,11 @@ ExtDimension::ApproxTextWithLines( double dLinTol, double dAngTolDeg, POLYLINELI
|
|||||||
Frame3d frRef ;
|
Frame3d frRef ;
|
||||||
if ( ! frRef.Set( m_ptCalcPos, m_vtN))
|
if ( ! frRef.Set( m_ptCalcPos, m_vtN))
|
||||||
return false ;
|
return false ;
|
||||||
|
// oriento il testo con il raggio/diametro, ma solo se il testo è dentro la circonferenza
|
||||||
if ( ( m_nType == DT_RADIAL || m_nType == DT_DIAMETRAL) && m_bCalcTextOn) {
|
if ( ( m_nType == DT_RADIAL || m_nType == DT_DIAMETRAL) && m_bCalcTextOn) {
|
||||||
double dAngDeg = 0 ;
|
double dAngDeg = 0 ;
|
||||||
Vector3d vtRad = m_ptPos - m_ptP5 ;
|
m_vtDir.GetAngle( frRef.VersX(), dAngDeg) ;
|
||||||
m_vtDir.GetAngle( vtRad, dAngDeg) ;
|
if ( ! frRef.Set( m_ptCalcPos, m_vtN, ( dAngDeg > 90 ? - m_vtDir : m_vtDir)))
|
||||||
if ( ! frRef.Set( m_ptCalcPos, m_vtN, ( dAngDeg > 90 ? - vtRad : vtRad)))
|
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
-5
@@ -55,6 +55,11 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
|||||||
m_nTempProp[nPropInd] = nProp ; }
|
m_nTempProp[nPropInd] = nProp ; }
|
||||||
int GetTempProp( int nPropInd = 0) const override
|
int GetTempProp( int nPropInd = 0) const override
|
||||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||||
|
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||||
|
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||||
|
m_dTempParam[nParamInd] = dParam ; }
|
||||||
|
double GetTempParam( int nParamInd = 0) const override
|
||||||
|
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||||
|
|
||||||
public : // IExtDimension
|
public : // IExtDimension
|
||||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||||
@@ -66,7 +71,10 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
|||||||
const Vector3d& vtN, const std::string& sText) override ;
|
const Vector3d& vtN, const std::string& sText) override ;
|
||||||
bool SetDiametral( const Point3d& ptCen, const Point3d& ptPos,
|
bool SetDiametral( const Point3d& ptCen, const Point3d& ptPos,
|
||||||
const Vector3d& vtN, const std::string& sText) override ;
|
const Vector3d& vtN, const std::string& sText) override ;
|
||||||
bool SetAngular( const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptV, const Point3d& ptPos,
|
bool SetAngular( const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptPos,
|
||||||
|
const Vector3d& vtN, const std::string& sText) override ;
|
||||||
|
bool SetAngularEx( const Point3d& ptV1, const Point3d& ptP1,
|
||||||
|
const Point3d& ptV2, const Point3d& ptP2, const Point3d& ptPos,
|
||||||
const Vector3d& vtN, const std::string& sText) override ;
|
const Vector3d& vtN, const std::string& sText) override ;
|
||||||
const Vector3d& GetNormVersor( void) const override
|
const Vector3d& GetNormVersor( void) const override
|
||||||
{ return m_vtN ; }
|
{ return m_vtN ; }
|
||||||
@@ -100,12 +108,16 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
|||||||
{ return m_dTextHeight ; }
|
{ return m_dTextHeight ; }
|
||||||
bool GetMidPoint( Point3d& ptMid) const override ;
|
bool GetMidPoint( Point3d& ptMid) const override ;
|
||||||
bool GetCenterPoint( Point3d& ptCen) const override ;
|
bool GetCenterPoint( Point3d& ptCen) const override ;
|
||||||
|
const std::string& GetSubType( void) const override ;
|
||||||
bool ApproxWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST& lstPL) const override ;
|
bool ApproxWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST& lstPL) const override ;
|
||||||
|
|
||||||
public : // IGeoObjRW
|
public : // IGeoObjRW
|
||||||
int GetNgeId( void) const override ;
|
int GetNgeId( void) const override ;
|
||||||
bool Save( NgeWriter& ngeOut) const override ;
|
bool Save( NgeWriter& ngeOut) const override ;
|
||||||
|
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
|
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
bool Load( NgeReader& ngeIn) override ;
|
bool Load( NgeReader& ngeIn) override ;
|
||||||
|
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||||
|
|
||||||
public :
|
public :
|
||||||
ExtDimension( void) ;
|
ExtDimension( void) ;
|
||||||
@@ -119,9 +131,8 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
|||||||
|
|
||||||
private :
|
private :
|
||||||
bool CopyFrom( const ExtDimension& gpSrc) ;
|
bool CopyFrom( const ExtDimension& gpSrc) ;
|
||||||
const std::string& GetSubType( void) const ;
|
|
||||||
bool Update( void) const ;
|
bool Update( void) const ;
|
||||||
double GetTextHalfDist( const Point3d& ptText) const ;
|
double GetTextHalfDist( const Point3d& ptText, bool bUseRot = true) const ;
|
||||||
bool GetArrowHead( const Point3d& ptTip, const Vector3d& vtDir, PolyLine& PL) const ;
|
bool GetArrowHead( const Point3d& ptTip, const Vector3d& vtDir, PolyLine& PL) const ;
|
||||||
bool SetCurrFont( FontManager& fntMgr) const ;
|
bool SetCurrFont( FontManager& fntMgr) const ;
|
||||||
bool ApproxTextWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST& lstPL) const ;
|
bool ApproxTextWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST& lstPL) const ;
|
||||||
@@ -140,7 +151,7 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
|||||||
Point3d m_ptP3 ; // terzo punto
|
Point3d m_ptP3 ; // terzo punto
|
||||||
Point3d m_ptP4 ; // quarto punto
|
Point3d m_ptP4 ; // quarto punto
|
||||||
Point3d m_ptP5 ; // quinto punto
|
Point3d m_ptP5 ; // quinto punto
|
||||||
Point3d m_ptP6 ; // sesto punto
|
Point3d m_ptP6 ; // sesto punto; nel caso delle quotature angolari � il centro
|
||||||
Point3d m_ptPos ; // posizione ricevuta della quota
|
Point3d m_ptPos ; // posizione ricevuta della quota
|
||||||
std::string m_sText ; // testo della quota
|
std::string m_sText ; // testo della quota
|
||||||
mutable bool m_bToCalc ; // flag dati effettivi da ricalcolare
|
mutable bool m_bToCalc ; // flag dati effettivi da ricalcolare
|
||||||
@@ -157,7 +168,8 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
|||||||
int m_nDecDigit ; // numero di cifre decimali
|
int m_nDecDigit ; // numero di cifre decimali
|
||||||
std::string m_sFont ; // font del testo
|
std::string m_sFont ; // font del testo
|
||||||
double m_dTextHeight ; // altezza del testo
|
double m_dTextHeight ; // altezza del testo
|
||||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
int m_nTempProp[2] ; // vettore propriet� temporanee
|
||||||
|
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
+5
-4
@@ -35,10 +35,9 @@ GEOOBJ_REGISTER( EXT_TEXT, NGE_E_TXT, ExtText) ;
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
ExtText::ExtText( void)
|
ExtText::ExtText( void)
|
||||||
: m_pSTM( nullptr), m_bNoSTM( false), m_ptP(), m_vtN( 0, 0, 1), m_vtD( 1, 0, 0), m_sFont(),
|
: m_pSTM( nullptr), m_bNoSTM( false), m_ptP(), m_vtN( 0, 0, 1), m_vtD( 1, 0, 0), m_sFont(),
|
||||||
m_nWeight( 400), m_bItalic( false), m_dHeight( 10), m_dRatio( 1), m_dAddAdvance( 0)
|
m_nWeight( 400), m_bItalic( false), m_dHeight( 10), m_dRatio( 1), m_dAddAdvance( 0),
|
||||||
|
m_nTempProp{0,0}, m_dTempParam{0.0,0.0}
|
||||||
{
|
{
|
||||||
m_nTempProp[0] = 0 ;
|
|
||||||
m_nTempProp[1] = 0 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -188,6 +187,8 @@ ExtText::CopyFrom( const ExtText& clSrc)
|
|||||||
m_nInsPos = clSrc.m_nInsPos ;
|
m_nInsPos = clSrc.m_nInsPos ;
|
||||||
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
|
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
|
||||||
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
|
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
|
||||||
|
m_dTempParam[0] = clSrc.m_dTempParam[0] ;
|
||||||
|
m_dTempParam[1] = clSrc.m_dTempParam[1] ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -883,7 +884,7 @@ ExtText::GetAuxSurf( void) const
|
|||||||
// per ogni regione richiedo la superficie ausiliaria e la aggiungo a quella generale
|
// per ogni regione richiedo la superficie ausiliaria e la aggiungo a quella generale
|
||||||
for ( const auto& pSfr : lstSfr) {
|
for ( const auto& pSfr : lstSfr) {
|
||||||
// recupero la superficie trimesh
|
// recupero la superficie trimesh
|
||||||
PtrOwner<ISurfTriMesh> pStm( GetBasicSurfFlatRegion( pSfr)->CalcAuxSurf( LIN_TOL_STD, ANG_TOL_STD_DEG)) ;
|
PtrOwner<SurfTriMesh> pStm( GetBasicSurfFlatRegion( pSfr)->CalcAuxSurf( LIN_TOL_STD, ANG_TOL_STD_DEG)) ;
|
||||||
if ( pStm != nullptr) {
|
if ( pStm != nullptr) {
|
||||||
Triangle3d Tria ;
|
Triangle3d Tria ;
|
||||||
int nT = pStm->GetFirstTriangle( Tria) ;
|
int nT = pStm->GetFirstTriangle( Tria) ;
|
||||||
|
|||||||
@@ -55,6 +55,11 @@ class ExtText : public IExtText, public IGeoObjRW
|
|||||||
m_nTempProp[nPropInd] = nProp ; }
|
m_nTempProp[nPropInd] = nProp ; }
|
||||||
int GetTempProp( int nPropInd = 0) const override
|
int GetTempProp( int nPropInd = 0) const override
|
||||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||||
|
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||||
|
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||||
|
m_dTempParam[nParamInd] = dParam ; }
|
||||||
|
double GetTempParam( int nParamInd = 0) const override
|
||||||
|
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||||
|
|
||||||
public : // IExtText
|
public : // IExtText
|
||||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||||
@@ -108,7 +113,10 @@ class ExtText : public IExtText, public IGeoObjRW
|
|||||||
public : // IGeoObjRW
|
public : // IGeoObjRW
|
||||||
int GetNgeId( void) const override ;
|
int GetNgeId( void) const override ;
|
||||||
bool Save( NgeWriter& ngeOut) const override ;
|
bool Save( NgeWriter& ngeOut) const override ;
|
||||||
|
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
|
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
bool Load( NgeReader& ngeIn) override ;
|
bool Load( NgeReader& ngeIn) override ;
|
||||||
|
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||||
|
|
||||||
public :
|
public :
|
||||||
ExtText( void) ;
|
ExtText( void) ;
|
||||||
@@ -145,6 +153,7 @@ class ExtText : public IExtText, public IGeoObjRW
|
|||||||
double m_dAddAdvance ; // avanzamento addizionale tra caratteri
|
double m_dAddAdvance ; // avanzamento addizionale tra caratteri
|
||||||
int m_nInsPos ; // posizione del punto di inserimento rispetto al testo
|
int m_nInsPos ; // posizione del punto di inserimento rispetto al testo
|
||||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||||
|
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
+48
-12
@@ -18,6 +18,7 @@
|
|||||||
#include "/EgtDev/Include/EGkFilletChamfer.h"
|
#include "/EgtDev/Include/EGkFilletChamfer.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||||
|
#include "/EgtDev/Include/EgkOffsetCurve.h"
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
@@ -40,13 +41,21 @@ CalcForFillet( const ICurve& cCrv1, const Point3d& ptNear1,
|
|||||||
if ( ! dPC1.GetSideAtMinDistPoint( 0, vtNorm, nSide1))
|
if ( ! dPC1.GetSideAtMinDistPoint( 0, vtNorm, nSide1))
|
||||||
return false ;
|
return false ;
|
||||||
double dOffs1 = ( nSide1 == MDS_RIGHT ? dRadius : - dRadius) ;
|
double dOffs1 = ( nSide1 == MDS_RIGHT ? dRadius : - dRadius) ;
|
||||||
// calcolo l'offset nel piano locale e dal lato opportuno di una copia della curva 1
|
// calcolo gli offset nel piano locale e dal lato opportuno di una copia della curva 1
|
||||||
PtrOwner<ICurve> pCopy1( cCrv1.Clone()) ;
|
PtrOwner<ICurve> pCopy1( cCrv1.Clone()) ;
|
||||||
if ( IsNull( pCopy1))
|
if ( IsNull( pCopy1))
|
||||||
return false ;
|
return false ;
|
||||||
pCopy1->ToLoc( frIntr) ;
|
pCopy1->ToLoc( frIntr) ;
|
||||||
pCopy1->SetExtrusion( Z_AX) ;
|
pCopy1->SetExtrusion( Z_AX) ;
|
||||||
if ( ! pCopy1->SimpleOffset( dOffs1, ICurve::OFF_FILLET))
|
OffsetCurve OffsCrv1 ;
|
||||||
|
OffsCrv1.Make( pCopy1, dOffs1, ICurve::OFF_FILLET) ;
|
||||||
|
ICURVEPOVECTOR vOffs1 ;
|
||||||
|
ICurve* pCrv = OffsCrv1.GetLongerCurve() ;
|
||||||
|
while ( pCrv != nullptr) {
|
||||||
|
vOffs1.emplace_back( pCrv) ;
|
||||||
|
pCrv = OffsCrv1.GetLongerCurve() ;
|
||||||
|
}
|
||||||
|
if ( vOffs1.empty())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// determino il lato di offset della curva 2
|
// determino il lato di offset della curva 2
|
||||||
@@ -54,23 +63,50 @@ CalcForFillet( const ICurve& cCrv1, const Point3d& ptNear1,
|
|||||||
if ( ! dPC2.GetSideAtMinDistPoint( 0, vtNorm, nSide2))
|
if ( ! dPC2.GetSideAtMinDistPoint( 0, vtNorm, nSide2))
|
||||||
return false ;
|
return false ;
|
||||||
double dOffs2 = ( nSide2 == MDS_RIGHT ? dRadius : - dRadius) ;
|
double dOffs2 = ( nSide2 == MDS_RIGHT ? dRadius : - dRadius) ;
|
||||||
// calcolo l'offset nel piano locale e dal lato opportuno di una copia della curva 2
|
// calcolo gli offset nel piano locale e dal lato opportuno di una copia della curva 2
|
||||||
PtrOwner<ICurve> pCopy2( cCrv2.Clone()) ;
|
PtrOwner<ICurve> pCopy2( cCrv2.Clone()) ;
|
||||||
if ( IsNull( pCopy2))
|
if ( IsNull( pCopy2))
|
||||||
return false ;
|
return false ;
|
||||||
pCopy2->ToLoc( frIntr) ;
|
pCopy2->ToLoc( frIntr) ;
|
||||||
pCopy2->SetExtrusion( Z_AX) ;
|
pCopy2->SetExtrusion( Z_AX) ;
|
||||||
if ( ! pCopy2->SimpleOffset( dOffs2, ICurve::OFF_FILLET))
|
OffsetCurve OffsCrv2 ;
|
||||||
|
OffsCrv2.Make( pCopy2, dOffs2, ICurve::OFF_FILLET) ;
|
||||||
|
ICURVEPOVECTOR vOffs2 ;
|
||||||
|
pCrv = OffsCrv2.GetLongerCurve() ;
|
||||||
|
while ( pCrv != nullptr) {
|
||||||
|
vOffs2.emplace_back( pCrv) ;
|
||||||
|
pCrv = OffsCrv2.GetLongerCurve() ;
|
||||||
|
}
|
||||||
|
if ( vOffs2.empty())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// calcolo l'intersezione tra le due curve
|
// calcolo le intersezioni tra tutte le curve di offset e seleziono quella più vicina ai punti passati
|
||||||
Point3d ptInt1, ptInt2 ;
|
Point3d ptInt1 = P_INVALID, ptInt2 = P_INVALID ;
|
||||||
Point3d ptNearI = Media( ptNear1, ptNear2) ;
|
Point3d ptNearI = Media( ptNear1, ptNear2) ;
|
||||||
ptNearI.ToLoc( frIntr) ;
|
ptNearI.ToLoc( frIntr) ;
|
||||||
IntersCurveCurve intCC( *pCopy1, *pCopy2) ;
|
double dMinDist = INFINITO ;
|
||||||
if ( ! intCC.GetIntersPointNearTo( 0, ptNearI, ptInt1) ||
|
for ( int i = 0 ; i < int( vOffs1.size()) ; i++) {
|
||||||
! intCC.GetIntersPointNearTo( 1, ptNearI, ptInt2))
|
for ( int j = 0 ; j < int( vOffs2.size()) ; j ++) {
|
||||||
|
IntersCurveCurve intCC( *vOffs1[i], *vOffs2[j]) ;
|
||||||
|
if ( intCC.GetIntersCount() == 0)
|
||||||
|
continue ;
|
||||||
|
Point3d ptInt1Curr, ptInt2Curr ;
|
||||||
|
if ( ! intCC.GetIntersPointNearTo( 0, ptNearI, ptInt1Curr) ||
|
||||||
|
! intCC.GetIntersPointNearTo( 1, ptNearI, ptInt2Curr))
|
||||||
return false ;
|
return false ;
|
||||||
|
Point3d ptCenCurr = Media( ptInt1Curr, ptInt2Curr) ;
|
||||||
|
double dDist = Dist( ptNearI, ptCenCurr) ;
|
||||||
|
if ( dDist < dMinDist - EPS_SMALL) {
|
||||||
|
dMinDist = dDist ;
|
||||||
|
ptInt1 = ptInt1Curr ;
|
||||||
|
ptInt2 = ptInt2Curr ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// se non sono state trovate intersezioni esco
|
||||||
|
if ( ! ptInt1.IsValid() || ! ptInt2.IsValid())
|
||||||
|
return false ;
|
||||||
|
|
||||||
ptInt1.ToGlob( frIntr) ;
|
ptInt1.ToGlob( frIntr) ;
|
||||||
ptInt2.ToGlob( frIntr) ;
|
ptInt2.ToGlob( frIntr) ;
|
||||||
ptCen = Media( ptInt1, ptInt2) ;
|
ptCen = Media( ptInt1, ptInt2) ;
|
||||||
@@ -105,7 +141,7 @@ CreateFillet( const ICurve& cCrv1, const Point3d& ptNear1,
|
|||||||
const ICurve& cCrv2, const Point3d& ptNear2,
|
const ICurve& cCrv2, const Point3d& ptNear2,
|
||||||
const Vector3d& vtNorm, double dRadius, double& dPar1, double& dPar2)
|
const Vector3d& vtNorm, double dRadius, double& dPar1, double& dPar2)
|
||||||
{
|
{
|
||||||
// verifico validità parametri ricevuti
|
// verifico validità parametri ricevuti
|
||||||
if ( &cCrv1 == nullptr || &ptNear1 == nullptr ||
|
if ( &cCrv1 == nullptr || &ptNear1 == nullptr ||
|
||||||
&cCrv2 == nullptr || &ptNear2 == nullptr ||
|
&cCrv2 == nullptr || &ptNear2 == nullptr ||
|
||||||
&vtNorm == nullptr || &dPar1 == nullptr || &dPar2 == nullptr)
|
&vtNorm == nullptr || &dPar1 == nullptr || &dPar2 == nullptr)
|
||||||
@@ -119,7 +155,7 @@ CreateFillet( const ICurve& cCrv1, const Point3d& ptNear1,
|
|||||||
ptCen, ptTg1, ptTg2, nSide1, nSide2, dSinA, dTgPar1, dTgPar2))
|
ptCen, ptTg1, ptTg2, nSide1, nSide2, dSinA, dTgPar1, dTgPar2))
|
||||||
return nullptr ;
|
return nullptr ;
|
||||||
|
|
||||||
// se tangenti parallele al contatto con fillet, ricalcolo con raggio più piccolo
|
// se tangenti parallele al contatto con fillet, ricalcolo con raggio più piccolo
|
||||||
bool bParallel = ( abs( dSinA) < EPS_SMALL) ;
|
bool bParallel = ( abs( dSinA) < EPS_SMALL) ;
|
||||||
if ( bParallel) {
|
if ( bParallel) {
|
||||||
Point3d ptQQQ, ptQQ1, ptQQ2 ;
|
Point3d ptQQQ, ptQQ1, ptQQ2 ;
|
||||||
@@ -165,7 +201,7 @@ CreateChamfer( const ICurve& cCrv1, const Point3d& ptNear1,
|
|||||||
const ICurve& cCrv2, const Point3d& ptNear2,
|
const ICurve& cCrv2, const Point3d& ptNear2,
|
||||||
const Vector3d& vtNorm, double dDist, double& dPar1, double& dPar2)
|
const Vector3d& vtNorm, double dDist, double& dPar1, double& dPar2)
|
||||||
{
|
{
|
||||||
// verifico validità parametri ricevuti
|
// verifico validità parametri ricevuti
|
||||||
if ( &cCrv1 == nullptr || &ptNear1 == nullptr ||
|
if ( &cCrv1 == nullptr || &ptNear1 == nullptr ||
|
||||||
&cCrv2 == nullptr || &ptNear2 == nullptr ||
|
&cCrv2 == nullptr || &ptNear2 == nullptr ||
|
||||||
&vtNorm == nullptr || &dPar1 == nullptr || &dPar2 == nullptr)
|
&vtNorm == nullptr || &dPar1 == nullptr || &dPar2 == nullptr)
|
||||||
|
|||||||
+22
-40
@@ -16,8 +16,8 @@
|
|||||||
#include "FontNfe.h"
|
#include "FontNfe.h"
|
||||||
#include "FontAux.h"
|
#include "FontAux.h"
|
||||||
#include "FontConst.h"
|
#include "FontConst.h"
|
||||||
|
#include "GdbIterator.h"
|
||||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurve.h"
|
#include "/EgtDev/Include/EGkCurve.h"
|
||||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||||
@@ -81,21 +81,19 @@ NfeFont::SetCurrFont( const string& sFont, int nWeight, bool bItalic,
|
|||||||
if ( ! m_pGDB->Load( sFont))
|
if ( ! m_pGDB->Load( sFont))
|
||||||
return false ;
|
return false ;
|
||||||
// recupero i parametri generali del font (devono essere nel gruppo 1)
|
// recupero i parametri generali del font (devono essere nel gruppo 1)
|
||||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGDB)) ;
|
GdbIterator iIter( m_pGDB) ;
|
||||||
if ( IsNull( pIter))
|
if ( ! iIter.GoTo( 1))
|
||||||
return false ;
|
return false ;
|
||||||
if ( ! pIter->GoTo( 1))
|
if ( ! iIter.GetInfo( NFE_H, m_dH) ||
|
||||||
return false ;
|
! iIter.GetInfo( NFE_HCAP, m_dHCap) ||
|
||||||
if ( ! pIter->GetInfo( NFE_H, m_dH) ||
|
! iIter.GetInfo( NFE_HX, m_dHx) ||
|
||||||
! pIter->GetInfo( NFE_HCAP, m_dHCap) ||
|
! iIter.GetInfo( NFE_ASC, m_dAsc) ||
|
||||||
! pIter->GetInfo( NFE_HX, m_dHx) ||
|
! iIter.GetInfo( NFE_DESC, m_dDesc) ||
|
||||||
! pIter->GetInfo( NFE_ASC, m_dAsc) ||
|
! iIter.GetInfo( NFE_ADV, m_dAdv))
|
||||||
! pIter->GetInfo( NFE_DESC, m_dDesc) ||
|
|
||||||
! pIter->GetInfo( NFE_ADV, m_dAdv))
|
|
||||||
return false ;
|
return false ;
|
||||||
if ( m_dH < EPS_SMALL || m_dHCap < EPS_SMALL || m_dHx < EPS_SMALL)
|
if ( m_dH < EPS_SMALL || m_dHCap < EPS_SMALL || m_dHx < EPS_SMALL)
|
||||||
return false ;
|
return false ;
|
||||||
if ( ! pIter->GetInfo( NFE_ITALIC, m_dItalicShearCoeff))
|
if ( ! iIter.GetInfo( NFE_ITALIC, m_dItalicShearCoeff))
|
||||||
m_dItalicShearCoeff = NFE_ITALIC_STD_SHEAR_COEFF ;
|
m_dItalicShearCoeff = NFE_ITALIC_STD_SHEAR_COEFF ;
|
||||||
// aggiorno la path del font
|
// aggiorno la path del font
|
||||||
m_sFont = sFontUp ;
|
m_sFont = sFontUp ;
|
||||||
@@ -161,11 +159,6 @@ NfeFont::GetXBox( const string& sText, int nInsPos, bool bCapOrBound, BBox3d& b3
|
|||||||
if ( m_pGDB == nullptr || m_sFont.empty())
|
if ( m_pGDB == nullptr || m_sFont.empty())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// creo un iteratore
|
|
||||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGDB)) ;
|
|
||||||
if ( IsNull( pIter))
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
// calcolo i fattori di scala
|
// calcolo i fattori di scala
|
||||||
double dScaY = m_dHeight / m_dHCap ;
|
double dScaY = m_dHeight / m_dHCap ;
|
||||||
double dScaX = dScaY * m_dRatio ;
|
double dScaX = dScaY * m_dRatio ;
|
||||||
@@ -229,9 +222,7 @@ NfeFont::GetOutline( const string& sText, int nInsPos, ICURVEPLIST& lstPC) const
|
|||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// creo un iteratore
|
// creo un iteratore
|
||||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGDB)) ;
|
GdbIterator iIter( m_pGDB) ;
|
||||||
if ( IsNull( pIter))
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
// calcolo i fattori di scala
|
// calcolo i fattori di scala
|
||||||
double dScaY = m_dHeight / m_dHCap ;
|
double dScaY = m_dHeight / m_dHCap ;
|
||||||
@@ -265,9 +256,9 @@ NfeFont::GetOutline( const string& sText, int nInsPos, ICURVEPLIST& lstPC) const
|
|||||||
if ( nGroup < NFE_MIN_CHAR || m_pGDB->GetGdbType( nGroup) != GDB_TY_GROUP)
|
if ( nGroup < NFE_MIN_CHAR || m_pGDB->GetGdbType( nGroup) != GDB_TY_GROUP)
|
||||||
nGroup = NFE_ERR_CHAR ;
|
nGroup = NFE_ERR_CHAR ;
|
||||||
// ciclo sulle entità geometriche del carattere
|
// ciclo sulle entità geometriche del carattere
|
||||||
bool bIter = pIter->GoToFirstInGroup( nGroup) ;
|
bool bIter = iIter.GoToFirstInGroup( nGroup) ;
|
||||||
while ( bIter) {
|
while ( bIter) {
|
||||||
const ICurve* pCrv = GetCurve( pIter->GetGeoObj()) ;
|
const ICurve* pCrv = GetCurve( iIter.GetGeoObj()) ;
|
||||||
if ( pCrv != nullptr) {
|
if ( pCrv != nullptr) {
|
||||||
// copio la curva (trasformando eventuali archi in CurveBezier)
|
// copio la curva (trasformando eventuali archi in CurveBezier)
|
||||||
ICurve* pCrvNew = CurveToNoArcsCurve( pCrv) ;
|
ICurve* pCrvNew = CurveToNoArcsCurve( pCrv) ;
|
||||||
@@ -281,7 +272,7 @@ NfeFont::GetOutline( const string& sText, int nInsPos, ICURVEPLIST& lstPC) const
|
|||||||
// inserisco in lista la nuova curva
|
// inserisco in lista la nuova curva
|
||||||
lstPC.push_back( pCrvNew) ;
|
lstPC.push_back( pCrvNew) ;
|
||||||
}
|
}
|
||||||
bIter = pIter->GoToNext() ;
|
bIter = iIter.GoToNext() ;
|
||||||
}
|
}
|
||||||
// recupero lo spostamento per il prossimo carattere
|
// recupero lo spostamento per il prossimo carattere
|
||||||
double dAdvance ;
|
double dAdvance ;
|
||||||
@@ -314,9 +305,7 @@ NfeFont::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, doub
|
|||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// creo un iteratore
|
// creo un iteratore
|
||||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGDB)) ;
|
GdbIterator iIter( m_pGDB) ;
|
||||||
if ( IsNull( pIter))
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
// controllo valore tolleranza lineare
|
// controllo valore tolleranza lineare
|
||||||
if ( dLinTol > FNT_MAX_LINTOL_TO_H * m_dHeight)
|
if ( dLinTol > FNT_MAX_LINTOL_TO_H * m_dHeight)
|
||||||
@@ -354,9 +343,9 @@ NfeFont::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, doub
|
|||||||
if ( nGroup < NFE_MIN_CHAR || m_pGDB->GetGdbType( nGroup) != GDB_TY_GROUP)
|
if ( nGroup < NFE_MIN_CHAR || m_pGDB->GetGdbType( nGroup) != GDB_TY_GROUP)
|
||||||
nGroup = NFE_ERR_CHAR ;
|
nGroup = NFE_ERR_CHAR ;
|
||||||
// ciclo sulle entità geometriche del carattere
|
// ciclo sulle entità geometriche del carattere
|
||||||
bool bIter = pIter->GoToFirstInGroup( nGroup) ;
|
bool bIter = iIter.GoToFirstInGroup( nGroup) ;
|
||||||
while ( bIter) {
|
while ( bIter) {
|
||||||
const ICurve* pCrv = GetCurve( pIter->GetGeoObj()) ;
|
const ICurve* pCrv = GetCurve( iIter.GetGeoObj()) ;
|
||||||
if ( pCrv != nullptr) {
|
if ( pCrv != nullptr) {
|
||||||
// copia temporanea della curva (trasformando eventuali archi in CurveBezier)
|
// copia temporanea della curva (trasformando eventuali archi in CurveBezier)
|
||||||
PtrOwner<ICurve> pCrvNew( CurveToNoArcsCurve( pCrv)) ;
|
PtrOwner<ICurve> pCrvNew( CurveToNoArcsCurve( pCrv)) ;
|
||||||
@@ -371,7 +360,7 @@ NfeFont::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, doub
|
|||||||
lstPL.emplace_back() ;
|
lstPL.emplace_back() ;
|
||||||
pCrvNew->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, lstPL.back()) ;
|
pCrvNew->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, lstPL.back()) ;
|
||||||
}
|
}
|
||||||
bIter = pIter->GoToNext() ;
|
bIter = iIter.GoToNext() ;
|
||||||
}
|
}
|
||||||
// recupero lo spostamento per il prossimo carattere
|
// recupero lo spostamento per il prossimo carattere
|
||||||
double dAdvance ;
|
double dAdvance ;
|
||||||
@@ -400,9 +389,7 @@ NfeFont::ApproxWithArcs( const string& sText, int nInsPos, double dLinTol, doubl
|
|||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// creo un iteratore
|
// creo un iteratore
|
||||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGDB)) ;
|
GdbIterator iIter( m_pGDB) ;
|
||||||
if ( IsNull( pIter))
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
// controllo valore tolleranza lineare
|
// controllo valore tolleranza lineare
|
||||||
if ( dLinTol > FNT_MAX_LINTOL_TO_H * m_dHeight)
|
if ( dLinTol > FNT_MAX_LINTOL_TO_H * m_dHeight)
|
||||||
@@ -440,9 +427,9 @@ NfeFont::ApproxWithArcs( const string& sText, int nInsPos, double dLinTol, doubl
|
|||||||
if ( nGroup < NFE_MIN_CHAR || m_pGDB->GetGdbType( nGroup) != GDB_TY_GROUP)
|
if ( nGroup < NFE_MIN_CHAR || m_pGDB->GetGdbType( nGroup) != GDB_TY_GROUP)
|
||||||
nGroup = NFE_ERR_CHAR ;
|
nGroup = NFE_ERR_CHAR ;
|
||||||
// ciclo sulle entità geometriche del carattere
|
// ciclo sulle entità geometriche del carattere
|
||||||
bool bIter = pIter->GoToFirstInGroup( nGroup) ;
|
bool bIter = iIter.GoToFirstInGroup( nGroup) ;
|
||||||
while ( bIter) {
|
while ( bIter) {
|
||||||
const ICurve* pCrv = GetCurve( pIter->GetGeoObj()) ;
|
const ICurve* pCrv = GetCurve( iIter.GetGeoObj()) ;
|
||||||
if ( pCrv != nullptr) {
|
if ( pCrv != nullptr) {
|
||||||
// copia temporanea della curva (trasformando eventuali archi in CurveBezier)
|
// copia temporanea della curva (trasformando eventuali archi in CurveBezier)
|
||||||
PtrOwner<ICurve> pCrvNew( CurveToNoArcsCurve( pCrv)) ;
|
PtrOwner<ICurve> pCrvNew( CurveToNoArcsCurve( pCrv)) ;
|
||||||
@@ -457,7 +444,7 @@ NfeFont::ApproxWithArcs( const string& sText, int nInsPos, double dLinTol, doubl
|
|||||||
lstPA.emplace_back() ;
|
lstPA.emplace_back() ;
|
||||||
pCrv->ApproxWithArcs( dLinTol, dAngTolDeg, lstPA.back()) ;
|
pCrv->ApproxWithArcs( dLinTol, dAngTolDeg, lstPA.back()) ;
|
||||||
}
|
}
|
||||||
bIter = pIter->GoToNext() ;
|
bIter = iIter.GoToNext() ;
|
||||||
}
|
}
|
||||||
// recupero lo spostamento per il prossimo carattere
|
// recupero lo spostamento per il prossimo carattere
|
||||||
double dAdvance ;
|
double dAdvance ;
|
||||||
@@ -484,11 +471,6 @@ NfeFont::GetTextLines( const string& sText, int nInsPos, PNTVECTOR& vPt, STRVECT
|
|||||||
if ( m_pGDB == nullptr || m_sFont.empty())
|
if ( m_pGDB == nullptr || m_sFont.empty())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// creo un iteratore
|
|
||||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGDB)) ;
|
|
||||||
if ( IsNull( pIter))
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
// calcolo i fattori di scala
|
// calcolo i fattori di scala
|
||||||
double dScaY = m_dHeight / m_dHCap ;
|
double dScaY = m_dHeight / m_dHCap ;
|
||||||
double dScaX = dScaY * m_dRatio ;
|
double dScaX = dScaY * m_dRatio ;
|
||||||
|
|||||||
+11
-14
@@ -16,15 +16,15 @@
|
|||||||
#include "FontOs.h"
|
#include "FontOs.h"
|
||||||
#include "FontAux.h"
|
#include "FontAux.h"
|
||||||
#include "FontConst.h"
|
#include "FontConst.h"
|
||||||
|
#include "CurveLine.h"
|
||||||
|
#include "CurveBezier.h"
|
||||||
|
#include "CurveComposite.h"
|
||||||
#include "SurfFlatRegion.h"
|
#include "SurfFlatRegion.h"
|
||||||
#include "GeoConst.h"
|
#include "GeoConst.h"
|
||||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||||
#include "/EgtDev/Include/EGkCurve.h"
|
#include "/EgtDev/Include/EGkCurve.h"
|
||||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
|
||||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||||
@@ -298,8 +298,7 @@ OsFont::GetOutline( const string& sText, int nInsPos, ICURVEPLIST& lstPC) const
|
|||||||
if ( ! GetCharOutline( vCode[i], dAdvance, lstTmpPC))
|
if ( ! GetCharOutline( vCode[i], dAdvance, lstTmpPC))
|
||||||
return false ;
|
return false ;
|
||||||
// lo trasformo opportunamente
|
// lo trasformo opportunamente
|
||||||
ICURVEPLIST::iterator iIter ;
|
for ( auto iIter = lstTmpPC.begin() ; iIter != lstTmpPC.end() ; ++ iIter) {
|
||||||
for ( iIter = lstTmpPC.begin() ; iIter != lstTmpPC.end() ; ++ iIter) {
|
|
||||||
// trasformazioni
|
// trasformazioni
|
||||||
(*iIter)->Scale( GLOB_FRM, dScaX, dScaY, dScaZ) ;
|
(*iIter)->Scale( GLOB_FRM, dScaX, dScaY, dScaZ) ;
|
||||||
(*iIter)->Translate( vtMove) ;
|
(*iIter)->Translate( vtMove) ;
|
||||||
@@ -464,8 +463,7 @@ OsFont::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, doubl
|
|||||||
if ( ! GetCharOutline( vCode[i], dAdvance, lstPC))
|
if ( ! GetCharOutline( vCode[i], dAdvance, lstPC))
|
||||||
return false ;
|
return false ;
|
||||||
// lo approssimo con segmenti di retta
|
// lo approssimo con segmenti di retta
|
||||||
ICURVEPLIST::iterator iIter ;
|
for ( auto iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter) {
|
||||||
for ( iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter) {
|
|
||||||
// trasformazioni
|
// trasformazioni
|
||||||
(*iIter)->Scale( GLOB_FRM, dScaX, dScaY, dScaZ) ;
|
(*iIter)->Scale( GLOB_FRM, dScaX, dScaY, dScaZ) ;
|
||||||
(*iIter)->Translate( vtMove) ;
|
(*iIter)->Translate( vtMove) ;
|
||||||
@@ -478,7 +476,7 @@ OsFont::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, doubl
|
|||||||
if ( vtMove.x > dMaxW)
|
if ( vtMove.x > dMaxW)
|
||||||
dMaxW = vtMove.x ;
|
dMaxW = vtMove.x ;
|
||||||
// ciclo di pulizia
|
// ciclo di pulizia
|
||||||
for ( iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter)
|
for ( auto iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter)
|
||||||
delete (*iIter) ;
|
delete (*iIter) ;
|
||||||
lstPC.clear() ;
|
lstPC.clear() ;
|
||||||
}
|
}
|
||||||
@@ -549,8 +547,7 @@ OsFont::ApproxWithArcs( const string& sText, int nInsPos, double dLinTol, double
|
|||||||
if ( ! GetCharOutline( vCode[i], dAdvance, lstPC))
|
if ( ! GetCharOutline( vCode[i], dAdvance, lstPC))
|
||||||
return false ;
|
return false ;
|
||||||
// lo approssimo con segmenti di arco e retta
|
// lo approssimo con segmenti di arco e retta
|
||||||
ICURVEPLIST::iterator iIter ;
|
for ( auto iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter) {
|
||||||
for ( iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter) {
|
|
||||||
// trasformazioni
|
// trasformazioni
|
||||||
(*iIter)->Scale( GLOB_FRM, dScaX, dScaY, dScaZ) ;
|
(*iIter)->Scale( GLOB_FRM, dScaX, dScaY, dScaZ) ;
|
||||||
(*iIter)->Translate( vtMove) ;
|
(*iIter)->Translate( vtMove) ;
|
||||||
@@ -563,7 +560,7 @@ OsFont::ApproxWithArcs( const string& sText, int nInsPos, double dLinTol, double
|
|||||||
if ( vtMove.x > dMaxW)
|
if ( vtMove.x > dMaxW)
|
||||||
dMaxW = vtMove.x ;
|
dMaxW = vtMove.x ;
|
||||||
// ciclo di pulizia
|
// ciclo di pulizia
|
||||||
for ( iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter)
|
for ( auto iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter)
|
||||||
delete (*iIter) ;
|
delete (*iIter) ;
|
||||||
lstPC.clear() ;
|
lstPC.clear() ;
|
||||||
}
|
}
|
||||||
@@ -730,7 +727,7 @@ OsFont::GetCharOutline( unsigned int nChar, double& dAdvance, ICURVEPLIST& lstPC
|
|||||||
if ( pHeader->dwType == TT_POLYGON_TYPE) {
|
if ( pHeader->dwType == TT_POLYGON_TYPE) {
|
||||||
|
|
||||||
// creo curva composita
|
// creo curva composita
|
||||||
PtrOwner<ICurveComposite> pCCompo( CreateCurveComposite()) ;
|
PtrOwner<CurveComposite> pCCompo( CreateBasicCurveComposite()) ;
|
||||||
if ( IsNull( pCCompo))
|
if ( IsNull( pCCompo))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
@@ -823,7 +820,7 @@ OsFont::AddLineToCompo( ICurveComposite* pCCompo, const Point3d& ptStart, const
|
|||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// creo retta, la imposto e la inserisco nella curva composita
|
// creo retta, la imposto e la inserisco nella curva composita
|
||||||
PtrOwner<ICurveLine> pCLine( CreateCurveLine()) ;
|
PtrOwner<CurveLine> pCLine( CreateBasicCurveLine()) ;
|
||||||
if ( IsNull( pCLine))
|
if ( IsNull( pCLine))
|
||||||
return false ;
|
return false ;
|
||||||
if ( ! pCLine->Set( ptStart, ptEnd))
|
if ( ! pCLine->Set( ptStart, ptEnd))
|
||||||
@@ -844,7 +841,7 @@ OsFont::AddCBezierQuadToCompo( ICurveComposite* pCCompo,
|
|||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// creo curva di Bezier quadratica, la imposto e la inserisco nella curva composita
|
// creo curva di Bezier quadratica, la imposto e la inserisco nella curva composita
|
||||||
PtrOwner<ICurveBezier> pCBezier( CreateCurveBezier()) ;
|
PtrOwner<CurveBezier> pCBezier( CreateBasicCurveBezier()) ;
|
||||||
if ( IsNull( pCBezier))
|
if ( IsNull( pCBezier))
|
||||||
return false ;
|
return false ;
|
||||||
if ( ! pCBezier->Init( 2, false) ||
|
if ( ! pCBezier->Init( 2, false) ||
|
||||||
|
|||||||
+17
@@ -37,6 +37,23 @@ Frame3d::Set( const Point3d& ptOrig, const Vector3d& vtDirX,
|
|||||||
! m_vtVersZ.Normalize())
|
! m_vtVersZ.Normalize())
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// se ci sono errori molto piccoli di ortogonalità, li correggo
|
||||||
|
double dOrtXZ = m_vtVersX * m_vtVersZ ;
|
||||||
|
if ( dOrtXZ > EPS_ZERO && dOrtXZ < 10 * EPS_ZERO) {
|
||||||
|
m_vtVersX = OrthoCompo( m_vtVersX, m_vtVersZ) ;
|
||||||
|
m_vtVersX.Normalize() ;
|
||||||
|
}
|
||||||
|
double dOrtYX = m_vtVersY * m_vtVersX ;
|
||||||
|
if ( dOrtYX > EPS_ZERO && dOrtYX < 10 * EPS_ZERO) {
|
||||||
|
m_vtVersY = OrthoCompo( m_vtVersY, m_vtVersX) ;
|
||||||
|
m_vtVersY.Normalize() ;
|
||||||
|
}
|
||||||
|
double dOrtYZ = m_vtVersY * m_vtVersZ ;
|
||||||
|
if ( dOrtYZ > EPS_ZERO && dOrtYZ < 10 * EPS_ZERO) {
|
||||||
|
m_vtVersY = OrthoCompo( m_vtVersY, m_vtVersZ) ;
|
||||||
|
m_vtVersY.Normalize() ;
|
||||||
|
}
|
||||||
|
|
||||||
// verifica della ortogonalità dei versori e del senso destrorso
|
// verifica della ortogonalità dei versori e del senso destrorso
|
||||||
if ( ! Verify())
|
if ( ! Verify())
|
||||||
return false ;
|
return false ;
|
||||||
|
|||||||
+56
-106
@@ -1423,8 +1423,7 @@ GdbExecutor::CurveArcChangeRadius( const STRVECTOR& vsParams)
|
|||||||
if ( ! GetLengthParam( vsParams[1], dNewRad))
|
if ( ! GetLengthParam( vsParams[1], dNewRad))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione
|
// esecuzione
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
// recupero l'arco
|
// recupero l'arco
|
||||||
ICurveArc* pCrvArc = GetCurveArc( m_pGDB->GetGeoObj( *Iter)) ;
|
ICurveArc* pCrvArc = GetCurveArc( m_pGDB->GetGeoObj( *Iter)) ;
|
||||||
if ( pCrvArc == nullptr)
|
if ( pCrvArc == nullptr)
|
||||||
@@ -1452,8 +1451,7 @@ GdbExecutor::CurveArcChangeDeltaN( const STRVECTOR& vsParams)
|
|||||||
if ( ! GetLengthParam( vsParams[1], dNewDeltaN))
|
if ( ! GetLengthParam( vsParams[1], dNewDeltaN))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione
|
// esecuzione
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
// recupero l'arco
|
// recupero l'arco
|
||||||
ICurveArc* pCrvArc = GetCurveArc( m_pGDB->GetGeoObj( *Iter)) ;
|
ICurveArc* pCrvArc = GetCurveArc( m_pGDB->GetGeoObj( *Iter)) ;
|
||||||
if ( pCrvArc == nullptr)
|
if ( pCrvArc == nullptr)
|
||||||
@@ -1686,8 +1684,7 @@ GdbExecutor::CurveCompoMake( const STRVECTOR& vsParams)
|
|||||||
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frDest))
|
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frDest))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione
|
// esecuzione
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
// recupero la curva
|
// recupero la curva
|
||||||
int nIdCrv = *Iter ;
|
int nIdCrv = *Iter ;
|
||||||
const ICurve* pCrv = GetCurve( m_pGDB->GetGeoObj( nIdCrv)) ;
|
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))) {
|
if ( AddGeoObj( vsParams[0], vsParams[1], Release( pCrvCompo))) {
|
||||||
// se richiesto, cancello le curve originali
|
// se richiesto, cancello le curve originali
|
||||||
if ( bErase) {
|
if ( bErase) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
if ( ! m_pGDB->Erase( *Iter))
|
if ( ! m_pGDB->Erase( *Iter))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -2309,8 +2306,7 @@ GdbExecutor::SurfTriMeshByTriangleSoup( const STRVECTOR& vsParams)
|
|||||||
if ( ! StmFts.Start())
|
if ( ! StmFts.Start())
|
||||||
return false ;
|
return false ;
|
||||||
// Recupero tutti i triangoli delle superfici sorgenti e li inserisco nella nuova
|
// Recupero tutti i triangoli delle superfici sorgenti e li inserisco nella nuova
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
// recupero la superficie sorgente
|
// recupero la superficie sorgente
|
||||||
const ISurfTriMesh* pStmS = GetSurfTriMesh( m_pGDB->GetGeoObj( *Iter)) ;
|
const ISurfTriMesh* pStmS = GetSurfTriMesh( m_pGDB->GetGeoObj( *Iter)) ;
|
||||||
if ( pStmS == nullptr)
|
if ( pStmS == nullptr)
|
||||||
@@ -2340,7 +2336,7 @@ GdbExecutor::SurfTriMeshByTriangleSoup( const STRVECTOR& vsParams)
|
|||||||
if ( AddGeoObj( vsParams[0], vsParams[1], pSTM)) {
|
if ( AddGeoObj( vsParams[0], vsParams[1], pSTM)) {
|
||||||
// se richiesto, cancello le curve originali
|
// se richiesto, cancello le curve originali
|
||||||
if ( bErase) {
|
if ( bErase) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
if ( ! m_pGDB->Erase( *Iter))
|
if ( ! m_pGDB->Erase( *Iter))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -2534,8 +2530,7 @@ GdbExecutor::SurfTriMeshDoCompacting( const STRVECTOR& vsParams)
|
|||||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||||
return false ;
|
return false ;
|
||||||
// opero sui diversi oggetti
|
// opero sui diversi oggetti
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
// recupero la superficie
|
// recupero la superficie
|
||||||
ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( *Iter)) ;
|
ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( *Iter)) ;
|
||||||
if ( pStm == nullptr)
|
if ( pStm == nullptr)
|
||||||
@@ -2572,8 +2567,7 @@ GdbExecutor::SurfTriMeshDoSewing( const STRVECTOR& vsParams)
|
|||||||
if ( ! GetNamesParam( vsParams[1], vnNames))
|
if ( ! GetNamesParam( vsParams[1], vnNames))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione
|
// esecuzione
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
// recupero la superficie da cucire
|
// recupero la superficie da cucire
|
||||||
const ISurfTriMesh* pStmS = GetSurfTriMesh( m_pGDB->GetGeoObj( *Iter)) ;
|
const ISurfTriMesh* pStmS = GetSurfTriMesh( m_pGDB->GetGeoObj( *Iter)) ;
|
||||||
if ( pStmS == nullptr)
|
if ( pStmS == nullptr)
|
||||||
@@ -2590,7 +2584,7 @@ GdbExecutor::SurfTriMeshDoSewing( const STRVECTOR& vsParams)
|
|||||||
}
|
}
|
||||||
// se richiesto, cancello le superfici cucite alla prima
|
// se richiesto, cancello le superfici cucite alla prima
|
||||||
if ( bErase) {
|
if ( bErase) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter)
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter)
|
||||||
m_pGDB->Erase( *Iter) ;
|
m_pGDB->Erase( *Iter) ;
|
||||||
}
|
}
|
||||||
return true ;
|
return true ;
|
||||||
@@ -3079,7 +3073,7 @@ GdbExecutor::VolZmapBBoxZmapIntersection( const STRVECTOR& vsParams)
|
|||||||
return false ;
|
return false ;
|
||||||
bool bInt ;
|
bool bInt ;
|
||||||
|
|
||||||
bInt = ! pZmap->AvoidBox( frBBoxFrame, ptEnd - ORIG) ;
|
bInt = pZmap->CDeBox( frBBoxFrame, ptEnd - ORIG) ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}*/
|
}*/
|
||||||
@@ -5432,8 +5426,7 @@ GdbExecutor::TextOutline( const STRVECTOR& vsParams)
|
|||||||
pTXT->GetOutline( lstPCRV) ;
|
pTXT->GetOutline( lstPCRV) ;
|
||||||
// inserisco le curve nel gruppo destinazione dopo aver sistemato il cambio di riferimento
|
// inserisco le curve nel gruppo destinazione dopo aver sistemato il cambio di riferimento
|
||||||
bool bOk = true ;
|
bool bOk = true ;
|
||||||
ICURVEPLIST::iterator iIter ;
|
for ( auto iIter = lstPCRV.begin() ; iIter != lstPCRV.end() ; ++ iIter) {
|
||||||
for ( iIter = lstPCRV.begin() ; iIter != lstPCRV.end() ; ++ iIter) {
|
|
||||||
(*iIter)->LocToLoc( frTXT, frDest) ;
|
(*iIter)->LocToLoc( frTXT, frDest) ;
|
||||||
if ( m_pGDB->AddGeoObj( GDB_ID_NULL, nIdDest, (*iIter)) == GDB_ID_NULL) {
|
if ( m_pGDB->AddGeoObj( GDB_ID_NULL, nIdDest, (*iIter)) == GDB_ID_NULL) {
|
||||||
delete (*iIter) ;
|
delete (*iIter) ;
|
||||||
@@ -5510,8 +5503,7 @@ GdbExecutor::GetNamesParam( const string& sParam, INTVECTOR& vnNames)
|
|||||||
// converto in interi
|
// converto in interi
|
||||||
vnNames.clear() ;
|
vnNames.clear() ;
|
||||||
vnNames.reserve( vsNames.size()) ;
|
vnNames.reserve( vsNames.size()) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsNames.begin() ; Iter != vsNames.end() ; ++Iter) {
|
||||||
for ( Iter = vsNames.begin() ; Iter != vsNames.end() ; ++Iter) {
|
|
||||||
Trim( (*Iter), " \t\r\n()") ;
|
Trim( (*Iter), " \t\r\n()") ;
|
||||||
int nId = GetIdParam( *Iter) ;
|
int nId = GetIdParam( *Iter) ;
|
||||||
if ( nId != GDB_ID_SEL) {
|
if ( nId != GDB_ID_SEL) {
|
||||||
@@ -5538,8 +5530,7 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
|
|||||||
// divido in parti
|
// divido in parti
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sParam, ",", vsParams) ;
|
Tokenize( sParam, ",", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n()") ;
|
Trim( (*Iter), " \t\r\n()") ;
|
||||||
// se 2 parti, allora Z = 0
|
// se 2 parti, allora Z = 0
|
||||||
if ( vsParams.size() == 2) {
|
if ( vsParams.size() == 2) {
|
||||||
@@ -5594,8 +5585,7 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
|
|||||||
// recupero i parametri associati
|
// recupero i parametri associati
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sParam.substr( 3, sParam.length()-4), ",", "(", ")", vsParams) ;
|
Tokenize( sParam.substr( 3, sParam.length()-4), ",", "(", ")", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n") ;
|
Trim( (*Iter), " \t\r\n") ;
|
||||||
// ci deve essere almeno un parametro
|
// ci deve essere almeno un parametro
|
||||||
if ( vsParams.size() < 1)
|
if ( vsParams.size() < 1)
|
||||||
@@ -5747,8 +5737,7 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
|
|||||||
// divido in parti
|
// divido in parti
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sParam, ",", vsParams) ;
|
Tokenize( sParam, ",", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n()") ;
|
Trim( (*Iter), " \t\r\n()") ;
|
||||||
// se 2 parti, allora Z = 0
|
// se 2 parti, allora Z = 0
|
||||||
if ( vsParams.size() == 2) {
|
if ( vsParams.size() == 2) {
|
||||||
@@ -5778,8 +5767,7 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
|
|||||||
// recupero i parametri associati
|
// recupero i parametri associati
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sParam.substr( 3, sParam.length()-4), ",", "(", ")", vsParams) ;
|
Tokenize( sParam.substr( 3, sParam.length()-4), ",", "(", ")", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n") ;
|
Trim( (*Iter), " \t\r\n") ;
|
||||||
// ci deve essere almeno un parametro
|
// ci deve essere almeno un parametro
|
||||||
if ( vsParams.size() < 1)
|
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) ;
|
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsPoints) ;
|
||||||
// converto in punti
|
// converto in punti
|
||||||
PL.Clear() ;
|
PL.Clear() ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsPoints.begin() ; Iter != vsPoints.end() ; ++Iter) {
|
||||||
for ( Iter = vsPoints.begin() ; Iter != vsPoints.end() ; ++Iter) {
|
|
||||||
Trim( (*Iter), " \t\r\n") ;
|
Trim( (*Iter), " \t\r\n") ;
|
||||||
if ( GetIdParam( *Iter) == GDB_ID_SEL) {
|
if ( GetIdParam( *Iter) == GDB_ID_SEL) {
|
||||||
int nId = m_pGDB->GetFirstSelectedObj() ;
|
int nId = m_pGDB->GetFirstSelectedObj() ;
|
||||||
@@ -5997,8 +5984,7 @@ GdbExecutor::GetPointWParam( const string& sParam, const Frame3d& frPnt, Point3d
|
|||||||
// divido in parti
|
// divido in parti
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsParams) ;
|
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n") ;
|
Trim( (*Iter), " \t\r\n") ;
|
||||||
|
|
||||||
// se 4 parti, sono 3 coordinate e un peso
|
// 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) ;
|
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsPointWs) ;
|
||||||
// converto in punti
|
// converto in punti
|
||||||
PA.Clear() ;
|
PA.Clear() ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsPointWs.begin() ; Iter != vsPointWs.end() ; ++Iter) {
|
||||||
for ( Iter = vsPointWs.begin() ; Iter != vsPointWs.end() ; ++Iter) {
|
|
||||||
Trim( (*Iter), " \t\r\n") ;
|
Trim( (*Iter), " \t\r\n") ;
|
||||||
Point3d ptP ;
|
Point3d ptP ;
|
||||||
double dBulge ;
|
double dBulge ;
|
||||||
@@ -6059,8 +6044,7 @@ GdbExecutor::GetLengthParam( const string& sParam, double& dLen)
|
|||||||
// recupero i parametri associati
|
// recupero i parametri associati
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n()") ;
|
Trim( (*Iter), " \t\r\n()") ;
|
||||||
// ci deve essere almeno un parametro
|
// ci deve essere almeno un parametro
|
||||||
if ( vsParams.size() < 1)
|
if ( vsParams.size() < 1)
|
||||||
@@ -6082,8 +6066,7 @@ GdbExecutor::GetLengthParam( const string& sParam, double& dLen)
|
|||||||
// recupero i parametri associati
|
// recupero i parametri associati
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n()") ;
|
Trim( (*Iter), " \t\r\n()") ;
|
||||||
// ci deve essere almeno un parametro
|
// ci deve essere almeno un parametro
|
||||||
if ( vsParams.size() < 1)
|
if ( vsParams.size() < 1)
|
||||||
@@ -6118,8 +6101,7 @@ GdbExecutor::GetDirParam( const string& sParam, const Frame3d& frDir, double& dD
|
|||||||
// recupero i parametri associati
|
// recupero i parametri associati
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sParam.substr( 3, sParam.length()-4), ",", "(", ")", vsParams) ;
|
Tokenize( sParam.substr( 3, sParam.length()-4), ",", "(", ")", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n") ;
|
Trim( (*Iter), " \t\r\n") ;
|
||||||
// ci deve essere almeno un parametro
|
// ci deve essere almeno un parametro
|
||||||
if ( vsParams.size() < 1)
|
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
|
// divido in parti ed elimino spazi iniziali/finali
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sTmp, ",", "(", ")", vsParams) ;
|
Tokenize( sTmp, ",", "(", ")", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n") ;
|
Trim( (*Iter), " \t\r\n") ;
|
||||||
// verifico siano 4 parti e le converto
|
// verifico siano 4 parti e le converto
|
||||||
if ( vsParams.size() != 4)
|
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
|
// divido in parti ed elimino spazi iniziali/finali
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sTmp, ",", "(", ")", vsParams) ;
|
Tokenize( sTmp, ",", "(", ")", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n") ;
|
Trim( (*Iter), " \t\r\n") ;
|
||||||
// se c'è un parametro è l'origine
|
// se c'è un parametro è l'origine
|
||||||
Point3d ptOrig ;
|
Point3d ptOrig ;
|
||||||
@@ -6358,8 +6338,7 @@ GdbExecutor::GetColorParam( const string& sParam, bool& bByParent, Color& cCol)
|
|||||||
// divido in parti
|
// divido in parti
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sParam, ",", vsParams) ;
|
Tokenize( sParam, ",", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n()") ;
|
Trim( (*Iter), " \t\r\n()") ;
|
||||||
// devono essere 3 o 4 parametri ( Red, Green, Blue [, Alpha])
|
// devono essere 3 o 4 parametri ( Red, Green, Blue [, Alpha])
|
||||||
if ( vsParams.size() != 3 && vsParams.size() != 4)
|
if ( vsParams.size() != 3 && vsParams.size() != 4)
|
||||||
@@ -6387,8 +6366,7 @@ GdbExecutor::GetColorParam( const string& sParam, bool& bByParent, Color& cCol)
|
|||||||
// recupero i parametri associati
|
// recupero i parametri associati
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n()") ;
|
Trim( (*Iter), " \t\r\n()") ;
|
||||||
// ci deve essere un parametro
|
// ci deve essere un parametro
|
||||||
if ( vsParams.size() != 1)
|
if ( vsParams.size() != 1)
|
||||||
@@ -6421,8 +6399,7 @@ GdbExecutor::GetMaterialParam( const string& sParam, bool& bByParent, int& nMat)
|
|||||||
// recupero i parametri associati
|
// recupero i parametri associati
|
||||||
STRVECTOR vsParams ;
|
STRVECTOR vsParams ;
|
||||||
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
||||||
STRVECTOR::iterator Iter ;
|
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
|
||||||
Trim( (*Iter), " \t\r\n()") ;
|
Trim( (*Iter), " \t\r\n()") ;
|
||||||
// ci deve essere un parametro
|
// ci deve essere un parametro
|
||||||
if ( vsParams.size() != 1)
|
if ( vsParams.size() != 1)
|
||||||
@@ -6479,8 +6456,7 @@ GdbExecutor::ExecuteLevel( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
else
|
else
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione impostazione livello
|
// esecuzione impostazione livello
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( ! m_pGDB->SetLevel( *Iter, nLevel))
|
if ( ! m_pGDB->SetLevel( *Iter, nLevel))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -6511,8 +6487,7 @@ GdbExecutor::ExecuteMode( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
else
|
else
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione impostazione modo
|
// esecuzione impostazione modo
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( ! m_pGDB->SetMode( *Iter, nMode))
|
if ( ! m_pGDB->SetMode( *Iter, nMode))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -6543,8 +6518,7 @@ GdbExecutor::ExecuteStatus( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
else
|
else
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione impostazione stato
|
// esecuzione impostazione stato
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( ! m_pGDB->SetStatus( *Iter, nStat))
|
if ( ! m_pGDB->SetStatus( *Iter, nStat))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -6565,8 +6539,7 @@ GdbExecutor::ExecuteSelect( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione selezione
|
// esecuzione selezione
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( ! m_pGDB->SelectObj( *Iter))
|
if ( ! m_pGDB->SelectObj( *Iter))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -6610,8 +6583,7 @@ GdbExecutor::ExecuteSelect( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
nFilter = EXT_TEXT ;
|
nFilter = EXT_TEXT ;
|
||||||
}
|
}
|
||||||
// esecuzione selezione di tutti gli oggetti di ogni gruppo
|
// esecuzione selezione di tutti gli oggetti di ogni gruppo
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( ! m_pGDB->SelectGroupObjs( *Iter, nFilter))
|
if ( ! m_pGDB->SelectGroupObjs( *Iter, nFilter))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -6635,8 +6607,7 @@ GdbExecutor::ExecuteDeselect( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione deselezione
|
// esecuzione deselezione
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( ! m_pGDB->DeselectObj( *Iter))
|
if ( ! m_pGDB->DeselectObj( *Iter))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -6652,8 +6623,7 @@ GdbExecutor::ExecuteDeselect( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione deselezione di tutti gli oggetti di ogni gruppo
|
// esecuzione deselezione di tutti gli oggetti di ogni gruppo
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( ! m_pGDB->DeselectGroupObjs( *Iter))
|
if ( ! m_pGDB->DeselectGroupObjs( *Iter))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -6710,8 +6680,7 @@ GdbExecutor::MaterialColor( const STRVECTOR& vsParams)
|
|||||||
if ( ! GetColorParam( vsParams[1], bByParent, cCol))
|
if ( ! GetColorParam( vsParams[1], bByParent, cCol))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione impostazione colore
|
// esecuzione impostazione colore
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( bByParent) {
|
if ( bByParent) {
|
||||||
if ( ! m_pGDB->SetMaterial( *Iter, GDB_MT_PARENT))
|
if ( ! m_pGDB->SetMaterial( *Iter, GDB_MT_PARENT))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -6741,8 +6710,7 @@ GdbExecutor::MaterialMaterial( const STRVECTOR& vsParams)
|
|||||||
if ( ! GetMaterialParam( vsParams[1], bByParent, nMat))
|
if ( ! GetMaterialParam( vsParams[1], bByParent, nMat))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione impostazione colore
|
// esecuzione impostazione colore
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( bByParent) {
|
if ( bByParent) {
|
||||||
if ( ! m_pGDB->SetMaterial( *Iter, GDB_MT_PARENT))
|
if ( ! m_pGDB->SetMaterial( *Iter, GDB_MT_PARENT))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -6789,8 +6757,7 @@ GdbExecutor::ExecuteName( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! GetStringParam( vsParams[1], sName))
|
if ( ! GetStringParam( vsParams[1], sName))
|
||||||
return false ;
|
return false ;
|
||||||
// eseguo assegnazione nome
|
// eseguo assegnazione nome
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( ! m_pGDB->SetName( *Iter, sName))
|
if ( ! m_pGDB->SetName( *Iter, sName))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -6806,8 +6773,7 @@ GdbExecutor::ExecuteName( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||||
return false ;
|
return false ;
|
||||||
// eseguo rimozione nome
|
// eseguo rimozione nome
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( ! m_pGDB->RemoveName( *Iter))
|
if ( ! m_pGDB->RemoveName( *Iter))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -6839,8 +6805,7 @@ GdbExecutor::ExecuteInfo( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! GetStringParam( vsParams[2], sInfo))
|
if ( ! GetStringParam( vsParams[2], sInfo))
|
||||||
return false ;
|
return false ;
|
||||||
// eseguo assegnazione Info di data Key
|
// eseguo assegnazione Info di data Key
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( ! m_pGDB->SetInfo( *Iter, sKey, sInfo))
|
if ( ! m_pGDB->SetInfo( *Iter, sKey, sInfo))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -6860,8 +6825,7 @@ GdbExecutor::ExecuteInfo( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! GetStringParam( vsParams[1], sKey))
|
if ( ! GetStringParam( vsParams[1], sKey))
|
||||||
return false ;
|
return false ;
|
||||||
// eseguo rimozione nome Info di data Key
|
// eseguo rimozione nome Info di data Key
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( ! m_pGDB->RemoveInfo( *Iter, sKey))
|
if ( ! m_pGDB->RemoveInfo( *Iter, sKey))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -7010,8 +6974,7 @@ GdbExecutor::ExecuteRelocate( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
// recupero flag per globale
|
// recupero flag per globale
|
||||||
bool bGlob = ( sCmd2 == "GLOB" || sCmd2 == "G") ;
|
bool bGlob = ( sCmd2 == "GLOB" || sCmd2 == "G") ;
|
||||||
// esecuzione rilocazioni
|
// esecuzione rilocazioni
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( bGlob) {
|
if ( bGlob) {
|
||||||
if ( ! m_pGDB->RelocateGlob( *Iter, GetIdParam( vsParams[1]), nSonBeforeAfter))
|
if ( ! m_pGDB->RelocateGlob( *Iter, GetIdParam( vsParams[1]), nSonBeforeAfter))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -7036,8 +6999,7 @@ GdbExecutor::ExecuteErase( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione cancellazioni
|
// esecuzione cancellazioni
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
if ( ! m_pGDB->Erase( *Iter))
|
if ( ! m_pGDB->Erase( *Iter))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -7079,8 +7041,7 @@ GdbExecutor::ExecuteTranslate( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! GetVectorParam( vsParams[1], frRef, vtVN))
|
if ( ! GetVectorParam( vsParams[1], frRef, vtVN))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione traslazioni
|
// esecuzione traslazioni
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
switch ( nTraType) {
|
switch ( nTraType) {
|
||||||
case TRA_LOC :
|
case TRA_LOC :
|
||||||
if ( ! m_pGDB->Translate( *Iter, vtVN))
|
if ( ! m_pGDB->Translate( *Iter, vtVN))
|
||||||
@@ -7144,8 +7105,7 @@ GdbExecutor::ExecuteRotate( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! FromString( vsParams[3], dAngDeg))
|
if ( ! FromString( vsParams[3], dAngDeg))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione rotazioni
|
// esecuzione rotazioni
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
switch ( nRotType) {
|
switch ( nRotType) {
|
||||||
case ROT_LOC :
|
case ROT_LOC :
|
||||||
if ( ! m_pGDB->Rotate( *Iter, ptPC, vtVN, dAngDeg))
|
if ( ! m_pGDB->Rotate( *Iter, ptPC, vtVN, dAngDeg))
|
||||||
@@ -7214,8 +7174,7 @@ GdbExecutor::ExecuteScale( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
! FromString( vsParams[4], dCoeffZ))
|
! FromString( vsParams[4], dCoeffZ))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione scalature
|
// esecuzione scalature
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
switch ( nScaType) {
|
switch ( nScaType) {
|
||||||
case SCA_LOC :
|
case SCA_LOC :
|
||||||
if ( ! m_pGDB->Scale( *Iter, frFrame, dCoeffX, dCoeffY, dCoeffZ))
|
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))
|
if ( ! GetVectorParam( vsParams[2], frRef, vtVN))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione specchiature
|
// esecuzione specchiature
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
switch ( nMirType) {
|
switch ( nMirType) {
|
||||||
case MIR_LOC :
|
case MIR_LOC :
|
||||||
if ( ! m_pGDB->Mirror( *Iter, ptPC, vtVN))
|
if ( ! m_pGDB->Mirror( *Iter, ptPC, vtVN))
|
||||||
@@ -7340,8 +7298,7 @@ GdbExecutor::ExecuteShear( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! FromString( vsParams[4], dCoeff))
|
if ( ! FromString( vsParams[4], dCoeff))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione scorrimenti
|
// esecuzione scorrimenti
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
switch ( nMirType) {
|
switch ( nMirType) {
|
||||||
case MIR_LOC :
|
case MIR_LOC :
|
||||||
if ( ! m_pGDB->Shear( *Iter, ptPC, vtNorm, vtDir, dCoeff))
|
if ( ! m_pGDB->Shear( *Iter, ptPC, vtNorm, vtDir, dCoeff))
|
||||||
@@ -7400,8 +7357,7 @@ GdbExecutor::CurveModifyInvert( const STRVECTOR& vsParams)
|
|||||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione inversione curve
|
// esecuzione inversione curve
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
ICurve* pCurve = GetCurve( m_pGDB->GetGeoObj( *Iter)) ;
|
ICurve* pCurve = GetCurve( m_pGDB->GetGeoObj( *Iter)) ;
|
||||||
if ( pCurve == nullptr || ! pCurve->Invert())
|
if ( pCurve == nullptr || ! pCurve->Invert())
|
||||||
return false ;
|
return false ;
|
||||||
@@ -7518,8 +7474,7 @@ GdbExecutor::CurveModifyTrim( const STRVECTOR& vsParams, int nTrimType)
|
|||||||
if ( ! FromString( vsParams[1], dPar))
|
if ( ! FromString( vsParams[1], dPar))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione trim
|
// esecuzione trim
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
ICurve* pCurve ;
|
ICurve* pCurve ;
|
||||||
if ( ( pCurve = GetCurve( m_pGDB->GetGeoObj( *Iter))) != nullptr) {
|
if ( ( pCurve = GetCurve( m_pGDB->GetGeoObj( *Iter))) != nullptr) {
|
||||||
switch ( nTrimType) {
|
switch ( nTrimType) {
|
||||||
@@ -7718,8 +7673,7 @@ GdbExecutor::CurveCopyByChain( const STRVECTOR& vsParams)
|
|||||||
// preparo i dati per il concatenamento
|
// preparo i dati per il concatenamento
|
||||||
ChainCurves chainC ;
|
ChainCurves chainC ;
|
||||||
chainC.Init( bAllowInvert, dToler, int( vnNames.size())) ;
|
chainC.Init( bAllowInvert, dToler, int( vnNames.size())) ;
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
// recupero la curva e il suo riferimento
|
// recupero la curva e il suo riferimento
|
||||||
ICurve* pCrv = GetCurve( m_pGDB->GetGeoObj( *Iter)) ;
|
ICurve* pCrv = GetCurve( m_pGDB->GetGeoObj( *Iter)) ;
|
||||||
if ( pCrv == nullptr)
|
if ( pCrv == nullptr)
|
||||||
@@ -7748,10 +7702,9 @@ GdbExecutor::CurveCopyByChain( const STRVECTOR& vsParams)
|
|||||||
if ( IsNull( pCrvCompo))
|
if ( IsNull( pCrvCompo))
|
||||||
return false ;
|
return false ;
|
||||||
// recupero le curve semplici e le inserisco nella curva composita
|
// recupero le curve semplici e le inserisco nella curva composita
|
||||||
INTVECTOR::iterator Iter2 ;
|
for ( auto Iter = vIds.cbegin() ; Iter != vIds.cend() ; ++Iter) {
|
||||||
for ( Iter2 = vIds.begin() ; Iter2 != vIds.end() ; ++Iter2) {
|
int nId = abs( *Iter) ;
|
||||||
int nId = abs( *Iter2) ;
|
bool bInvert = ( *Iter < 0) ;
|
||||||
bool bInvert = ( *Iter2 < 0) ;
|
|
||||||
// recupero la curva e il suo riferimento
|
// recupero la curva e il suo riferimento
|
||||||
ICurve* pCrv = GetCurve( m_pGDB->GetGeoObj( nId)) ;
|
ICurve* pCrv = GetCurve( m_pGDB->GetGeoObj( nId)) ;
|
||||||
if ( pCrv == nullptr)
|
if ( pCrv == nullptr)
|
||||||
@@ -7806,8 +7759,7 @@ GdbExecutor::SurfModifyInvert( const STRVECTOR& vsParams)
|
|||||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione inversione normale superficie
|
// esecuzione inversione normale superficie
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
ISurf* pSurf = GetSurf( m_pGDB->GetGeoObj( *Iter)) ;
|
ISurf* pSurf = GetSurf( m_pGDB->GetGeoObj( *Iter)) ;
|
||||||
if ( pSurf == nullptr || ! pSurf->Invert())
|
if ( pSurf == nullptr || ! pSurf->Invert())
|
||||||
return false ;
|
return false ;
|
||||||
@@ -8049,8 +8001,7 @@ GdbExecutor::ExecuteOutTsc( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione
|
// esecuzione
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
// recupero l'oggetto ed eseguo l'output
|
// recupero l'oggetto ed eseguo l'output
|
||||||
if ( ! OutGroupTsc( *Iter, nFlag))
|
if ( ! OutGroupTsc( *Iter, nFlag))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -8073,8 +8024,7 @@ GdbExecutor::ExecuteOutTsc( const string& sCmd2, const STRVECTOR& vsParams)
|
|||||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||||
return false ;
|
return false ;
|
||||||
// esecuzione
|
// esecuzione
|
||||||
INTVECTOR::iterator Iter ;
|
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
|
||||||
// recupero l'oggetto ed eseguo l'output
|
// recupero l'oggetto ed eseguo l'output
|
||||||
if ( ! m_OutTsc.PutGeoObj( m_pGDB->GetGeoObj( *Iter), nFlag))
|
if ( ! m_OutTsc.PutGeoObj( m_pGDB->GetGeoObj( *Iter), nFlag))
|
||||||
return false ;
|
return false ;
|
||||||
|
|||||||
+10
-2
@@ -101,6 +101,10 @@ GdbGeo::Save( int nBaseId, NgeWriter& ngeOut, INTUNORDSET* pSavedIds) const
|
|||||||
if ( pGObjRW == nullptr)
|
if ( pGObjRW == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
// eventuali modifiche prima del salvataggio
|
||||||
|
if ( ! pGObjRW->PreSave( * const_cast<GdbGeo*>( this)))
|
||||||
|
return false ;
|
||||||
|
|
||||||
// tipo entità e identificativi
|
// tipo entità e identificativi
|
||||||
if ( ! ngeOut.WriteKey( pGObjRW->GetNgeId()))
|
if ( ! ngeOut.WriteKey( pGObjRW->GetNgeId()))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -124,7 +128,11 @@ GdbGeo::Save( int nBaseId, NgeWriter& ngeOut, INTUNORDSET* pSavedIds) const
|
|||||||
// parametri geometrici
|
// parametri geometrici
|
||||||
if ( ! ngeOut.WriteKey( NGE_G))
|
if ( ! ngeOut.WriteKey( NGE_G))
|
||||||
return false ;
|
return false ;
|
||||||
return pGObjRW->Save( ngeOut) ;
|
if ( ! pGObjRW->Save( ngeOut))
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
// eventuali ripristini dopo il salvataggio
|
||||||
|
return pGObjRW->PostSave( * const_cast<GdbGeo*>( this)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -181,7 +189,7 @@ GdbGeo::Load( int nNgeId, NgeReader& ngeIn, int nBaseGdbId, int& nParentId)
|
|||||||
|
|
||||||
// parametri geometrici
|
// parametri geometrici
|
||||||
IGeoObjRW* pGObjRW = dynamic_cast<IGeoObjRW*>( m_pGeoObj) ;
|
IGeoObjRW* pGObjRW = dynamic_cast<IGeoObjRW*>( m_pGeoObj) ;
|
||||||
return ( pGObjRW != nullptr && pGObjRW->Load( ngeIn)) ;
|
return ( pGObjRW != nullptr && pGObjRW->Load( ngeIn) && pGObjRW->PostLoad( *this)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ GdbGroup::~GdbGroup( void)
|
|||||||
// nel sorgente aggiorno lista dei riferimenti
|
// nel sorgente aggiorno lista dei riferimenti
|
||||||
INTVECTOR vnList ;
|
INTVECTOR vnList ;
|
||||||
pGdbObj->GetInfo( GDB_SI_LIST, 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())
|
if ( iFind != vnList.end())
|
||||||
vnList.erase( iFind) ;
|
vnList.erase( iFind) ;
|
||||||
if ( vnList.empty())
|
if ( vnList.empty())
|
||||||
|
|||||||
+2
-1
@@ -1468,7 +1468,8 @@ GdbIterator::SetInfo( const string& sKey, int nInfo)
|
|||||||
bool
|
bool
|
||||||
GdbIterator::SetInfo( const string& sKey, double dInfo)
|
GdbIterator::SetInfo( const string& sKey, double dInfo)
|
||||||
{
|
{
|
||||||
return SetInfo( sKey, ToString( dInfo)) ;
|
int nErr ;
|
||||||
|
return ( SetInfo( sKey, ToString( dInfo, 6, &nErr)) && nErr == 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|||||||
+2
-1
@@ -862,7 +862,8 @@ GdbObj::SetInfo( const string& sKey, int nInfo)
|
|||||||
bool
|
bool
|
||||||
GdbObj::SetInfo( const string& sKey, double dInfo)
|
GdbObj::SetInfo( const string& sKey, double dInfo)
|
||||||
{
|
{
|
||||||
return SetInfo( sKey, ToString( dInfo)) ;
|
int nErr ;
|
||||||
|
return ( SetInfo( sKey, ToString( dInfo, 6, &nErr)) && nErr == 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|||||||
+3
-3
@@ -29,10 +29,8 @@ GEOOBJ_REGISTER( GEO_FRAME3D, NGE_G_FRM, GeoFrame3d) ;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
GeoFrame3d::GeoFrame3d( void)
|
GeoFrame3d::GeoFrame3d( void)
|
||||||
: m_frF()
|
: m_frF(), m_nTempProp{0,0}, m_dTempParam{0.0,0.0}
|
||||||
{
|
{
|
||||||
m_nTempProp[0] = 0 ;
|
|
||||||
m_nTempProp[1] = 0 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -118,6 +116,8 @@ GeoFrame3d::CopyFrom( const GeoFrame3d& gfSrc)
|
|||||||
return true ;
|
return true ;
|
||||||
m_nTempProp[0] = gfSrc.m_nTempProp[0] ;
|
m_nTempProp[0] = gfSrc.m_nTempProp[0] ;
|
||||||
m_nTempProp[1] = gfSrc.m_nTempProp[1] ;
|
m_nTempProp[1] = gfSrc.m_nTempProp[1] ;
|
||||||
|
m_dTempParam[0] = gfSrc.m_dTempParam[0] ;
|
||||||
|
m_dTempParam[1] = gfSrc.m_dTempParam[1] ;
|
||||||
return Set( gfSrc.m_frF) ;
|
return Set( gfSrc.m_frF) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,11 @@ class GeoFrame3d : public IGeoFrame3d, public IGeoObjRW
|
|||||||
m_nTempProp[nPropInd] = nProp ; }
|
m_nTempProp[nPropInd] = nProp ; }
|
||||||
int GetTempProp( int nPropInd = 0) const override
|
int GetTempProp( int nPropInd = 0) const override
|
||||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||||
|
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||||
|
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||||
|
m_dTempParam[nParamInd] = dParam ; }
|
||||||
|
double GetTempParam( int nParamInd = 0) const override
|
||||||
|
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||||
|
|
||||||
public : // IGeoFrame3d
|
public : // IGeoFrame3d
|
||||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||||
@@ -78,7 +83,10 @@ class GeoFrame3d : public IGeoFrame3d, public IGeoObjRW
|
|||||||
public : // IGeoObjRW
|
public : // IGeoObjRW
|
||||||
int GetNgeId( void) const override ;
|
int GetNgeId( void) const override ;
|
||||||
bool Save( NgeWriter& ngeOut) const override ;
|
bool Save( NgeWriter& ngeOut) const override ;
|
||||||
|
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
|
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
bool Load( NgeReader& ngeIn) override ;
|
bool Load( NgeReader& ngeIn) override ;
|
||||||
|
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||||
|
|
||||||
public :
|
public :
|
||||||
GeoFrame3d( void) ;
|
GeoFrame3d( void) ;
|
||||||
@@ -97,6 +105,7 @@ class GeoFrame3d : public IGeoFrame3d, public IGeoObjRW
|
|||||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||||
Frame3d m_frF ; // oggetto
|
Frame3d m_frF ; // oggetto
|
||||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||||
|
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
+7
-3
@@ -1,13 +1,13 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2014-2014
|
// EgalTech 2014-2024
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : GeoObjRW.h Data : 14.03.14 Versione : 1.5d5
|
// File : GeoObjRW.h Data : 08.03.24 Versione : 2.6c2
|
||||||
// Contenuto : Dichiarazione della interfaccia IGeoObjRW.
|
// Contenuto : Dichiarazione della interfaccia IGeoObjRW.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Modifiche : 20.11.13 DS Creazione modulo.
|
// Modifiche : 20.11.13 DS Creazione modulo.
|
||||||
//
|
// 08.03.24 DS Aggiunte PreSave, PostSave, PreLoad e PostLoad.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
class NgeWriter ;
|
class NgeWriter ;
|
||||||
class NgeReader ;
|
class NgeReader ;
|
||||||
|
class GdbGeo ;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
class __declspec( novtable) IGeoObjRW
|
class __declspec( novtable) IGeoObjRW
|
||||||
@@ -22,5 +23,8 @@ class __declspec( novtable) IGeoObjRW
|
|||||||
public :
|
public :
|
||||||
virtual int GetNgeId( void) const = 0 ;
|
virtual int GetNgeId( void) const = 0 ;
|
||||||
virtual bool Save( NgeWriter& ngeOut) const = 0 ;
|
virtual bool Save( NgeWriter& ngeOut) const = 0 ;
|
||||||
|
virtual bool PreSave( GdbGeo& Wrapper) const = 0 ;
|
||||||
|
virtual bool PostSave( GdbGeo& Wrapper) const = 0 ;
|
||||||
virtual bool Load( NgeReader& ngeIn) = 0 ;
|
virtual bool Load( NgeReader& ngeIn) = 0 ;
|
||||||
|
virtual bool PostLoad( GdbGeo& Wrapper) = 0 ;
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
+3
-3
@@ -28,10 +28,8 @@ GEOOBJ_REGISTER( GEO_PNT3D, NGE_G_PNT, GeoPoint3d) ;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
GeoPoint3d::GeoPoint3d( void)
|
GeoPoint3d::GeoPoint3d( void)
|
||||||
: m_ptP()
|
: m_ptP(), m_nTempProp{0,0}, m_dTempParam{0.0,0.0}
|
||||||
{
|
{
|
||||||
m_nTempProp[0] = 0 ;
|
|
||||||
m_nTempProp[1] = 0 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -86,6 +84,8 @@ GeoPoint3d::CopyFrom( const GeoPoint3d& clSrc)
|
|||||||
return true ;
|
return true ;
|
||||||
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
|
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
|
||||||
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
|
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
|
||||||
|
m_dTempParam[0] = clSrc.m_dTempParam[0] ;
|
||||||
|
m_dTempParam[1] = clSrc.m_dTempParam[1] ;
|
||||||
return Set( clSrc.m_ptP) ;
|
return Set( clSrc.m_ptP) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,11 @@ class GeoPoint3d : public IGeoPoint3d, public IGeoObjRW
|
|||||||
m_nTempProp[nPropInd] = nProp ; }
|
m_nTempProp[nPropInd] = nProp ; }
|
||||||
int GetTempProp( int nPropInd = 0) const override
|
int GetTempProp( int nPropInd = 0) const override
|
||||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||||
|
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||||
|
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||||
|
m_dTempParam[nParamInd] = dParam ; }
|
||||||
|
double GetTempParam( int nParamInd = 0) const override
|
||||||
|
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||||
|
|
||||||
public : // IGeoPoint3d
|
public : // IGeoPoint3d
|
||||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||||
@@ -72,7 +77,10 @@ class GeoPoint3d : public IGeoPoint3d, public IGeoObjRW
|
|||||||
public : // IGeoObjRW
|
public : // IGeoObjRW
|
||||||
int GetNgeId( void) const override ;
|
int GetNgeId( void) const override ;
|
||||||
bool Save( NgeWriter& ngeOut) const override ;
|
bool Save( NgeWriter& ngeOut) const override ;
|
||||||
|
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
|
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
bool Load( NgeReader& ngeIn) override ;
|
bool Load( NgeReader& ngeIn) override ;
|
||||||
|
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||||
|
|
||||||
public :
|
public :
|
||||||
GeoPoint3d( void) ;
|
GeoPoint3d( void) ;
|
||||||
@@ -91,6 +99,7 @@ class GeoPoint3d : public IGeoPoint3d, public IGeoObjRW
|
|||||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||||
Point3d m_ptP ; // oggetto
|
Point3d m_ptP ; // oggetto
|
||||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||||
|
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
+3
-3
@@ -29,10 +29,8 @@ GEOOBJ_REGISTER( GEO_VECT3D, NGE_G_VEC, GeoVector3d) ;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
GeoVector3d::GeoVector3d( void)
|
GeoVector3d::GeoVector3d( void)
|
||||||
: m_vtV()
|
: m_vtV(), m_ptBase(), m_nTempProp{0,0}, m_dTempParam{0.0,0.0}
|
||||||
{
|
{
|
||||||
m_nTempProp[0] = 0 ;
|
|
||||||
m_nTempProp[1] = 0 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -102,6 +100,8 @@ GeoVector3d::CopyFrom( const GeoVector3d& clSrc)
|
|||||||
return true ;
|
return true ;
|
||||||
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
|
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
|
||||||
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
|
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
|
||||||
|
m_dTempParam[0] = clSrc.m_dTempParam[0] ;
|
||||||
|
m_dTempParam[1] = clSrc.m_dTempParam[1] ;
|
||||||
return Set( clSrc.m_vtV, clSrc.m_ptBase) ;
|
return Set( clSrc.m_vtV, clSrc.m_ptBase) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ class GeoVector3d : public IGeoVector3d, public IGeoObjRW
|
|||||||
m_nTempProp[nPropInd] = nProp ; }
|
m_nTempProp[nPropInd] = nProp ; }
|
||||||
int GetTempProp( int nPropInd = 0) const override
|
int GetTempProp( int nPropInd = 0) const override
|
||||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||||
|
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||||
|
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||||
|
m_dTempParam[nParamInd] = dParam ; }
|
||||||
|
double GetTempParam( int nParamInd = 0) const override
|
||||||
|
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||||
|
|
||||||
public : // IGeoVector3d
|
public : // IGeoVector3d
|
||||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||||
@@ -86,7 +91,10 @@ class GeoVector3d : public IGeoVector3d, public IGeoObjRW
|
|||||||
public : // IGeoObjRW
|
public : // IGeoObjRW
|
||||||
int GetNgeId( void) const override ;
|
int GetNgeId( void) const override ;
|
||||||
bool Save( NgeWriter& ngeOut) const override ;
|
bool Save( NgeWriter& ngeOut) const override ;
|
||||||
|
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
|
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||||
bool Load( NgeReader& ngeIn) override ;
|
bool Load( NgeReader& ngeIn) override ;
|
||||||
|
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||||
|
|
||||||
public :
|
public :
|
||||||
GeoVector3d( void) ;
|
GeoVector3d( void) ;
|
||||||
@@ -106,6 +114,7 @@ class GeoVector3d : public IGeoVector3d, public IGeoObjRW
|
|||||||
Vector3d m_vtV ; // oggetto
|
Vector3d m_vtV ; // oggetto
|
||||||
Point3d m_ptBase ; // punto base da cui tracciare il vettore
|
Point3d m_ptBase ; // punto base da cui tracciare il vettore
|
||||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||||
|
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
+2
-1
@@ -2785,7 +2785,8 @@ GeomDB::SetInfo( int nId, const string& sKey, int nInfo)
|
|||||||
bool
|
bool
|
||||||
GeomDB::SetInfo( int nId, const string& sKey, double dInfo)
|
GeomDB::SetInfo( int nId, const string& sKey, double dInfo)
|
||||||
{
|
{
|
||||||
return SetInfo( nId, sKey, ToString( dInfo)) ;
|
int nErr ;
|
||||||
|
return ( SetInfo( nId, sKey, ToString( dInfo, 6, &nErr)) && nErr == 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -0,0 +1,223 @@
|
|||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// EgalTech 2024-2024
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// File : IntersCurveSurfTm.cpp Data : 23.02.24 Versione : 2.6b4
|
||||||
|
// Contenuto : Implementazione della intersezione curva/superficie trimesh.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Modifiche : 23.02.24 DS Creazione modulo.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//--------------------------- Include ----------------------------------------
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "GeoConst.h"
|
||||||
|
#include "/EgtDev/Include/EGkIntersLineTria.h"
|
||||||
|
#include "/EgtDev/Include/EGkIntersCurveSurfTm.h"
|
||||||
|
|
||||||
|
using namespace std ;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static void
|
||||||
|
UpdateInfoIntersCurveSurfTm( const Point3d& ptL, const Vector3d& vtDir, double dLen, double dUs, double dUe,
|
||||||
|
int nT, const Triangle3d& Tria, ICSIVECTOR& vInfo)
|
||||||
|
{
|
||||||
|
Point3d ptInt, ptInt2 ;
|
||||||
|
int nRes = IntersLineTria( ptL, vtDir, dLen, Tria, ptInt, ptInt2, true) ;
|
||||||
|
if ( nRes == ILTT_IN || nRes == ILTT_EDGE || nRes == ILTT_VERT) {
|
||||||
|
double dU = dUs + ( ptInt - ptL) * vtDir / dLen * ( dUe - dUs) ;
|
||||||
|
double dCosDN = vtDir * Tria.GetN() ;
|
||||||
|
vInfo.emplace_back( nRes, dU, nT, dCosDN, ptInt) ;
|
||||||
|
}
|
||||||
|
else if ( nRes == ILTT_SEGM || nRes == ILTT_SEGM_ON_EDGE) {
|
||||||
|
double dU = dUs + ( ptInt - ptL) * vtDir / dLen * ( dUe - dUs) ;
|
||||||
|
double dU2 = dUs + ( ptInt2 - ptL) * vtDir / dLen * ( dUe - dUs) ;
|
||||||
|
double dCosDN = vtDir * Tria.GetN() ;
|
||||||
|
vInfo.emplace_back( nRes, dU, dU2, nT, dCosDN, ptInt, ptInt2) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static void
|
||||||
|
OrderInfoIntersCurveSurfTm( ICSIVECTOR& vInfo)
|
||||||
|
{
|
||||||
|
// se non trovati, esco
|
||||||
|
if ( vInfo.size() == 0)
|
||||||
|
return ;
|
||||||
|
// ordino il vettore delle intersezioni secondo il senso crescente del parametro di linea
|
||||||
|
sort( vInfo.begin(), vInfo.end(),
|
||||||
|
[]( const IntCrvStmInfo& a, const IntCrvStmInfo& b)
|
||||||
|
{ double dUa = ( ( a.nILTT == ILTT_SEGM || a.nILTT == ILTT_SEGM_ON_EDGE) ? ( a.dU + a.dU2) / 2 : a.dU) ;
|
||||||
|
double dUb = ( ( b.nILTT == ILTT_SEGM || b.nILTT == ILTT_SEGM_ON_EDGE) ? ( b.dU + b.dU2) / 2 : b.dU) ;
|
||||||
|
return ( dUa < dUb) ; }) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Intersezione di una curva con una superficie TriMesh
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
IntersCurveSurfTm( const ICurve& Curve, const ISurfTriMesh& Stm, double dLinTol, ICSIVECTOR& vInfo)
|
||||||
|
{
|
||||||
|
// verifico i parametri ricevuti
|
||||||
|
if ( & Curve == nullptr || &Stm == nullptr || &vInfo == nullptr)
|
||||||
|
return false ;
|
||||||
|
dLinTol = max( dLinTol, EPS_SMALL) ;
|
||||||
|
vInfo.clear() ;
|
||||||
|
|
||||||
|
// approssimo la curva con una spezzata
|
||||||
|
PolyLine PL ;
|
||||||
|
if ( ! Curve.ApproxWithLines( dLinTol, ANG_TOL_APPROX_DEG, ICurve::APL_SPECIAL, PL))
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
// per ogni segmento dell'approssimante cerco l'intersezione con la superficie
|
||||||
|
double dParS, dParE ;
|
||||||
|
Point3d ptStart, ptEnd ;
|
||||||
|
bool bFound = PL.GetFirstULine( &dParS, &ptStart, &dParE, &ptEnd) ;
|
||||||
|
while ( bFound) {
|
||||||
|
Vector3d vtDir = ptEnd - ptStart ;
|
||||||
|
double dLen = vtDir.Len() ;
|
||||||
|
if ( dLen > EPS_SMALL) {
|
||||||
|
vtDir /= dLen ;
|
||||||
|
// cerco i triangoli intersecati dal segmento
|
||||||
|
const double BOX_STEP = 10 ;
|
||||||
|
int nStep = int( ceil( dLen / BOX_STEP)) ;
|
||||||
|
Vector3d vtStep = dLen / nStep * vtDir ;
|
||||||
|
INTVECTOR vPrevT ;
|
||||||
|
for ( int i = 0 ; i < nStep ; ++ i) {
|
||||||
|
BBox3d b3Box( ptStart + i * vtStep, ptStart + ( i + 1) * vtStep) ;
|
||||||
|
INTVECTOR vT ;
|
||||||
|
if ( Stm.GetAllTriaOverlapBox( b3Box, vT)) {
|
||||||
|
for ( auto nT : vT) {
|
||||||
|
// se triangolo non ancora intersecato
|
||||||
|
if ( find( vPrevT.begin(), vPrevT.end(), nT) == vPrevT.end()) {
|
||||||
|
vPrevT.emplace_back( nT) ;
|
||||||
|
Triangle3d Tria ;
|
||||||
|
Stm.GetTriangle( nT, Tria) ;
|
||||||
|
// aggiorno info con intersezione
|
||||||
|
UpdateInfoIntersCurveSurfTm( ptStart, vtDir, dLen, dParS, dParE, nT, Tria, vInfo) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// passo al segmento successivo
|
||||||
|
bFound = PL.GetNextULine( &dParS, &ptStart, &dParE, &ptEnd) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ordino il vettore delle eventuali intersezioni secondo il senso crescente del parametro di linea
|
||||||
|
OrderInfoIntersCurveSurfTm( vInfo) ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
IntersCurveSurfTmExt( const ICurve& Curve, const ISurfTriMesh& Stm, double dLinTol, INTDBLVECTOR& vInters)
|
||||||
|
{
|
||||||
|
ICSIVECTOR vInfo ;
|
||||||
|
vInters.clear() ;
|
||||||
|
return ( IntersCurveSurfTm( Curve, Stm, dLinTol, vInfo) && FilterCurveSurfTmInters( Curve, vInfo, vInters)) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
FilterCurveSurfTmInters( const ICurve& Curve, const ICSIVECTOR& vInfo, INTDBLVECTOR& vInters)
|
||||||
|
{
|
||||||
|
// verifico i parametri ricevuti
|
||||||
|
if ( & Curve == nullptr || &vInfo == nullptr || &vInters == nullptr)
|
||||||
|
return false ;
|
||||||
|
vInters.clear() ;
|
||||||
|
// info sulla curva
|
||||||
|
bool bClosedCrv = Curve.IsClosed() ;
|
||||||
|
double dParSCrv, dParECrv ;
|
||||||
|
Curve.GetDomain( dParSCrv, dParECrv) ;
|
||||||
|
// ciclo sulle intersezioni
|
||||||
|
for ( const auto& Info : vInfo) {
|
||||||
|
// se intersezione puntuale
|
||||||
|
if ( Info.nILTT == ILTT_VERT || Info.nILTT == ILTT_EDGE || Info.nILTT == ILTT_IN) {
|
||||||
|
int nFlag = CSIT_NONE ;
|
||||||
|
if ( Info.dCosDN > EPS_ZERO)
|
||||||
|
nFlag = CSIT_IN_OUT ;
|
||||||
|
else if ( Info.dCosDN < -EPS_ZERO)
|
||||||
|
nFlag = CSIT_OUT_IN ;
|
||||||
|
vInters.emplace_back( nFlag, Info.dU) ;
|
||||||
|
}
|
||||||
|
// se altrimenti intersezione con coincidenza
|
||||||
|
else if ( Info.nILTT == ILTT_SEGM || Info.nILTT == ILTT_SEGM_ON_EDGE) {
|
||||||
|
vInters.emplace_back( CSIT_IN_ON, Info.dU) ;
|
||||||
|
vInters.emplace_back( CSIT_ON_IN, Info.dU2) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// elimino intersezioni ripetute
|
||||||
|
int nStart = ( bClosedCrv ? 0 : 1) ;
|
||||||
|
for ( int j = nStart ; j < int( vInters.size()) ; ) {
|
||||||
|
// intersezione precedente
|
||||||
|
int i = ( j > 0 ? j - 1 : int( vInters.size()) - 1) ;
|
||||||
|
// se hanno lo stesso parametro
|
||||||
|
if ( abs( vInters[i].second - vInters[j].second) < EPS_PARAM ||
|
||||||
|
( bClosedCrv && abs( vInters[i].second - dParECrv) < EPS_PARAM && abs( vInters[j].second - dParSCrv) < EPS_PARAM)) {
|
||||||
|
// flag per eseguita cancellazione
|
||||||
|
bool bSomeErased = false ;
|
||||||
|
// se sono entrambe entranti o uscenti, elimino la seconda
|
||||||
|
if ( ( vInters[i].first == CSIT_OUT_IN && vInters[j].first == CSIT_OUT_IN) ||
|
||||||
|
( vInters[i].first == CSIT_IN_OUT && vInters[j].first == CSIT_IN_OUT)) {
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
bSomeErased = true ;
|
||||||
|
}
|
||||||
|
// se una entrante e l'altra uscente, cambio in touch da fuori ed elimino la seconda
|
||||||
|
else if ( vInters[i].first == CSIT_OUT_IN && vInters[j].first == CSIT_IN_OUT) {
|
||||||
|
vInters[i].first = CSIT_OUT_OUT ;
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
bSomeErased = true ;
|
||||||
|
}
|
||||||
|
// se una uscente e l'altra entrante, cambio in touch da dentro ed elimino la seconda
|
||||||
|
else if ( vInters[i].first == CSIT_IN_OUT && vInters[j].first == CSIT_OUT_IN) {
|
||||||
|
vInters[i].first = CSIT_IN_IN ;
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
bSomeErased = true ;
|
||||||
|
}
|
||||||
|
// se una touch da fuori o da dentro e l'altra entrante o uscente, elimino la prima
|
||||||
|
else if ( ( vInters[i].first == CSIT_OUT_OUT || vInters[i].first == CSIT_IN_IN) &&
|
||||||
|
( vInters[j].first == CSIT_OUT_IN || vInters[j].first == CSIT_IN_OUT)) {
|
||||||
|
vInters.erase( vInters.begin() + i) ;
|
||||||
|
bSomeErased = true ;
|
||||||
|
}
|
||||||
|
// se una entrante o uscente e l'altra touch da fuori o da dentro, elimino la seconda
|
||||||
|
else if ( ( vInters[i].first == CSIT_OUT_IN || vInters[i].first == CSIT_IN_OUT) &&
|
||||||
|
( vInters[j].first == CSIT_OUT_OUT || vInters[j].first == CSIT_IN_IN)) {
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
bSomeErased = true ;
|
||||||
|
}
|
||||||
|
// se una puntuale e l'altra inizio di coincidenza, elimino la prima
|
||||||
|
else if ( ( vInters[i].first == CSIT_OUT_IN || vInters[i].first == CSIT_IN_OUT || vInters[i].first == CSIT_NONE) &&
|
||||||
|
( vInters[j].first == CSIT_IN_ON || vInters[j].first == CSIT_OUT_ON)) {
|
||||||
|
vInters[j].first = ( vInters[i].first == CSIT_IN_OUT ? CSIT_IN_ON : CSIT_OUT_ON) ;
|
||||||
|
vInters.erase( vInters.begin() + i) ;
|
||||||
|
bSomeErased = true ;
|
||||||
|
}
|
||||||
|
// se una fine di coincidenza e l'altra puntuale, elimino la seconda
|
||||||
|
else if ( ( vInters[i].first == CSIT_ON_IN || vInters[i].first == CSIT_ON_OUT) &&
|
||||||
|
( vInters[j].first == CSIT_OUT_IN || vInters[j].first == CSIT_IN_OUT || vInters[j].first == CSIT_NONE)) {
|
||||||
|
vInters[i].first = ( vInters[j].first == CSIT_IN_OUT ? CSIT_ON_OUT : CSIT_ON_IN) ;
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
bSomeErased = true ;
|
||||||
|
}
|
||||||
|
// se una fine di coincidenza e l'altra inizio di coincidenza, elimino entrambe
|
||||||
|
else if ( ( vInters[i].first == CSIT_ON_IN || vInters[i].first == CSIT_ON_OUT) &&
|
||||||
|
( vInters[j].first == CSIT_IN_ON || vInters[j].first == CSIT_OUT_ON)) {
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
vInters.erase( vInters.begin() + ( j > 0 ? i : i - 1)) ;
|
||||||
|
bSomeErased = true ;
|
||||||
|
}
|
||||||
|
if ( bSomeErased) {
|
||||||
|
if ( j > 0)
|
||||||
|
-- j ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// passo alla successiva
|
||||||
|
++ j ;
|
||||||
|
}
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
+1
-1
@@ -22,7 +22,7 @@ using namespace std ;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Linea e box allineato assi devono essere nel medesimo sistema di riferimento.
|
// Linea e box allineato assi devono essere nel medesimo sistema di riferimento.
|
||||||
// In caso di intersezione viene restituito true e i parametri in dU1 e dU2.
|
// In caso di intersezione viene restituito true e i parametri lunghezza in dU1 e dU2.
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
IntersLineBox( const Point3d& ptL, const Vector3d& vtL,
|
IntersLineBox( const Point3d& ptL, const Vector3d& vtL,
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Linea e box allineato agli assi sono nel medesimo riferimento.
|
// Linea e box allineato agli assi sono nel medesimo riferimento.
|
||||||
// Con intersezione viene restituito true e i parametri in dU1 e dU2.
|
// Con intersezione viene restituito true e i parametri lunghezza in dU1 e dU2.
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
IntersLineBox( const Point3d& ptL, const Vector3d& vtL,
|
IntersLineBox( const Point3d& ptL, const Vector3d& vtL,
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "IntersLineCaps.h"
|
#include "IntersLineCaps.h"
|
||||||
#include "DistLineLine.h"
|
#include "/EgtDev/Include/EGkDistLineLine.h"
|
||||||
#include "/EgtDev/Include/EGkIntersLineSphere.h"
|
#include "/EgtDev/Include/EGkIntersLineSphere.h"
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|||||||
+2
-2
@@ -57,7 +57,7 @@ IntersLineLine::IntersLineLine( const CurveLine& Line1, const CurveLine& Line2,
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
IntersLineLine::IntersInfiniteLines( const ICurveLine& Line1, const ICurveLine& Line2)
|
IntersLineLine::IntersInfiniteLines( const CurveLine& Line1, const CurveLine& Line2)
|
||||||
{
|
{
|
||||||
// linea 1 : Start, End, Direzione e Lunghezza
|
// linea 1 : Start, End, Direzione e Lunghezza
|
||||||
Point3d ptS1 = Line1.GetStart() ;
|
Point3d ptS1 = Line1.GetStart() ;
|
||||||
@@ -118,7 +118,7 @@ IntersLineLine::IntersInfiniteLines( const ICurveLine& Line1, const ICurveLine&
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
IntersLineLine::IntersFiniteLines( const ICurveLine& Line1, const ICurveLine& Line2)
|
IntersLineLine::IntersFiniteLines( const CurveLine& Line1, const CurveLine& Line2)
|
||||||
{
|
{
|
||||||
// verifico sovrapposizione box
|
// verifico sovrapposizione box
|
||||||
BBox3d boxL1 ;
|
BBox3d boxL1 ;
|
||||||
|
|||||||
+2
-2
@@ -38,8 +38,8 @@ class IntersLineLine
|
|||||||
|
|
||||||
private :
|
private :
|
||||||
IntersLineLine( void) ;
|
IntersLineLine( void) ;
|
||||||
void IntersInfiniteLines( const ICurveLine& Line1, const ICurveLine& Line2) ;
|
void IntersInfiniteLines( const CurveLine& Line1, const CurveLine& Line2) ;
|
||||||
void IntersFiniteLines( const ICurveLine& Line1, const ICurveLine& Line2) ;
|
void IntersFiniteLines( const CurveLine& Line1, const CurveLine& Line2) ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool m_bOverlaps ;
|
bool m_bOverlaps ;
|
||||||
|
|||||||
@@ -0,0 +1,234 @@
|
|||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// EgalTech 2024
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// File : IntersLineSurfBez.cpp Data : 06.02.24 Versione : 2.6b1
|
||||||
|
// Contenuto : Implementazione della intersezione linea/superficie bezier.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Modifiche : 06.02.24 DB Creazione modulo.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//--------------------------- Include ----------------------------------------
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "CurveLine.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
|
#include "/EgtDev/Include/EGkIntersLineTria.h"
|
||||||
|
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
|
||||||
|
#include "/EgtDev/Include/EGkIntersLineSurfBez.h"
|
||||||
|
#include "/EgtDev/Include/EGkSurfBezier.h"
|
||||||
|
|
||||||
|
using namespace std ;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static bool
|
||||||
|
RefineIntersNewton( const Point3d& ptL, const Vector3d& vtL, double dLen, bool bFinite,
|
||||||
|
const ISurfBezier* pSurfBz, Point3d& ptSP, Point3d& ptIBz)
|
||||||
|
{
|
||||||
|
// la funzione raffina la posisione del punto ptSP, minimizzando la distanza dalla retta e restituisce il punto di intersezione ptIBz
|
||||||
|
pSurfBz->GetPointD1D2( ptSP.x / SBZ_TREG_COEFF, ptSP.y / SBZ_TREG_COEFF, ISurfBezier::FROM_MINUS, ISurfBezier::FROM_MINUS, ptIBz) ;
|
||||||
|
// usando un algoritmo di newton cerco di avvicinarmi il più possibile alla retta
|
||||||
|
DistPointLine dpl( ptIBz, ptL, vtL, dLen, bFinite) ;
|
||||||
|
double dDistNew = 0, dDistPre = 0 ;
|
||||||
|
dpl.GetDist(dDistNew) ;
|
||||||
|
|
||||||
|
int nCount = 0 ;
|
||||||
|
double dh = EPS_SMALL ;
|
||||||
|
pSurfBz->GetPointD1D2( ptSP.x, ptSP.y, ISurfBezier::FROM_MINUS, ISurfBezier::FROM_MINUS, ptIBz) ;
|
||||||
|
// metodo di newton in più dimensioni
|
||||||
|
// vario sia il parametro U che il parametro V e verifico se la distanza dalla retta diminuisce per scostamenti positivi o negativi.
|
||||||
|
while ( dDistNew > EPS_SMALL && nCount < 100) {
|
||||||
|
dDistPre = dDistNew ;
|
||||||
|
Point3d ptIBzNew1 ;
|
||||||
|
pSurfBz->GetPointD1D2( ( ptSP.x + dh) / SBZ_TREG_COEFF, ptSP.y / SBZ_TREG_COEFF, ISurfBezier::FROM_MINUS, ISurfBezier::FROM_MINUS, ptIBzNew1) ;
|
||||||
|
DistPointLine dplNewU( ptIBzNew1, ptL, vtL, dLen, bFinite) ;
|
||||||
|
dplNewU.GetDist( dDistNew) ;
|
||||||
|
double dfdU = ( dDistNew - dDistPre) / dh ;
|
||||||
|
Point3d ptIBzNew2 ;
|
||||||
|
pSurfBz->GetPointD1D2( ptSP.x / SBZ_TREG_COEFF, ( ptSP.y + dh) / SBZ_TREG_COEFF, ISurfBezier::FROM_MINUS, ISurfBezier::FROM_MINUS, ptIBzNew2) ;
|
||||||
|
DistPointLine dplNewV( ptIBzNew2, ptL, vtL, dLen, bFinite) ;
|
||||||
|
dplNewV.GetDist( dDistNew) ;
|
||||||
|
double dfdV = ( dDistNew - dDistPre) / dh ;
|
||||||
|
// mi avvicino cercando di annullare la distanza in un colpo solo
|
||||||
|
double dr = - dDistPre / ( dfdU + dfdV) ;
|
||||||
|
pSurfBz->GetPointD1D2(( ptSP.x + dr * dfdU) / SBZ_TREG_COEFF, ( ptSP.y + dr * dfdV) / SBZ_TREG_COEFF, ISurfBezier::FROM_MINUS, ISurfBezier::FROM_MINUS, ptIBz) ;
|
||||||
|
DistPointLine dplNew( ptIBz, ptL, vtL, dLen, bFinite) ;
|
||||||
|
dplNew.GetDist( dDistNew) ;
|
||||||
|
++ nCount ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( nCount != 99) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static void
|
||||||
|
UpdateInfoIntersLineSurfBz( const Point3d& ptL, const Vector3d& vtDir, int nILT, int nT, const Point3d& ptSP, const Point3d& ptIBz, double dCos,
|
||||||
|
const Point3d& ptSP2, const Point3d& ptIBz2, double dCos2, ILSBIVECTOR& vInfo)
|
||||||
|
{
|
||||||
|
if ( nILT == ILTT_IN || nILT == ILTT_EDGE || nILT == ILTT_VERT) {
|
||||||
|
double dU = ( ptIBz - ptL) * vtDir ;
|
||||||
|
vInfo.emplace_back( nILT, dU, nT, dCos, ptIBz, ptSP) ;
|
||||||
|
}
|
||||||
|
else if ( nILT == ILTT_SEGM || nILT == ILTT_SEGM_ON_EDGE) {
|
||||||
|
double dU = ( ptIBz - ptL) * vtDir ;
|
||||||
|
double dU2 = ( ptIBz2 - ptL) * vtDir ;
|
||||||
|
vInfo.emplace_back( nILT, dU, dU2, nT, dCos2, ptIBz, ptIBz2, ptSP, ptSP2) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static void
|
||||||
|
OrderInfoIntersLineSurfBz( ILSBIVECTOR& vInfo)
|
||||||
|
{
|
||||||
|
// se non trovati, esco
|
||||||
|
if ( vInfo.size() == 0)
|
||||||
|
return ;
|
||||||
|
// ordino il vettore delle intersezioni secondo il senso crescente del parametro di linea
|
||||||
|
sort( vInfo.begin(), vInfo.end(),
|
||||||
|
[]( const IntLinSbzInfo& a, const IntLinSbzInfo& b)
|
||||||
|
{ double dUa = ( ( a.nILTT == ILTT_SEGM || a.nILTT == ILTT_SEGM_ON_EDGE) ? ( a.dU + a.dU2) / 2 : a.dU) ;
|
||||||
|
double dUb = ( ( b.nILTT == ILTT_SEGM || b.nILTT == ILTT_SEGM_ON_EDGE) ? ( b.dU + b.dU2) / 2 : b.dU) ;
|
||||||
|
return ( dUa < dUb) ; }) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Intersezione di una linea con una superficie di Bezier
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
IntersLineSurfBz( const Point3d& ptL, const Vector3d& vtL, double dLen, const ISurfBezier* pSurfBz,
|
||||||
|
ILSBIVECTOR& vInfo, bool bFinite)
|
||||||
|
{
|
||||||
|
PtrOwner<ICurveLine> pCL( CreateCurveLine()) ;
|
||||||
|
if ( bFinite)
|
||||||
|
pCL->SetPVL(ptL, vtL, dLen) ;
|
||||||
|
else
|
||||||
|
pCL->SetPVL(ptL, vtL, 1e6) ;
|
||||||
|
// verifico linea
|
||||||
|
Vector3d vtDir = vtL ;
|
||||||
|
if ( ! vtDir.Normalize( EPS_ZERO))
|
||||||
|
return false ;
|
||||||
|
// verifico superficie
|
||||||
|
if ( pSurfBz == nullptr)
|
||||||
|
return false ;
|
||||||
|
// verifico parametro di ritorno
|
||||||
|
if ( &vInfo == nullptr)
|
||||||
|
return false ;
|
||||||
|
vInfo.clear() ;
|
||||||
|
|
||||||
|
// trovo le intersezioni con la trimesh ausiliaria
|
||||||
|
const ISurfTriMesh* pSurfTm = pSurfBz->GetAuxSurf() ;
|
||||||
|
ILSIVECTOR vInfoTm ;
|
||||||
|
if ( ! IntersLineSurfTm( ptL, vtL, dLen, *pSurfTm, vInfoTm, bFinite))
|
||||||
|
return false ;
|
||||||
|
// ricavo le intersezioni con la superficie di Bezier
|
||||||
|
for ( IntLinStmInfo InfoTm : vInfoTm ) {
|
||||||
|
// devo raffinare i parametri lungo la curva, l'angolo e i punti di intersezione
|
||||||
|
Point3d ptI, ptI2 ;
|
||||||
|
// devo trovare le intersezioni
|
||||||
|
Point3d ptSP, ptSP2 ; // coordinate parametriche delle soluzioni
|
||||||
|
pSurfBz->UnprojectPointFromStm( InfoTm.nT, InfoTm.ptI, ptSP, InfoTm.nILTT) ;
|
||||||
|
Point3d ptIBz, ptIBz2 ;
|
||||||
|
if ( ! RefineIntersNewton( ptL, vtL, dLen, bFinite, pSurfBz, ptSP, ptIBz)) {
|
||||||
|
/////// posso provare anche a rilanciare newton con un punto di partenza diverso oppure con una direzione di avvicinamento diversa///////////////////////////////////
|
||||||
|
// per restare nel triangolo mi sposto verso un vertice
|
||||||
|
int nVert[3] ;
|
||||||
|
pSurfTm->GetTriangle( InfoTm.nT, nVert) ;
|
||||||
|
double dU0, dV0 ;
|
||||||
|
pSurfTm->GetVertexParam( nVert[0], dU0, dV0) ;
|
||||||
|
ptSP = ptSP + Point3d(dU0, dV0, 0) ;
|
||||||
|
if ( ! RefineIntersNewton( ptL,vtL, dLen, bFinite, pSurfBz, ptSP, ptIBz))
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
Vector3d vtN ;
|
||||||
|
pSurfBz->GetPointNrmD1D2(ptSP.x / SBZ_TREG_COEFF, ptSP.y / SBZ_TREG_COEFF, ISurfBezier::FROM_MINUS, ISurfBezier::FROM_MINUS, ptIBz, vtN) ;
|
||||||
|
double dCos = vtN * vtL ;
|
||||||
|
double dCos2 = 0 ;
|
||||||
|
// eventualmente ripeto tutto per ptI2 ( se ho un'intersezione con sovrapposizione)
|
||||||
|
if ( InfoTm.nILTT == ILTT_SEGM || InfoTm.nILTT == ILTT_SEGM_ON_EDGE ) {
|
||||||
|
pSurfBz->UnprojectPointFromStm( InfoTm.nT, InfoTm.ptI2, ptSP2, InfoTm.nILTT) ;
|
||||||
|
if ( ! RefineIntersNewton(ptL, vtL, dLen, bFinite, pSurfBz, ptSP2, ptIBz2) ) {
|
||||||
|
int nVert[3] ;
|
||||||
|
pSurfTm->GetTriangle( InfoTm.nT, nVert) ;
|
||||||
|
double dU0, dV0 ;
|
||||||
|
pSurfTm->GetVertexParam( nVert[0], dU0, dV0) ;
|
||||||
|
ptSP = ptSP + Point3d(dU0, dV0, 0) ;
|
||||||
|
if ( ! RefineIntersNewton( ptL,vtL, dLen, bFinite, pSurfBz, ptSP, ptIBz))
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
pSurfBz->GetPointNrmD1D2( ptSP2.x / SBZ_TREG_COEFF, ptSP2.y / SBZ_TREG_COEFF, ISurfBezier::FROM_MINUS, ISurfBezier::FROM_MINUS, ptIBz2, vtN) ;
|
||||||
|
dCos2 = vtN * vtL ;
|
||||||
|
}
|
||||||
|
UpdateInfoIntersLineSurfBz( ptL, vtL, InfoTm.nILTT, InfoTm.nT, ptSP, ptIBz, dCos, ptSP2, ptIBz2, dCos2, vInfo) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderInfoIntersLineSurfBz( vInfo) ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
FilterLineSurfBzInters( const ILSBIVECTOR& vInfo, INTDBLVECTOR& vInters)
|
||||||
|
{
|
||||||
|
// tengo per buone la classificazione delle intersezioni fatte sulla trimesh
|
||||||
|
// ciclo sulle intersezioni
|
||||||
|
for ( const auto& Info : vInfo) {
|
||||||
|
// se intersezione puntuale
|
||||||
|
if ( Info.nILTT == ILTT_VERT || Info.nILTT == ILTT_EDGE || Info.nILTT == ILTT_IN) {
|
||||||
|
int nFlag = LSBT_TOUCH ;
|
||||||
|
if ( Info.dCosDN > EPS_ZERO)
|
||||||
|
nFlag = LSBT_OUT ;
|
||||||
|
else if ( Info.dCosDN < -EPS_ZERO)
|
||||||
|
nFlag = LSBT_IN ;
|
||||||
|
vInters.emplace_back( nFlag, Info.dU) ;
|
||||||
|
}
|
||||||
|
// se altrimenti intersezione con coincidenza
|
||||||
|
else if ( Info.nILTT == ILTT_SEGM || Info.nILTT == ILTT_SEGM_ON_EDGE) {
|
||||||
|
vInters.emplace_back( LSBT_TG_INI, Info.dU) ;
|
||||||
|
vInters.emplace_back( LSBT_TG_FIN, Info.dU2) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// elimino intersezioni ripetute
|
||||||
|
for ( size_t j = 1 ; j < vInters.size() ; ) {
|
||||||
|
// intersezione precedente
|
||||||
|
size_t i = j - 1 ;
|
||||||
|
// se hanno lo stesso parametro
|
||||||
|
if ( abs( vInters[i].second - vInters[j].second) < EPS_SMALL) {
|
||||||
|
// se sono entrambe entranti o uscenti, elimino la seconda
|
||||||
|
if ( ( vInters[i].first == LSBT_IN && vInters[j].first == LSBT_IN) ||
|
||||||
|
( vInters[i].first == LSBT_OUT && vInters[j].first == LSBT_OUT)) {
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
// se una entrante e l'altra uscente, cambio in touch ed elimino la seconda
|
||||||
|
else if ( ( vInters[i].first == LSBT_IN && vInters[j].first == LSBT_OUT) ||
|
||||||
|
( vInters[i].first == LSBT_OUT && vInters[j].first == LSBT_IN)) {
|
||||||
|
vInters[i].first = LSBT_TOUCH ;
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
// se una puntuale e l'altra inizio di coincidenza, elimino la prima
|
||||||
|
else if ( ( vInters[i].first == LSBT_IN || vInters[i].first == LSBT_OUT || vInters[i].first == LSBT_TOUCH) && vInters[j].first == LSBT_TG_INI) {
|
||||||
|
vInters.erase( vInters.begin() + i) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
// se una fine di coincidenza e l'altra puntuale, elimino la seconda
|
||||||
|
else if ( vInters[i].first == LSBT_TG_FIN && ( vInters[j].first == LSBT_IN || vInters[j].first == LSBT_OUT || vInters[j].first == LSBT_TOUCH)) {
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
// se una fine di coincidenza e l'altra inizio di coincidenza, elimino entrambe
|
||||||
|
else if ( i > 0 && vInters[i].first == LSBT_TG_FIN && vInters[j].first == LSBT_TG_INI) {
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
vInters.erase( vInters.begin() + i) ;
|
||||||
|
-- j ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// passo alla successiva
|
||||||
|
++ j ;
|
||||||
|
}
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
+75
-8
@@ -21,7 +21,7 @@
|
|||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
static void
|
||||||
UpdateInfoIntersLineSurfTm( const Point3d& ptL, const Vector3d& vtDir, double dLen,
|
UpdateInfoIntersLineSurfTm( const Point3d& ptL, const Vector3d& vtDir, double dLen,
|
||||||
int nT, const Triangle3d& Tria, ILSIVECTOR& vInfo, bool bFinite)
|
int nT, const Triangle3d& Tria, ILSIVECTOR& vInfo, bool bFinite)
|
||||||
{
|
{
|
||||||
@@ -41,7 +41,7 @@ UpdateInfoIntersLineSurfTm( const Point3d& ptL, const Vector3d& vtDir, double dL
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
static void
|
||||||
OrderInfoIntersLineSurfTm( ILSIVECTOR& vInfo)
|
OrderInfoIntersLineSurfTm( ILSIVECTOR& vInfo)
|
||||||
{
|
{
|
||||||
// se non trovati, esco
|
// se non trovati, esco
|
||||||
@@ -52,6 +52,8 @@ OrderInfoIntersLineSurfTm( ILSIVECTOR& vInfo)
|
|||||||
[]( const IntLinStmInfo& a, const IntLinStmInfo& b)
|
[]( const IntLinStmInfo& a, const IntLinStmInfo& b)
|
||||||
{ double dUa = ( ( a.nILTT == ILTT_SEGM || a.nILTT == ILTT_SEGM_ON_EDGE) ? ( a.dU + a.dU2) / 2 : a.dU) ;
|
{ double dUa = ( ( a.nILTT == ILTT_SEGM || a.nILTT == ILTT_SEGM_ON_EDGE) ? ( a.dU + a.dU2) / 2 : a.dU) ;
|
||||||
double dUb = ( ( b.nILTT == ILTT_SEGM || b.nILTT == ILTT_SEGM_ON_EDGE) ? ( b.dU + b.dU2) / 2 : b.dU) ;
|
double dUb = ( ( b.nILTT == ILTT_SEGM || b.nILTT == ILTT_SEGM_ON_EDGE) ? ( b.dU + b.dU2) / 2 : b.dU) ;
|
||||||
|
if ( abs( dUa - dUb) < EPS_SMALL)
|
||||||
|
return ( a.dCosDN < b.dCosDN) ;
|
||||||
return ( dUa < dUb) ; }) ;
|
return ( dUa < dUb) ; }) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +83,7 @@ IntersLineSurfTm( const Point3d& ptL, const Vector3d& vtL, double dLen, const IS
|
|||||||
// lo ingrandisco per non avere problemi con faccia piana su piani canonici
|
// lo ingrandisco per non avere problemi con faccia piana su piani canonici
|
||||||
b3Stm.Expand( 10 * EPS_SMALL) ;
|
b3Stm.Expand( 10 * EPS_SMALL) ;
|
||||||
double dU1, dU2 ;
|
double dU1, dU2 ;
|
||||||
if ( ! IntersLineBox( ptL, vtL, b3Stm.GetMin() , b3Stm.GetMax(), dU1, dU2))
|
if ( ! IntersLineBox( ptL, vtDir, b3Stm.GetMin() , b3Stm.GetMax(), dU1, dU2))
|
||||||
return true ;
|
return true ;
|
||||||
if ( bFinite) {
|
if ( bFinite) {
|
||||||
dU1 = max( dU1, 0.) ;
|
dU1 = max( dU1, 0.) ;
|
||||||
@@ -89,12 +91,12 @@ IntersLineSurfTm( const Point3d& ptL, const Vector3d& vtL, double dLen, const IS
|
|||||||
if ( dU2 - dU1 < EPS_SMALL)
|
if ( dU2 - dU1 < EPS_SMALL)
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
Point3d ptStart = ptL + dU1 * vtL ;
|
Point3d ptStart = ptL + dU1 * vtDir ;
|
||||||
double dLenEff = dU2 - dU1 ;
|
double dLenEff = dU2 - dU1 ;
|
||||||
// cerco i triangoli intersecati dalla linea
|
// cerco i triangoli intersecati dalla linea
|
||||||
const double BOX_STEP = 10 ;
|
const double BOX_STEP = 10 ;
|
||||||
int nStep = int( ceil( dLenEff / BOX_STEP)) ;
|
int nStep = int( ceil( dLenEff / BOX_STEP)) ;
|
||||||
Vector3d vtStep = dLenEff / nStep * vtL ;
|
Vector3d vtStep = dLenEff / nStep * vtDir ;
|
||||||
INTVECTOR vPrevT ;
|
INTVECTOR vPrevT ;
|
||||||
for ( int i = 0 ; i < nStep ; ++ i) {
|
for ( int i = 0 ; i < nStep ; ++ i) {
|
||||||
BBox3d b3Box( ptStart + i * vtStep, ptStart + ( i + 1) * vtStep) ;
|
BBox3d b3Box( ptStart + i * vtStep, ptStart + ( i + 1) * vtStep) ;
|
||||||
@@ -156,13 +158,13 @@ IntersParLinesSurfTm::IntersParLinesSurfTm( const Frame3d& frLines, const ISurfT
|
|||||||
bool
|
bool
|
||||||
IntersParLinesSurfTm::GetInters( const Point3d& ptL, double dLen, ILSIVECTOR& vInfo, bool bFinite) const
|
IntersParLinesSurfTm::GetInters( const Point3d& ptL, double dLen, ILSIVECTOR& vInfo, bool bFinite) const
|
||||||
{
|
{
|
||||||
// verifico validità
|
|
||||||
if ( ! m_bOk)
|
|
||||||
return false ;
|
|
||||||
// verifico parametro di ritorno
|
// verifico parametro di ritorno
|
||||||
if ( &vInfo == nullptr)
|
if ( &vInfo == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
vInfo.clear() ;
|
vInfo.clear() ;
|
||||||
|
// verifico validità
|
||||||
|
if ( ! m_bOk)
|
||||||
|
return false ;
|
||||||
|
|
||||||
// calcolo box linea (nel riferimento)
|
// calcolo box linea (nel riferimento)
|
||||||
BBox3d b3Line ;
|
BBox3d b3Line ;
|
||||||
@@ -189,3 +191,68 @@ IntersParLinesSurfTm::GetInters( const Point3d& ptL, double dLen, ILSIVECTOR& vI
|
|||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
FilterLineSurfTmInters( const ILSIVECTOR& vInfo, INTDBLVECTOR& vInters)
|
||||||
|
{
|
||||||
|
// ciclo sulle intersezioni
|
||||||
|
for ( const auto& Info : vInfo) {
|
||||||
|
// se intersezione puntuale
|
||||||
|
if ( Info.nILTT == ILTT_VERT || Info.nILTT == ILTT_EDGE || Info.nILTT == ILTT_IN) {
|
||||||
|
int nFlag = LST_TOUCH ;
|
||||||
|
if ( Info.dCosDN > EPS_ZERO)
|
||||||
|
nFlag = LST_OUT ;
|
||||||
|
else if ( Info.dCosDN < -EPS_ZERO)
|
||||||
|
nFlag = LST_IN ;
|
||||||
|
vInters.emplace_back( nFlag, Info.dU) ;
|
||||||
|
}
|
||||||
|
// se altrimenti intersezione con coincidenza
|
||||||
|
else if ( Info.nILTT == ILTT_SEGM || Info.nILTT == ILTT_SEGM_ON_EDGE) {
|
||||||
|
vInters.emplace_back( LST_TG_INI, Info.dU) ;
|
||||||
|
vInters.emplace_back( LST_TG_FIN, Info.dU2) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// elimino intersezioni ripetute
|
||||||
|
for ( size_t j = 1 ; j < vInters.size() ; ) {
|
||||||
|
// intersezione precedente
|
||||||
|
size_t i = j - 1 ;
|
||||||
|
// se hanno lo stesso parametro
|
||||||
|
if ( abs( vInters[i].second - vInters[j].second) < EPS_SMALL) {
|
||||||
|
// se sono entrambe entranti o uscenti, elimino la seconda
|
||||||
|
if ( ( vInters[i].first == LST_IN && vInters[j].first == LST_IN) ||
|
||||||
|
( vInters[i].first == LST_OUT && vInters[j].first == LST_OUT)) {
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
// se una entrante e l'altra uscente, cambio in touch ed elimino la seconda
|
||||||
|
else if ( ( vInters[i].first == LST_IN && vInters[j].first == LST_OUT) ||
|
||||||
|
( vInters[i].first == LST_OUT && vInters[j].first == LST_IN)) {
|
||||||
|
vInters[i].first = LST_TOUCH ;
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
// se una puntuale e l'altra inizio di coincidenza, elimino la prima
|
||||||
|
else if ( ( vInters[i].first == LST_IN || vInters[i].first == LST_OUT || vInters[i].first == LST_TOUCH) && vInters[j].first == LST_TG_INI) {
|
||||||
|
vInters.erase( vInters.begin() + i) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
// se una fine di coincidenza e l'altra puntuale, elimino la seconda
|
||||||
|
else if ( vInters[i].first == LST_TG_FIN && ( vInters[j].first == LST_IN || vInters[j].first == LST_OUT || vInters[j].first == LST_TOUCH)) {
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
// se una fine di coincidenza e l'altra inizio di coincidenza, elimino entrambe
|
||||||
|
else if ( i > 0 && vInters[i].first == LST_TG_FIN && vInters[j].first == LST_TG_INI) {
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
vInters.erase( vInters.begin() + i) ;
|
||||||
|
-- j ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// passo alla successiva
|
||||||
|
++ j ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|||||||
+2
-2
@@ -17,8 +17,8 @@
|
|||||||
#include "CurveLine.h"
|
#include "CurveLine.h"
|
||||||
#include "IntersLineLine.h"
|
#include "IntersLineLine.h"
|
||||||
#include "IntersLineTria.h"
|
#include "IntersLineTria.h"
|
||||||
#include "DistPointLine.h"
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "DistLineLine.h"
|
#include "/EgtDev/Include/EGkDistLineLine.h"
|
||||||
#include "/EgtDev/Include/EGkIntersLinePlane.h"
|
#include "/EgtDev/Include/EGkIntersLinePlane.h"
|
||||||
#include "/EgtDev/Include/EGkFrame3d.h"
|
#include "/EgtDev/Include/EGkFrame3d.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// EgalTech 2024-2024
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// File : IntersLineVolZmap.cpp Data : 22.02.24 Versione : 2.6b4
|
||||||
|
// Contenuto : Implementazione della intersezione linea/VolZmap.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Modifiche : 22.02.24 DS Creazione modulo.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//--------------------------- Include ----------------------------------------
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "VolZmap.h"
|
||||||
|
#include "/EgtDev/Include/EGkIntersLineVolZmap.h"
|
||||||
|
|
||||||
|
using namespace std ;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Intersezione di una linea con la superficie di un solido VolZmap
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
IntersLineVolZmap( const Point3d& ptL, const Vector3d& vtL, const IVolZmap& Vzm, ILZIVECTOR& vInfo)
|
||||||
|
{
|
||||||
|
// verifico linea
|
||||||
|
Vector3d vtDir = vtL ;
|
||||||
|
if ( ! vtDir.Normalize( EPS_ZERO))
|
||||||
|
return false ;
|
||||||
|
// verifico volume
|
||||||
|
const VolZmap* pVzm = GetBasicVolZmap( &Vzm) ;
|
||||||
|
if ( pVzm == nullptr)
|
||||||
|
return false ;
|
||||||
|
// verifico parametro di ritorno
|
||||||
|
if ( &vInfo == nullptr)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
// eseguo intersezione
|
||||||
|
return pVzm->GetLineIntersection( ptL, vtL, vInfo) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
FilterLineVolZmapInters( const ILZIVECTOR& vInfo, INTDBLVECTOR& vInters)
|
||||||
|
{
|
||||||
|
// ciclo sulle intersezioni
|
||||||
|
for ( const auto& Info : vInfo) {
|
||||||
|
// se intersezione puntuale
|
||||||
|
if ( Info.nILTT == ILTT_VERT || Info.nILTT == ILTT_EDGE || Info.nILTT == ILTT_IN) {
|
||||||
|
int nFlag = LZT_TOUCH ;
|
||||||
|
if ( Info.dCosDN > EPS_ZERO)
|
||||||
|
nFlag = LZT_OUT ;
|
||||||
|
else if ( Info.dCosDN < -EPS_ZERO)
|
||||||
|
nFlag = LZT_IN ;
|
||||||
|
vInters.emplace_back( nFlag, Info.dU) ;
|
||||||
|
}
|
||||||
|
// se altrimenti intersezione con coincidenza
|
||||||
|
else if ( Info.nILTT == ILTT_SEGM || Info.nILTT == ILTT_SEGM_ON_EDGE) {
|
||||||
|
vInters.emplace_back( LZT_TG_INI, Info.dU) ;
|
||||||
|
vInters.emplace_back( LZT_TG_FIN, Info.dU2) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// elimino intersezioni ripetute
|
||||||
|
for ( size_t j = 1 ; j < vInters.size() ; ) {
|
||||||
|
// intersezione precedente
|
||||||
|
size_t i = j - 1 ;
|
||||||
|
// se hanno lo stesso parametro
|
||||||
|
if ( abs( vInters[i].second - vInters[j].second) < EPS_SMALL) {
|
||||||
|
// se sono entrambe entranti o uscenti, elimino la seconda
|
||||||
|
if ( ( vInters[i].first == LZT_IN && vInters[j].first == LZT_IN) ||
|
||||||
|
( vInters[i].first == LZT_OUT && vInters[j].first == LZT_OUT)) {
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
// se una entrante e l'altra uscente, cambio in touch ed elimino la seconda
|
||||||
|
else if ( ( vInters[i].first == LZT_IN && vInters[j].first == LZT_OUT) ||
|
||||||
|
( vInters[i].first == LZT_OUT && vInters[j].first == LZT_IN)) {
|
||||||
|
vInters[i].first = LZT_TOUCH ;
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
// se una puntuale e l'altra inizio di coincidenza, elimino la prima
|
||||||
|
else if ( ( vInters[i].first == LZT_IN || vInters[i].first == LZT_OUT || vInters[i].first == LZT_TOUCH) && vInters[j].first == LZT_TG_INI) {
|
||||||
|
vInters.erase( vInters.begin() + i) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
// se una fine di coincidenza e l'altra puntuale, elimino la seconda
|
||||||
|
else if ( vInters[i].first == LZT_TG_FIN && ( vInters[j].first == LZT_IN || vInters[j].first == LZT_OUT || vInters[j].first == LZT_TOUCH)) {
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
// se una fine di coincidenza e l'altra inizio di coincidenza, elimino entrambe
|
||||||
|
else if ( i > 0 && vInters[i].first == LZT_TG_FIN && vInters[j].first == LZT_TG_INI) {
|
||||||
|
vInters.erase( vInters.begin() + j) ;
|
||||||
|
vInters.erase( vInters.begin() + i) ;
|
||||||
|
-- j ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// passo alla successiva
|
||||||
|
++ j ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "ProjPlane.h"
|
#include "ProjPlane.h"
|
||||||
#include "CurveLine.h"
|
#include "CurveLine.h"
|
||||||
#include "DistPointLine.h"
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
|
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
|
||||||
#include "/EgtDev/Include/EGkIntersPlaneTria.h"
|
#include "/EgtDev/Include/EGkIntersPlaneTria.h"
|
||||||
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
|
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// EgalTech 2024-2024
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// File : IntersPlaneVolZmap.cpp Data : 22.02.24 Versione : 2.6b4
|
||||||
|
// Contenuto : Implementazione della intersezione piano/VolZmap.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Modifiche : 22.02.24 DS Creazione modulo.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//--------------------------- Include ----------------------------------------
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "VolZmap.h"
|
||||||
|
#include "/EgtDev/Include/EGkIntersPlaneVolZmap.h"
|
||||||
|
|
||||||
|
using namespace std ;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Intersezione di unpiano con la superficie di un solido VolZmap
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
IntersPlaneVolZmap( const Plane3d& plPlane, const IVolZmap& Vzm, ICURVEPOVECTOR& vpLoop)
|
||||||
|
{
|
||||||
|
// verifico volume
|
||||||
|
const VolZmap* pVzm = GetBasicVolZmap( &Vzm) ;
|
||||||
|
if ( pVzm == nullptr)
|
||||||
|
return false ;
|
||||||
|
// verifico parametro di ritorno
|
||||||
|
if ( &vpLoop == nullptr)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
// eseguo intersezione
|
||||||
|
return pVzm->GetPlaneIntersection( plPlane, vpLoop) ;
|
||||||
|
}
|
||||||
@@ -13,9 +13,9 @@
|
|||||||
|
|
||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "DistPointLine.h"
|
|
||||||
#include "IntersLineTria.h"
|
#include "IntersLineTria.h"
|
||||||
#include "DllMain.h"
|
#include "DllMain.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkIntersSurfTmSurfTm.h"
|
#include "/EgtDev/Include/EGkIntersSurfTmSurfTm.h"
|
||||||
#include "/EgtDev/Include/EGkIntersTriaTria.h"
|
#include "/EgtDev/Include/EGkIntersTriaTria.h"
|
||||||
#include "/EgtDev/Include/EGkPointGrid3d.h"
|
#include "/EgtDev/Include/EGkPointGrid3d.h"
|
||||||
|
|||||||
+3
-3
@@ -119,12 +119,12 @@ IntersTriaTria( const Triangle3d& trTria1, const Triangle3d& trTria2, Point3d& p
|
|||||||
Point3d ptSt1, ptEn1 ;
|
Point3d ptSt1, ptEn1 ;
|
||||||
int nRes1 = IntersCoplanarLineTria( ptL, vtL, 100.0, trTria1, ptSt1, ptEn1, false) ;
|
int nRes1 = IntersCoplanarLineTria( ptL, vtL, 100.0, trTria1, ptSt1, ptEn1, false) ;
|
||||||
|
|
||||||
// limito la liena di intersezione con il secondo triangolo
|
// limito la linea di intersezione con il secondo triangolo
|
||||||
Point3d ptSt2, ptEn2 ;
|
Point3d ptSt2, ptEn2 ;
|
||||||
int nRes2 = IntersCoplanarLineTria( ptL, vtL, 100.0, trTria2, ptSt2, ptEn2, false) ;
|
int nRes2 = IntersCoplanarLineTria( ptL, vtL, 100.0, trTria2, ptSt2, ptEn2, false) ;
|
||||||
|
|
||||||
// eseguo classificazione
|
// eseguo classificazione
|
||||||
double dIntStU, dIntEnU;
|
double dIntStU, dIntEnU ;
|
||||||
int nIntType = FindTriaTriaIntersType( trTria1, trTria2, ptL, vtL,
|
int nIntType = FindTriaTriaIntersType( trTria1, trTria2, ptL, vtL,
|
||||||
( ptSt1 - ptL) * vtL, ( ptEn1 - ptL) * vtL,
|
( ptSt1 - ptL) * vtL, ( ptEn1 - ptL) * vtL,
|
||||||
( ptSt2 - ptL) * vtL, ( ptEn2 - ptL) * vtL,
|
( ptSt2 - ptL) * vtL, ( ptEn2 - ptL) * vtL,
|
||||||
@@ -234,7 +234,7 @@ int
|
|||||||
FindTriaTriaIntersType( const Triangle3d& trTria1, const Triangle3d& trTria2, const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
FindTriaTriaIntersType( const Triangle3d& trTria1, const Triangle3d& trTria2, const Point3d& ptLineSt, const Vector3d& vtLineDir,
|
||||||
double dStU1, double dEnU1, double dStU2, double dEnU2, int nRes1, int nRes2, double& dIntStU, double& dIntEnU)
|
double dStU1, double dEnU1, double dStU2, double dEnU2, int nRes1, int nRes2, double& dIntStU, double& dIntEnU)
|
||||||
{
|
{
|
||||||
// Controllo su validit� input
|
// Controllo su validità input
|
||||||
if ( ! ( trTria1.IsValid() && trTria2.IsValid() && vtLineDir.IsNormalized()))
|
if ( ! ( trTria1.IsValid() && trTria2.IsValid() && vtLineDir.IsNormalized()))
|
||||||
return ITTT_NO ;
|
return ITTT_NO ;
|
||||||
// Casi
|
// Casi
|
||||||
|
|||||||
+2
-4
@@ -26,8 +26,7 @@ class IterManager
|
|||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
bool IsGdbIteratorInList( GdbIterator* pIter)
|
bool IsGdbIteratorInList( GdbIterator* pIter)
|
||||||
{ PGDBI_LIST::const_iterator Iter ;
|
{ for ( auto Iter = m_IterList.cbegin() ; Iter != m_IterList.cend() ; ++ Iter) {
|
||||||
for ( Iter = m_IterList.begin() ; Iter != m_IterList.end() ; ++ Iter) {
|
|
||||||
if ( *Iter == pIter)
|
if ( *Iter == pIter)
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -41,8 +40,7 @@ class IterManager
|
|||||||
catch (...) { return false ;}
|
catch (...) { return false ;}
|
||||||
return true ; }
|
return true ; }
|
||||||
bool RemoveGdbIterator( GdbIterator* pIter)
|
bool RemoveGdbIterator( GdbIterator* pIter)
|
||||||
{ PGDBI_LIST::iterator Iter ;
|
{ for ( auto Iter = m_IterList.cbegin() ; Iter != m_IterList.cend() ; ++ Iter) {
|
||||||
for ( Iter = m_IterList.begin() ; Iter != m_IterList.end() ; ++ Iter) {
|
|
||||||
if ( *Iter == pIter) {
|
if ( *Iter == pIter) {
|
||||||
m_IterList.erase( Iter) ;
|
m_IterList.erase( Iter) ;
|
||||||
return true ;
|
return true ;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "CreateCurveAux.h"
|
#include "CreateCurveAux.h"
|
||||||
#include "DistPointLine.h"
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkLineTgCurvePerpCurve.h"
|
#include "/EgtDev/Include/EGkLineTgCurvePerpCurve.h"
|
||||||
#include "/EgtDev/Include/EGkLinePntTgCurve.h"
|
#include "/EgtDev/Include/EGkLinePntTgCurve.h"
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "CreateCurveAux.h"
|
#include "CreateCurveAux.h"
|
||||||
#include "DistPointLine.h"
|
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||||
#include "/EgtDev/Include/EGkLineTgTwoCurves.h"
|
#include "/EgtDev/Include/EGkLineTgTwoCurves.h"
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user