seams-core v2.14.0
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
gen::mic Namespace Reference

Functions

std::array< double, 3 > euclideanIfShorter (double lx, double ly, double lz, double xy, double xz, double yz, const std::array< double, 3 > &raw, const std::array< double, 3 > &wrapped)

Function Documentation

◆ euclideanIfShorter()

std::array< double, 3 > gen::mic::euclideanIfShorter ( double lx,
double ly,
double lz,
double xy,
double xz,
double yz,
const std::array< double, 3 > & raw,
const std::array< double, 3 > & wrapped )
inline

Definition at line 375 of file euclidean_mic.hpp.

376 {
377 const Cached &slot = cachedBasis(lx, ly, lz, xy, xz, yz);
378 const Vec3 y{raw[0], raw[1], raw[2]};
379 const Vec3 w{wrapped[0], wrapped[1], wrapped[2]};
380 const Vec3 euc = (slot.engineStart && slot.s.ok) ? descend(slot.s, w)
381 : closestDisplacement(slot.s, y);
382 const double f2 = n2(w);
383 const double e2 = n2(euc);
384 if (e2 + 1e-12 * (1.0 + f2) < f2) {
385 return {euc.x, euc.y, euc.z};
386 }
387 return wrapped;
388}