EgtGeomKernel 1.6d3 :

- aggiunte translate e rotate a BBox3d.
This commit is contained in:
Dario Sassi
2015-04-20 08:38:30 +00:00
parent 08831a6849
commit 342cb24574
2 changed files with 48 additions and 0 deletions
+48
View File
@@ -187,6 +187,54 @@ BBox3d::GetRadius( double& dRad) const
return true ;
}
//----------------------------------------------------------------------------
void
BBox3d::Translate( const Vector3d& vtMove)
{
if ( ! IsValid())
return ;
// non essendoci cambio di orientamento, traslo semplicemente i punti
m_ptMin = m_ptMin + vtMove ;
m_ptMax = m_ptMax + vtMove ;
}
//----------------------------------------------------------------------------
bool
BBox3d::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
{
double dAngRad = dAngDeg * DEGTORAD ;
return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ;
}
//----------------------------------------------------------------------------
bool
BBox3d::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
{
if ( ! IsValid())
return false ;
// ruoto il minimo
Point3d ptMinRot = m_ptMin ;
if ( ! ptMinRot.Rotate( ptAx, vtAx, dCosAng, dSinAng))
return false ;
// ruoto i vettori dal Min al Max diretti come gli assi locali
Vector3d vtXRot( m_ptMax.x - m_ptMin.x, 0, 0) ;
vtXRot.Rotate( vtAx, dCosAng, dSinAng) ;
Vector3d vtYRot( 0, m_ptMax.y - m_ptMin.y, 0) ;
vtYRot.Rotate( vtAx, dCosAng, dSinAng) ;
Vector3d vtZRot( 0, 0, m_ptMax.z - m_ptMin.z) ;
vtZRot.Rotate( vtAx, dCosAng, dSinAng) ;
// calcolo il box trasformato
Set( ptMinRot) ;
Add( ptMinRot + vtXRot) ;
Add( ptMinRot + vtYRot) ;
Add( ptMinRot + vtZRot) ;
Add( ptMinRot + vtXRot + vtYRot) ;
Add( ptMinRot + vtYRot + vtZRot) ;
Add( ptMinRot + vtZRot + vtXRot) ;
Add( ptMinRot + vtXRot + vtYRot + vtZRot) ;
return true ;
}
//----------------------------------------------------------------------------
bool
BBox3d::ToGlob( const Frame3d& frRef)