EgtGeomKernel 1.5j5 :

- gestione flag BBF_EXACT per calcolo BBox.
This commit is contained in:
Dario Sassi
2014-10-20 14:01:02 +00:00
parent 577526f23d
commit cf8fbdc335
23 changed files with 92 additions and 64 deletions
+2 -2
View File
@@ -607,7 +607,7 @@ CurveArc::Load( NgeReader& ngeIn)
//----------------------------------------------------------------------------
bool
CurveArc::GetLocalBBox( BBox3d& b3Loc) const
CurveArc::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
{
// verifico lo stato
if ( m_nStatus != OK)
@@ -625,7 +625,7 @@ CurveArc::GetLocalBBox( BBox3d& b3Loc) const
//----------------------------------------------------------------------------
bool
CurveArc::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
CurveArc::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
{
// verifico lo stato
if ( m_nStatus != OK)
+2 -2
View File
@@ -30,8 +30,8 @@ class CurveArc : public ICurveArc, public IGeoObjRW
{ return ( m_nStatus == OK) ; }
virtual const std::string& GetTitle( void) const ;
virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const ;
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual bool Translate( const Vector3d& vtMove) ;
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
{ double dAngRad = dAngDeg * DEGTORAD ;
+40 -8
View File
@@ -471,21 +471,37 @@ CurveBezier::Validate( void)
//----------------------------------------------------------------------------
bool
CurveBezier::GetLocalBBox( BBox3d& b3Loc) const
CurveBezier::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
{
// verifico lo stato
if ( m_nStatus != OK)
return false ;
// assegno il box in locale
b3Loc.Reset() ;
for ( int i = 0 ; i <= m_nDeg ; ++ i)
b3Loc.Add( m_aPtCtrl[i]) ;
// basta approssimato
if ( ( nFlag & BBF_EXACT) == 0) {
for ( int i = 0 ; i <= m_nDeg ; ++ i)
b3Loc.Add( m_aPtCtrl[i]) ;
}
// deve essere preciso
else {
// costruisco una approssimazione lineare
PolyLine PL ;
if ( ! ApproxWithLines( LIN_TOL_STD, ANG_TOL_STD_DEG, PL))
return false ;
// ciclo sui punti della approssimazione
Point3d ptTemp ;
for ( bool bFound = PL.GetFirstPoint( ptTemp) ; bFound ; bFound = PL.GetNextPoint( ptTemp)) {
b3Loc.Add( ptTemp) ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
CurveBezier::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
CurveBezier::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
{
// verifico lo stato
if ( m_nStatus != OK)
@@ -495,10 +511,26 @@ CurveBezier::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
return false ;
// assegno il box nel riferimento
b3Ref.Reset() ;
for ( int i = 0 ; i <= m_nDeg ; ++ i) {
Point3d ptTemp = m_aPtCtrl[i] ;
ptTemp.ToGlob( frRef) ;
b3Ref.Add( ptTemp) ;
// basta approssimato
if ( ( nFlag & BBF_EXACT) == 0) {
for ( int i = 0 ; i <= m_nDeg ; ++ i) {
Point3d ptTemp = m_aPtCtrl[i] ;
ptTemp.ToGlob( frRef) ;
b3Ref.Add( ptTemp) ;
}
}
// deve essere preciso
else {
// costruisco una approssimazione lineare
PolyLine PL ;
if ( ! ApproxWithLines( LIN_TOL_STD, ANG_TOL_STD_DEG, PL))
return false ;
// ciclo sui punti della approssimazione
Point3d ptTemp ;
for ( bool bFound = PL.GetFirstPoint( ptTemp) ; bFound ; bFound = PL.GetNextPoint( ptTemp)) {
ptTemp.ToGlob( frRef) ;
b3Ref.Add( ptTemp) ;
}
}
return true ;
+2 -2
View File
@@ -32,8 +32,8 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
{ return ( m_nStatus == OK) ; }
virtual const std::string& GetTitle( void) const ;
virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const ;
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual bool Translate( const Vector3d& vtMove) ;
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
{ double dAngRad = dAngDeg * DEGTORAD ;
+4 -4
View File
@@ -646,7 +646,7 @@ CurveComposite::Load( NgeReader& ngeIn)
//----------------------------------------------------------------------------
bool
CurveComposite::GetLocalBBox( BBox3d& b3Loc) const
CurveComposite::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
{
// verifico lo stato
if ( m_nStatus != OK)
@@ -659,7 +659,7 @@ CurveComposite::GetLocalBBox( BBox3d& b3Loc) const
while ( pCrvSmpl != nullptr) {
BBox3d b3Crv ;
// recupero il box della curva
pCrvSmpl->GetLocalBBox( b3Crv) ;
pCrvSmpl->GetLocalBBox( b3Crv, nFlag) ;
// aggiorno il box
b3Loc.Add( b3Crv) ;
// passo alla curva successiva
@@ -670,7 +670,7 @@ CurveComposite::GetLocalBBox( BBox3d& b3Loc) const
//----------------------------------------------------------------------------
bool
CurveComposite::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
CurveComposite::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
{
// verifico lo stato
if ( m_nStatus != OK)
@@ -686,7 +686,7 @@ CurveComposite::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
while ( pCrvSmpl != nullptr) {
BBox3d b3Crv ;
// recupero il box della curva
pCrvSmpl->GetBBox( frRef, b3Crv) ;
pCrvSmpl->GetBBox( frRef, b3Crv, nFlag) ;
// aggiorno il box
b3Ref.Add( b3Crv) ;
// passo alla curva successiva
+2 -2
View File
@@ -32,8 +32,8 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
{ return ( m_nStatus == OK) ; }
virtual const std::string& GetTitle( void) const ;
virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const ;
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual bool Translate( const Vector3d& vtMove) ;
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
{ double dAngRad = dAngDeg * DEGTORAD ;
+2 -2
View File
@@ -202,7 +202,7 @@ CurveLine::Load( NgeReader& ngeIn)
//----------------------------------------------------------------------------
bool
CurveLine::GetLocalBBox( BBox3d& b3Loc) const
CurveLine::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
{
// verifico lo stato
if ( m_nStatus != OK)
@@ -214,7 +214,7 @@ CurveLine::GetLocalBBox( BBox3d& b3Loc) const
//----------------------------------------------------------------------------
bool
CurveLine::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
CurveLine::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
{
// verifico lo stato
if ( m_nStatus != OK)
+2 -2
View File
@@ -30,8 +30,8 @@ class CurveLine : public ICurveLine, public IGeoObjRW
{ return ( m_nStatus == OK) ; }
virtual const std::string& GetTitle( void) const ;
virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const ;
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual bool Translate( const Vector3d& vtMove) ;
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
{ double dAngRad = dAngDeg * DEGTORAD ;
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -327,7 +327,7 @@ ExtText::Load( NgeReader& ngeIn)
//----------------------------------------------------------------------------
bool
ExtText::GetLocalBBox( BBox3d& b3Loc) const
ExtText::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
{
// recupero il font manager
FontManager& fntMgr = FontManager::GetFontManager() ;
@@ -351,7 +351,7 @@ ExtText::GetLocalBBox( BBox3d& b3Loc) const
//----------------------------------------------------------------------------
bool
ExtText::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
ExtText::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
{
// verifico validità del frame
if ( frRef.GetType() == Frame3d::ERR)
+2 -2
View File
@@ -30,8 +30,8 @@ class ExtText : public IExtText, public IGeoObjRW
{ return true ; }
virtual const std::string& GetTitle( void) const ;
virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const ;
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual bool Translate( const Vector3d& vtMove) ;
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
{ double dAngRad = dAngDeg * DEGTORAD ;
+2 -2
View File
@@ -186,7 +186,7 @@ GdbGeo::GetLocalBBox( BBox3d& b3Loc, int nFlag, int nLev) const
}
}
return m_pGeoObj->GetLocalBBox( b3Loc) ;
return m_pGeoObj->GetLocalBBox( b3Loc, nFlag) ;
}
//----------------------------------------------------------------------------
@@ -225,7 +225,7 @@ GdbGeo::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag, int nLev) const
}
}
return m_pGeoObj->GetBBox( frRef, b3Ref) ;
return m_pGeoObj->GetBBox( frRef, b3Ref, nFlag) ;
}
//----------------------------------------------------------------------------
+3 -3
View File
@@ -45,9 +45,9 @@ class GdbIterator : public IGdbIterator
virtual int GetId( void) const ;
virtual int GetParentId( void) const ;
virtual bool GetGlobFrame( Frame3d& frGlob) const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_NONE) const ;
virtual bool GetGlobalBBox( BBox3d& b3Glob, int nFlag = BBF_NONE) const ;
virtual bool GetRefBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_NONE) const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetGlobalBBox( BBox3d& b3Glob, int nFlag = BBF_STANDARD) const ;
virtual bool GetRefBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual bool SetLevel( int nLevel) ;
virtual bool RevertLevel( void) ;
virtual bool GetLevel( int& nLevel) const ;
+2 -2
View File
@@ -170,7 +170,7 @@ GeoFrame3d::Load( NgeReader& ngeIn)
//----------------------------------------------------------------------------
bool
GeoFrame3d::GetLocalBBox( BBox3d& b3Loc) const
GeoFrame3d::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
{
// assegno il box in locale (considero l'origine)
b3Loc.Set( m_frF.Orig()) ;
@@ -179,7 +179,7 @@ GeoFrame3d::GetLocalBBox( BBox3d& b3Loc) const
//----------------------------------------------------------------------------
bool
GeoFrame3d::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
GeoFrame3d::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
{
// verifico validità del frame
if ( frRef.GetType() == Frame3d::ERR)
+2 -2
View File
@@ -30,8 +30,8 @@ class GeoFrame3d : public IGeoFrame3d, public IGeoObjRW
{ return ( m_frF.GetType() != Frame3d::ERR) ; }
virtual const std::string& GetTitle( void) const ;
virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const ;
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual bool GetFrame( Frame3d& frF) const
{ frF = m_frF ; return true ;}
virtual bool Translate( const Vector3d& vtMove)
+2 -2
View File
@@ -136,7 +136,7 @@ GeoPoint3d::Load( NgeReader& ngeIn)
//----------------------------------------------------------------------------
bool
GeoPoint3d::GetLocalBBox( BBox3d& b3Loc) const
GeoPoint3d::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
{
// assegno il box in locale
b3Loc.Set( m_ptP) ;
@@ -145,7 +145,7 @@ GeoPoint3d::GetLocalBBox( BBox3d& b3Loc) const
//----------------------------------------------------------------------------
bool
GeoPoint3d::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
GeoPoint3d::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
{
// verifico validità del frame
if ( frRef.GetType() == Frame3d::ERR)
+2 -2
View File
@@ -30,8 +30,8 @@ class GeoPoint3d : public IGeoPoint3d, public IGeoObjRW
{ return true ; }
virtual const std::string& GetTitle( void) const ;
virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const ;
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual bool Translate( const Vector3d& vtMove)
{ m_OGrMgr.Reset() ; m_ptP.Translate( vtMove) ; return true ; }
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
+2 -2
View File
@@ -162,7 +162,7 @@ GeoVector3d::Load( NgeReader& ngeIn)
//----------------------------------------------------------------------------
bool
GeoVector3d::GetLocalBBox( BBox3d& b3Loc) const
GeoVector3d::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
{
// il box tiene conto della posizione della base e del tip
b3Loc.Set( m_ptBase, m_ptBase + m_vtV) ;
@@ -171,7 +171,7 @@ GeoVector3d::GetLocalBBox( BBox3d& b3Loc) const
//----------------------------------------------------------------------------
bool
GeoVector3d::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
GeoVector3d::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
{
// verifico validità del frame
if ( frRef.GetType() == Frame3d::ERR)
+2 -2
View File
@@ -29,8 +29,8 @@ class GeoVector3d : public IGeoVector3d, public IGeoObjRW
{ return true ; }
virtual const std::string& GetTitle( void) const ;
virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const ;
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual bool Translate( const Vector3d& vtMove)
{ m_OGrMgr.Reset() ; m_ptBase.Translate( vtMove) ; return true ; }
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
+3 -3
View File
@@ -53,9 +53,9 @@ class GeomDB : public IGeomDB
virtual int GetParentId( int nId) const ;
virtual bool GetGlobFrame( int nId, Frame3d& frGlob) const
{ return GetGroupGlobFrame( GetParentId( nId), frGlob) ; }
virtual bool GetLocalBBox( int nId, BBox3d& b3Loc, int nFlag = BBF_NONE) const ;
virtual bool GetGlobalBBox( int nId, BBox3d& b3Glob, int nFlag = BBF_NONE) const ;
virtual bool GetRefBBox( int nId, const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_NONE) const ;
virtual bool GetLocalBBox( int nId, BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetGlobalBBox( int nId, BBox3d& b3Glob, int nFlag = BBF_STANDARD) const ;
virtual bool GetRefBBox( int nId, const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual int Copy( int nIdSou, int nIdDest, int nRefId, int nSonBeforeAfter = GDB_SON)
{ return Copy( nIdSou, nIdDest, nRefId, nSonBeforeAfter, false) ; }
virtual int CopyGlob( int nIdSou, int nIdDest, int nRefId, int nSonBeforeAfter = GDB_SON)
+2 -2
View File
@@ -1612,7 +1612,7 @@ SurfTriMesh::DoSewing( const ISurfTriMesh& stmOther, const Frame3d& frOther)
//----------------------------------------------------------------------------
bool
SurfTriMesh::GetLocalBBox( BBox3d& b3Loc) const
SurfTriMesh::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
{
// verifico lo stato
if ( m_nStatus != OK)
@@ -1628,7 +1628,7 @@ SurfTriMesh::GetLocalBBox( BBox3d& b3Loc) const
//----------------------------------------------------------------------------
bool
SurfTriMesh::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
SurfTriMesh::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
{
// verifico lo stato
if ( m_nStatus != OK)
+2 -2
View File
@@ -65,8 +65,8 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
{ return ( m_nStatus == OK) ; }
virtual const std::string& GetTitle( void) const ;
virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const ;
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual bool Translate( const Vector3d& vtMove) ;
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
{ double dAngRad = dAngDeg * DEGTORAD ;
+8 -12
View File
@@ -347,12 +347,10 @@ Vector3d::ToGlob( const Frame3d& frRef)
return true ;
// eseguo trasformazione
if ( frRef.GetType() != Frame3d::TOP) {
Vector3d vtT( x, y, z) ;
x = vtT.x * frRef.VersX().x + vtT.y * frRef.VersY().x + vtT.z * frRef.VersZ().x ;
y = vtT.x * frRef.VersX().y + vtT.y * frRef.VersY().y + vtT.z * frRef.VersZ().y ;
z = vtT.x * frRef.VersX().z + vtT.y * frRef.VersY().z + vtT.z * frRef.VersZ().z ;
}
Vector3d vtT( x, y, z) ;
x = vtT.x * frRef.VersX().x + vtT.y * frRef.VersY().x + vtT.z * frRef.VersZ().x ;
y = vtT.x * frRef.VersX().y + vtT.y * frRef.VersY().y + vtT.z * frRef.VersZ().y ;
z = vtT.x * frRef.VersX().z + vtT.y * frRef.VersY().z + vtT.z * frRef.VersZ().z ;
return true ;
}
@@ -372,12 +370,10 @@ Vector3d::ToLoc( const Frame3d& frRef)
return true ;
// eseguo trasformazione
if ( frRef.GetType() != Frame3d::TOP) {
Vector3d vtT( x, y, z) ;
x = vtT.x * frRef.VersX().x + vtT.y * frRef.VersX().y + vtT.z * frRef.VersX().z ;
y = vtT.x * frRef.VersY().x + vtT.y * frRef.VersY().y + vtT.z * frRef.VersY().z ;
z = vtT.x * frRef.VersZ().x + vtT.y * frRef.VersZ().y + vtT.z * frRef.VersZ().z ;
}
Vector3d vtT( x, y, z) ;
x = vtT.x * frRef.VersX().x + vtT.y * frRef.VersX().y + vtT.z * frRef.VersX().z ;
y = vtT.x * frRef.VersY().x + vtT.y * frRef.VersY().y + vtT.z * frRef.VersY().z ;
z = vtT.x * frRef.VersZ().x + vtT.y * frRef.VersZ().y + vtT.z * frRef.VersZ().z ;
return true ;
}