本文整理汇总了C++中eigen::Matrix4d::determinant方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4d::determinant方法的具体用法?C++ Matrix4d::determinant怎么用?C++ Matrix4d::determinant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::Matrix4d
的用法示例。
在下文中一共展示了Matrix4d::determinant方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsPointInCircle
bool CoverRefiner::IsPointInCircle(const VectorType& pt0,
const VectorType& pt1, const VectorType& pt2,
const VectorType& ptcheck) const {
//https://en.wikipedia.org/wiki/Circumscribed_circle
typedef Eigen::Vector2d Vector2DType;
//map points to 2 dimensions
Eigen::Matrix<double, 2, 3> T3Dto2D;
VectorType v10 = (pt1-pt0).normalized();
VectorType v = pt2-pt0;
VectorType n = v.cross( v10 );
VectorType v20 = v10.cross(n).normalized();
T3Dto2D.row(0) = v10;
T3Dto2D.row(1) = v20;
Vector2DType A;
A.fill(0); // = T3Dto2D * (pt0-pt0);
Eigen::Matrix<double, 2, 1> B = T3Dto2D * (pt1-pt0);
Eigen::Matrix<double, 2, 1> C = T3Dto2D * (pt2-pt0);
Eigen::Matrix<double, 2, 1> v1 = T3Dto2D * (ptcheck-pt0);
Eigen::Matrix4d M;
// if det(M)<0 - inside
// if det(M)=0 - on the circle
// if det(M)>0 - outside
M(0,0) = v1.squaredNorm();
M(1,0) = A.squaredNorm();
M(2,0) = B.col(0).squaredNorm();
M(3,0) = C.col(0).squaredNorm();
// std::cout<<"B: "<<B<<std::endl;
// std::cout<<"T3Dto2D * (pt1-pt0): "<<T3Dto2D * (pt1-pt0)<<std::endl;
// std::cout<<"C: "<<C<<std::endl;
// std::cout<<"v1: "<<v1<<std::endl;
M(0,1) = v1(0);
M(1,1) = A(0);
M(2,1) = B(0);
M(3,1) = C(0);
M(0,2) = v1(1);
M(1,2) = A(1);
M(2,2) = B(1);
M(3,2) = C(1);
M(0,3) = 1;
M(1,3) = 1;
M(2,3) = 1;
M(3,3) = 1;
// std::cout<<"3DPoints 1: "<<pt0<<" | "<<pt1<<" | "<<pt2<<" | "<<ptcheck<<std::endl;
// std::cout<<"M: "<<M<<std::endl;
// M = [v*v' p(1) p(2) 1; ...
// A*A' A(1) A(2) 1; ...
// B*B' B(1) B(2) 1; ...
// C*C' C(1) C(2) 1];
const double det = M.determinant();
// std::cout<<"Det: "<<det<<std::endl;
// exit(0);
if(det > 0)
return false;
else
return true;
}