12 #include <Eigen/Geometry>
16 template<
typename HyperplaneType>
void hyperplane(
const HyperplaneType& _plane)
22 const Index dim = _plane.dim();
23 enum { Options = HyperplaneType::Options };
27 typedef Matrix<
Scalar, HyperplaneType::AmbientDimAtCompileTime,
28 HyperplaneType::AmbientDimAtCompileTime>
MatrixType;
33 VectorType n0 = VectorType::Random(dim).normalized();
36 HyperplaneType pl0(n0,
p0);
37 HyperplaneType pl1(
n1,
p1);
38 HyperplaneType pl2 = pl1;
40 Scalar s0 = internal::random<Scalar>();
41 Scalar s1 = internal::random<Scalar>();
56 MatrixType rot = MatrixType::Random(dim,dim).householderQr().householderQ();
80 const int Dim = HyperplaneType::AmbientDimAtCompileTime;
88 template<
typename Scalar>
void lines()
96 for(
int i = 0;
i < 10;
i++)
98 Vector center = Vector::Random();
99 Vector u = Vector::Random();
101 Scalar a = internal::random<Scalar>();
102 while (
abs(
a-1) <
Scalar(1
e-4))
a = internal::random<Scalar>();
103 while (u.norm() <
Scalar(1
e-4)) u = Vector::Random();
104 while (
v.norm() <
Scalar(1
e-4))
v = Vector::Random();
106 HLine line_u = HLine::Through(center + u, center +
a*u);
107 HLine line_v = HLine::Through(center +
v, center +
a*
v);
122 CoeffsType converted_coeffs = line_u2.coeffs();
123 if(line_u2.normal().dot(line_u.normal())<
Scalar(0))
124 converted_coeffs = -line_u2.coeffs();
125 VERIFY(line_u.coeffs().isApprox(converted_coeffs));
135 for(
int i = 0;
i < 10;
i++)
139 if(internal::random<double>(0,1)>0.25)
140 v1 += Vector::Random();
141 if(internal::random<double>(0,1)>0.25)
142 v2 +=
v1 *
std::pow(internal::random<Scalar>(0,1),internal::random<int>(1,16));
143 if(internal::random<double>(0,1)>0.25)
144 v2 += Vector::Random() *
std::pow(internal::random<Scalar>(0,1),internal::random<int>(1,16));
146 Plane
p0 = Plane::Through(
v0,
v1,
v2);
163 Scalar* array3u = array3+1;
165 Plane3a *
p1 = ::new(
reinterpret_cast<void*
>(array1)) Plane3a;
166 Plane3u *
p2 = ::new(
reinterpret_cast<void*
>(array2)) Plane3u;
167 Plane3u *
p3 = ::new(
reinterpret_cast<void*
>(array3u)) Plane3u;
169 p1->coeffs().setRandom();