8#ifndef model_GlidePlaneBase_cpp_
9#define model_GlidePlaneBase_cpp_
12#include <LatticeModule.h>
20 const std::shared_ptr<GammaSurface>& gammaSurface_in) :
30 const Eigen::Matrix<double, 3, 2>
B((Eigen::Matrix<double, 2, 3>() <<
primitiveVectors.first.cartesian().transpose(),
primitiveVectors.second.cartesian().transpose()).finished().transpose());
31 const Eigen::Matrix<double, 2, 1> nd = (
B.transpose() *
B).inverse() *
B.transpose() * P;
33 const Eigen::Matrix<double, 3, 1>
p =
B * nd.array().round().matrix();
42 const double cnNorm(cn.norm());
43 assert(cnNorm > FLT_EPSILON);
45 return P - P.dot(cn) * cn;
64 Eigen::Matrix3d
temp(Eigen::Matrix3d::Identity());
65 temp.row(2)=
z.normalized();
66 temp.row(0)=
x.normalized();
68 if((
temp*
temp.transpose()-Eigen::Matrix3d::Identity()).norm()>FLT_EPSILON)
70 std::cout<<
"x1="<<
temp.row(0)<<std::endl;
71 std::cout<<
"x2="<<
temp.row(1)<<std::endl;
72 std::cout<<
"x3="<<
temp.row(2)<<std::endl;
73 std::cout<<
"temp="<<
temp<<std::endl;
74 std::cout<<
"temp*temp^T="<<
temp*
temp.transpose()<<std::endl;
75 throw std::runtime_error(
"GlidePlaneBase: G2L is not orthogonal.");
77 if(std::fabs(
temp.determinant()-1.0)>FLT_EPSILON)
79 throw std::runtime_error(
"GlidePlaneBase: G2L is not proper.");
89 if(std::fabs(bL(2))>FLT_EPSILON)
91 throw std::runtime_error(
"SLIP VECTOR NOT ON GlidePlaneBase");
93 return bL.segment<2>(0);
VectorDimD cartesian() const
initial point of the source segment B
Eigen::Matrix< double, 3, 1 > VectorDimD
const std::pair< LatticeDirectionType, LatticeDirectionType > primitiveVectors
Eigen::Matrix< double, 2, 1 > VectorLowerDimD
LatticeVector< 3 > LatticeVectorType
static MatrixDim getG2L(const VectorDimD &x, const VectorDimD &z)
GlidePlaneBase(const LatticeVectorType &v1_in, const LatticeVectorType &v2_in, const std::shared_ptr< GammaSurface > &gammaSurface_in)
VectorLowerDimD localSlipVector(const VectorDimD &b) const
MatrixLowerDim localBasis() const
Eigen::Matrix< double, 2, 2 > MatrixLowerDim
const std::shared_ptr< GammaSurface > gammaSurface
LatticeVectorType snapToLattice(const VectorDimD &P) const
double misfitEnergy(const VectorDimD &b) const
VectorDimD snapToPlane(const VectorDimD &P) const
const Eigen::Matrix3d G2L
ReciprocalLatticeDirection< 3 > ReciprocalLatticeDirectionType
Eigen::Matrix< double, 3, 3 > MatrixDim