Correct computation of H/W ratio in Bora (Igor Zivanovic).

* Bug: In Bora/SlicingDataModel, the division was done with integers,
    leading so there was a rounding *before* we casted to double.
      Now, use the BoxSet::getRatio() method and cast to double *before*
    dividing.
This commit is contained in:
Jean-Paul Chaput 2020-04-08 15:09:20 +02:00
parent a50b6ce317
commit 74e4544a55
2 changed files with 6 additions and 7 deletions

View File

@ -77,12 +77,11 @@ namespace Bora {
NodeSets nodeSets = slicingtree->getNodeSets();
switch ( index.column() ) {
case 0: return QVariant( row );
case 1: return QVariant( DbU::toPhysical(nodeSets[row]->getHeight() , DbU::Micro) );
case 2: return QVariant( DbU::toPhysical(nodeSets[row]->getWidth() , DbU::Micro) );
case 3: return QVariant( nodeSets[row]->getOccupationArea() );
case 4: return QVariant( nodeSets[row]->getCpt() );
case 5: return QVariant( (double) ( nodeSets[row]->getWidth()
/ nodeSets[row]->getHeight()) );
case 1: return QVariant( DbU::toPhysical(nodeSets[row]->getHeight(), DbU::Micro) );
case 2: return QVariant( DbU::toPhysical(nodeSets[row]->getWidth (), DbU::Micro) );
case 3: return QVariant( nodeSets[row]->getOccupationArea() );
case 4: return QVariant( nodeSets[row]->getCpt() );
case 5: return QVariant( nodeSets[row]->getRatio() );
case 6: return QVariant( DbU::getPhysical( nodeSets[row]->getWidth() ,DbU::Micro)
* DbU::getPhysical( nodeSets[row]->getHeight(),DbU::Micro) );
default:

View File

@ -87,7 +87,7 @@ namespace Bora {
inline DbU::Unit BoxSet::getWidth () const { return _width; }
inline unsigned int BoxSet::getCpt () const { return _cpt; }
inline void BoxSet::incrementCpt () { _cpt++; }
inline double BoxSet::getRatio () { return _width/_height; }
inline double BoxSet::getRatio () { return (double)_width/(double)_height; }
inline double BoxSet::getArea () { return _width*_height; }
inline unsigned int BoxSet::getType () const { return UnknownType; }
inline double BoxSet::getOccupationArea () const { return 100; }