Merge commit '13b02f51a31192cfb3f9f67f597bff377eb8d02f' into ExtDimension_angular

This commit is contained in:
Daniele Bariletti
2023-04-19 15:32:42 +02:00
8 changed files with 581 additions and 558 deletions
BIN
View File
Binary file not shown.
+550 -534
View File
File diff suppressed because it is too large Load Diff
+9 -6
View File
@@ -62,10 +62,12 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
int nDecDigit, const std::string& sFont, double dTextHeight) override ;
bool SetLinear( const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptPos,
const Vector3d& vtN, const Vector3d& vtDir, const std::string& sText) override ;
bool SetAngular( const Point3d& ptP1, const Point3d& ptCen, const Point3d& ptP2, const Point3d& ptPos,
const Vector3d& vtN, const std::string& sText ) override ;
bool SetRadial( const Point3d& ptCen, const Point3d& ptPos, const Vector3d& vtN, const std::string& sText) override ;
bool SetDiametral( const Point3d& ptCen, const Point3d& ptPos, const Vector3d& vtN, const std::string& sText) override ;
bool SetRadial( const Point3d& ptCen, const Point3d& ptPos,
const Vector3d& vtN, const std::string& sText) override ;
bool SetDiametral( const Point3d& ptCen, const Point3d& ptPos,
const Vector3d& vtN, const std::string& sText) override ;
bool SetAngular( const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptV, const Point3d& ptPos,
const Vector3d& vtN, const std::string& sText) override ;
const Vector3d& GetNormVersor( void) const override
{ return m_vtN ; }
const Vector3d& GetDirVersor( void) const override
@@ -123,6 +125,7 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
bool GetArrowHead( const Point3d& ptTip, const Vector3d& vtDir, PolyLine& PL) const ;
bool SetCurrFont( FontManager& fntMgr) const ;
bool ApproxTextWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST& lstPL) const ;
bool GetTextMyBBox( BBox3d& b3Loc) const ;
bool GetTextMyBBox( const Point3d& ptPos, BBox3d& b3Loc) const ;
bool GetTextLocalBBox( BBox3d& b3Loc) const ;
bool GetTextBBox( const Frame3d& frRef, BBox3d& b3Ref) const ;
@@ -137,7 +140,7 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
Point3d m_ptP3 ; // terzo punto
Point3d m_ptP4 ; // quarto punto
Point3d m_ptP5 ; // quinto punto
Point3d m_ptP6 ; // sesto punto; nel caso delle quotature angolari è il centro
Point3d m_ptP6 ; // sesto punto; nel caso delle quotature angolari il centro
Point3d m_ptPos ; // posizione ricevuta della quota
std::string m_sText ; // testo della quota
mutable bool m_bToCalc ; // flag dati effettivi da ricalcolare
@@ -154,5 +157,5 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
int m_nDecDigit ; // numero di cifre decimali
std::string m_sFont ; // font del testo
double m_dTextHeight ; // altezza del testo
int m_nTempProp[2] ; // vettore proprietà temporanee
int m_nTempProp[2] ; // vettore propriet temporanee
} ;
+1 -4
View File
@@ -659,11 +659,8 @@ IntersCurveCurve::CalcCurveInOrOut( const ICurve* pCurveA, const ICurve* pCurveB
bool
IntersCurveCurve::GetCurveOutClass( const ICurve* pCurve, int& nClass)
{
PolyLine PL ;
if ( ! pCurve->ApproxWithLines( LIN_TOL_APPROX, ANG_TOL_APPROX_DEG, ICurve::APL_SPECIAL, PL))
return false ;
double dArea ;
if ( ! PL.GetAreaXY( dArea))
if ( ! pCurve->GetAreaXY( dArea))
return false ;
nClass = (( dArea > 0) ? CRVC_OUT : CRVC_IN) ;
return true ;
+1 -1
View File
@@ -66,7 +66,7 @@ IntersLineLine::IntersInfiniteLines( const ICurveLine& Line1, const ICurveLine&
double dLen1XY = vtDir1.LenXY() ;
if ( dLen1XY < EPS_SMALL)
return ;
// linea 2 : Start, Direzione e Lunghezza
// linea 2 : Start, End, Direzione e Lunghezza
Point3d ptS2 = Line2.GetStart() ;
Point3d ptE2 = Line2.GetEnd() ;
Vector3d vtDir2 = ptE2 - ptS2 ;
+7 -9
View File
@@ -615,18 +615,16 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
pCrvCo2->GetEndPoint( ptEnd2) ;
// verifiche di concatenamento
if ( AreSamePointEpsilon( ptEnd, ptStart2, 10 * EPS_SMALL)) {
if ( pCrvCo->AddCurve( pCrvCo2, true, 10 * EPS_SMALL)) {
m_CrvLst.erase( iIter2) ;
if ( pCrvCo->AddCurve( pCrvCo2, true, 10 * EPS_SMALL))
ptEnd = ptEnd2 ;
iIter2 = next( iIter) ;
}
m_CrvLst.erase( iIter2) ;
iIter2 = next( iIter) ;
}
else if ( AreSamePointEpsilon( ptEnd2, ptStart, 10 * EPS_SMALL)) {
if ( pCrvCo->AddCurve( pCrvCo2, false, 10 * EPS_SMALL)) {
m_CrvLst.erase( iIter2) ;
if ( pCrvCo->AddCurve( pCrvCo2, false, 10 * EPS_SMALL))
ptStart = ptStart2 ;
iIter2 = next( iIter) ;
}
m_CrvLst.erase( iIter2) ;
iIter2 = next( iIter) ;
}
else
++ iIter2 ;
@@ -961,7 +959,7 @@ VerifyAndAdjustExternalAngle( ICurve* pCrv1, ICurve* pCrv2, double dAngDeg, doub
nType = ICurve::OFF_CHAMFER ;
// se angolo esterno molto piccolo, semplifico tutto
const double SMALL_EXT_ANG = 1.0 ;
const double SMALL_EXT_ANG = 0.1 ;
bool bAngSmall = ( abs( dAngDeg) < SMALL_EXT_ANG) ;
if ( bAngSmall)
nType = ICurve::OFF_EXTEND ;
+9 -2
View File
@@ -396,11 +396,18 @@ SurfFlatRegion::MyNewSurfFromLoops( PCRV_DEQUE& vpLoop)
typedef vector<INDAREA> INDAREAVECTOR ; // vettore di coppie indice, area
INDAREAVECTOR vArea ;
vArea.reserve( vpLoop.size()) ;
for ( int i = 0 ; i < int( vpLoop.size()) ; ++ i) {
for ( int i = 0 ; i < int( vpLoop.size()) ;) {
double dArea ;
if ( ! vpLoop[i]->GetAreaXY( dArea))
return nullptr ;
vArea.emplace_back( i, dArea) ;
if ( abs( dArea) > SQ_EPS_SMALL) {
vArea.emplace_back( i, dArea) ;
++ i ;
}
else {
delete vpLoop[i] ;
vpLoop.erase( vpLoop.begin() + i) ;
}
}
// ordino in senso decrescente sull'area
sort( vArea.begin(), vArea.end(),
+4 -2
View File
@@ -470,18 +470,20 @@ Vector3d::GetAngleXY( const Vector3d& vtEnd, double& dAngDeg) const
// all'asse di rotazione sulla stessa direzione della componente perpendicolare di vtEnd
//----------------------------------------------------------------------------
bool
Vector3d::GetRotation( const Vector3d& vtEnd, const Vector3d& vtAx, double& dAngDeg, bool& bDet) const
Vector3d::GetRotation( const Vector3d& vtEnd, const Vector3d& vtAx, double dEpsZero, double& dAngDeg, bool& bDet) const
{
// ricavo versore asse di rotazione
Vector3d vtDirAx = vtAx ;
if ( ! vtDirAx.Normalize())
return false ;
// verifico epsilon per vettore nullo
dEpsZero = std::min( EPS_SMALL, abs( dEpsZero)) ;
// ricavo le componenti perpendicolari all'asse di rotazione
Vector3d vtPerp = *this - vtDirAx * ( *this * vtDirAx) ;
Vector3d vtPerpE = vtEnd - vtDirAx * ( vtEnd * vtDirAx) ;
// se sono entrambe non nulle : angolo determinato
if ( ! vtPerp.IsZero() && ! vtPerpE.IsZero()) {
if ( vtPerp.SqLen() > dEpsZero * dEpsZero && vtPerpE.SqLen() > dEpsZero * dEpsZero) {
// secondo vettore perpendicolare ad asse e a componente perpendicolare
Vector3d vtPerp2 = vtDirAx ^ vtPerp ;
// proporzionali a seno e coseno del perpendicolare E