11 #include <Eigen/Geometry> 22 template<
typename BoxType>
void alignedbox(
const BoxType& _box)
33 VectorType
p0 = VectorType::Random(dim);
34 VectorType
p1 = VectorType::Random(dim);
36 p1 = VectorType::Random(dim); }
37 RealScalar s1 = internal::random<RealScalar>(0,1);
40 BoxType
b1(VectorType::Random(dim),VectorType::Random(dim));
49 VERIFY(b0.contains(p0*s1+(Scalar(1)-s1)*p1));
50 VERIFY(b0.contains(b0.center()));
59 BoxType box1(VectorType::Random(dim));
60 box1.extend(VectorType::Random(dim));
61 BoxType box2(VectorType::Random(dim));
62 box2.extend(VectorType::Random(dim));
64 VERIFY(box1.intersects(box2) == !box1.intersection(box2).isEmpty());
67 BoxType *bp0 =
new BoxType(dim);
68 BoxType *bp1 =
new BoxType(dim);
74 for(
int i=0;
i<10; ++
i )
76 VectorType r = b0.sample();
84 template<
typename BoxType>
93 VectorType
p0 = VectorType::Random(dim);
94 VectorType
p1 = VectorType::Random(dim);
101 const int Dim = BoxType::AmbientDimAtCompileTime;
112 Vector2f
m; m << -1.0f, -2.0f;
113 Vector2f
M; M << 1.0f, 5.0f;
115 typedef AlignedBox2f BoxType;
118 Vector2f sides = M-
m;
130 Vector2f bottomRight; bottomRight << M[0], m[1];
131 Vector2f
topLeft; topLeft << m[0], M[1];
139 Vector3i
m; m << -1, -2, 0;
140 Vector3i
M; M << 1, 5, 3;
142 typedef AlignedBox3i BoxType;
145 Vector3i sides = M-
m;
156 Vector3i bottomRightFloor; bottomRightFloor << M[0], m[1], m[2];
157 Vector3i topLeftFloor; topLeftFloor << m[0], M[1], m[2];
158 VERIFY_IS_APPROX( bottomRightFloor, box.corner( BoxType::BottomRightFloor ) );
180 CALL_SUBTEST_10(
alignedbox(AlignedBox2i()) );
181 CALL_SUBTEST_11(
alignedbox(AlignedBox3i()) );
void alignedboxCastTests(const BoxType &_box)
Matrix< RealScalar, Dynamic, Dynamic > M
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define EIGEN_DONT_INLINE
EIGEN_DONT_INLINE void kill_extra_precision(T &x)
void test_geo_alignedbox()
#define VERIFY_IS_APPROX(a, b)
void alignedbox(const BoxType &_box)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
GTSAM_EXPORT Matrix3 topLeft(const SO4 &Q, OptionalJacobian< 9, 6 > H)
NumTraits< Scalar >::Real RealScalar
const mpreal dim(const mpreal &a, const mpreal &b, mp_rnd_t r=mpreal::get_default_rnd())
The matrix class, also used for vectors and row-vectors.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
friend const mpreal dim(const mpreal &a, const mpreal &b, mp_rnd_t rnd_mode)