aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-09-30 11:44:02 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-09-30 11:44:02 +0200
commit75a60d3ac0ac10be7317b268911d0098acbbf472 (patch)
tree853ba703cc4a4aa19a182330afec27504404cde7
parent9136b9521947e4b99904b7c54d314a168f058ae5 (diff)
bug #1075: fix AlignedBox::sample for runtime dimension
-rw-r--r--Eigen/src/Geometry/AlignedBox.h2
-rw-r--r--test/geo_alignedbox.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/Eigen/src/Geometry/AlignedBox.h b/Eigen/src/Geometry/AlignedBox.h
index 186d4ecad..03f1a11f8 100644
--- a/Eigen/src/Geometry/AlignedBox.h
+++ b/Eigen/src/Geometry/AlignedBox.h
@@ -163,7 +163,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
* a uniform distribution */
inline VectorType sample() const
{
- VectorType r;
+ VectorType r(dim());
for(Index d=0; d<dim(); ++d)
{
if(!ScalarTraits::IsInteger)
diff --git a/test/geo_alignedbox.cpp b/test/geo_alignedbox.cpp
index e2792ed18..c883234a8 100644
--- a/test/geo_alignedbox.cpp
+++ b/test/geo_alignedbox.cpp
@@ -179,6 +179,8 @@ void test_geo_alignedbox()
CALL_SUBTEST_9( alignedbox(AlignedBox1i()) );
CALL_SUBTEST_10( alignedbox(AlignedBox2i()) );
CALL_SUBTEST_11( alignedbox(AlignedBox3i()) );
+
+ CALL_SUBTEST_14( alignedbox(AlignedBox<double,Dynamic>(4)) );
}
CALL_SUBTEST_12( specificTest1() );
CALL_SUBTEST_13( specificTest2() );