Bug 519 - AlignedBox::dim() is inconsistent with ctor-from-dim
AlignedBox::dim() is inconsistent with ctor-from-dim
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Geometry
3.1
All All
: Normal Unknown
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-08 20:35 UTC by Jim Bosch
Modified: 2012-10-24 10:00 UTC (History)
3 users (show)



Attachments
patch to Geometry/AlignedBox.h (539 bytes, patch)
2012-10-08 20:35 UTC, Jim Bosch
no flags Details | Diff

Description Jim Bosch 2012-10-08 20:35:39 UTC
Created attachment 300 [details]
patch to Geometry/AlignedBox.h

AlignedBox::dim() subtracts one from the internal value that contains its true dimension before returning it, making the constructor and accessor disagree:

AlignBoxXd box(4);
assert(box.dim() == 4); // fails

I suspect this is just a remnant from copy/pasting the implementation class whose internal value actually was one larger than the true dimension, like an affine transform.

A patch to fix the bug is attached.
Comment 1 Gael Guennebaud 2012-10-24 10:00:06 UTC
Thank you for the fix!

https://bitbucket.org/eigen/eigen/changeset/bd1fb10be694/
changeset:   bd1fb10be694
date:        2012-10-24 09:58:35
summary:     Fix bug 519: AlignedBox::dim() was wrong for dynamic dimensions


https://bitbucket.org/eigen/eigen/changeset/7ac37305f159/
changeset:   7ac37305f159
branch:      3.1
date:        2012-10-24 09:58:35
summary:     Fix bug 519: AlignedBox::dim() was wrong for dynamic dimensions
(transplanted from bd1fb10be694f1bec3ca950a8a533234677cdaef)

Note You need to log in before you can comment on or make changes to this bug.