32 double rot2,
double tilt2,
33 double rot_limit,
double tilt_limit,
34 SymList &SL,
bool include_mirrors,
37 bool are_unique =
true;
38 double rot2p, tilt2p, psi2p, psi2 = 0.;
39 double diff_rot, diff_tilt;
42 for (
int isym = 0; isym <= isymmax; isym++)
56 double aux=rot - rot2p;
57 diff_rot = fabs(
realWRAP(aux, -180, 180));
59 diff_tilt = fabs(
realWRAP(aux, -180, 180));
60 if ((rot_limit - diff_rot) > 1e-3 && (tilt_limit - diff_tilt) > 1e-3)
64 diff_rot = fabs(
realWRAP(aux, -180, 180));
66 diff_tilt = fabs(
realWRAP(aux, -180, 180));
67 if ((rot_limit - diff_rot) > 1e-3 && (tilt_limit - diff_tilt) > 1e-3)
73 diff_rot = fabs(
realWRAP(aux, -180, 180));
75 diff_tilt = fabs(
realWRAP(aux, -180, 180));
76 if ((rot_limit - diff_rot) > 1e-3 && (tilt_limit - diff_tilt) > 1e-3)
80 diff_rot = fabs(
realWRAP(aux, -180, 180));
82 diff_tilt = fabs(
realWRAP(aux, -180, 180));
83 if ((rot_limit - diff_rot) > 1e-3 && (tilt_limit - diff_tilt) > 1e-3)
92 double rot2,
double tilt2,
96 double rot2p, tilt2p, psi2p, dist;
97 double diff_rot, diff_tilt;
99 double aux=rot1 - rot2;
100 diff_rot = fabs(
realWRAP(aux, -180, 180));
102 diff_tilt = fabs(
realWRAP(aux, -180, 180));
103 dist =
sqrt((diff_rot * diff_rot) + (diff_tilt * diff_tilt));
107 diff_rot = fabs(
realWRAP(aux, -180, 180));
109 diff_tilt = fabs(
realWRAP(aux, -180, 180));
110 dist = fmin(dist,
sqrt((diff_rot * diff_rot) + (diff_tilt * diff_tilt)));
116 diff_rot = fabs(
realWRAP(aux, -180, 180));
118 diff_tilt = fabs(
realWRAP(aux, -180, 180));
119 dist = fmin(dist,
sqrt((diff_rot * diff_rot) + (diff_tilt * diff_tilt)));
123 diff_rot = fabs(
realWRAP(aux, -180, 180));
125 diff_tilt = fabs(
realWRAP(aux, -180, 180));
126 dist = fmin(dist,
sqrt((diff_rot * diff_rot) + (diff_tilt * diff_tilt)));
136 int rot_nstep, tilt_nstep =
ROUND(180. / sampling) + 1;
137 double rot_sam, tilt, tilt_sam;
139 tilt_sam = (180. / tilt_nstep);
144 rotList.reserve(20000);
145 tiltList.reserve(20000);
147 for (
int tilt_step = 0; tilt_step < tilt_nstep; tilt_step++)
149 tilt = ((double)tilt_step / (tilt_nstep - 1)) * 180.;
151 rot_nstep =
CEIL(360. * sin(
DEG2RAD(tilt)) / sampling);
154 rot_sam = 360. / (double)rot_nstep;
155 for (
double rot = 0.; rot < 360.; rot += rot_sam)
159 size_t imax=rotList.size();
160 double *ptrRot=
nullptr;
161 double *ptrTilt=
nullptr;
165 ptrTilt=&tiltList[0];
167 for (
size_t i=0;
i<imax; ++
i, ++ptrRot, ++ptrTilt)
170 include_mirror, L, R))
178 rotList.push_back(rot);
179 tiltList.push_back(tilt);
195 std::vector<double> &rotList, std::vector<double> &tiltList,
200 double dist, mindist;
201 double newrot, newtilt, newpsi;
206 size_t nmax=rotList.size();
207 double *ptrRot=
nullptr;
208 double *ptrTilt=
nullptr;
212 ptrTilt=&tiltList[0];
214 for (
size_t n=0;
n<
nmax; ++
n, ++ptrRot, ++ptrTilt)
223 for (
int i = 0;
i < imax;
i++)
void getMatrices(int i, Matrix2D< double > &L, Matrix2D< double > &R, bool homogeneous=true) const
void make_even_distribution(std::vector< double > &rotList, std::vector< double > &tiltList, double sampling, SymList &SL, bool include_mirror)
Make even distribution, taking symmetry into account.
void Euler_another_set(double rot, double tilt, double psi, double &newrot, double &newtilt, double &newpsi)
void sqrt(Image< double > &op)
void Euler_apply_transf(const Matrix2D< double > &L, const Matrix2D< double > &R, double rot, double tilt, double psi, double &newrot, double &newtilt, double &newpsi)
void limit_tilt_range(MetaDataVec &DF, double tilt_range0, double tilt_rangeF)
Select a user-provided tilt range.
int find_nearest_direction(double rot1, double tilt1, std::vector< double > &rotList, std::vector< double > &tiltList, SymList &SL, Matrix2D< double > &Laux, Matrix2D< double > &Raux)
Determine which of the entries in DFlib is closest to [rot1,tilt1].
void Euler_up_down(double rot, double tilt, double psi, double &newrot, double &newtilt, double &newpsi)
double distance_directions(double rot1, double tilt1, double rot2, double tilt2, bool include_mirrors)
Calculate angular distance between two directions.
#define realWRAP(x, x0, xF)
bool directions_are_unique(double rot, double tilt, double rot2, double tilt2, double rot_limit, double tilt_limit, SymList &SL, bool include_mirrors, Matrix2D< double > &Laux, Matrix2D< double > &Raux)
Check whether projection directions are unique.