22#include <shapes/Ellipsoid.hpp>
39 int distance_prefactor = -1;
40 if (not inside_ellipsoid(ppos_e)) {
41 l = *std::ranges::max_element(m_semiaxes) * ppos_e.
norm();
42 distance_prefactor = 1;
48 while ((eps >= 1e-12) and (step < 100)) {
50 l -= newton_term(ppos_e, l0);
51 eps = std::abs(l - l0);
56 for (
unsigned int i = 0; i < 3; i++) {
57 auto const semi_sq =
Utils::sqr(m_semiaxes[i]);
58 vec[i] = (ppos_e[i] - semi_sq * ppos_e[i] / (l + semi_sq));
61 dist = distance_prefactor * m_direction * vec.
norm();
69 const double &l)
const {
71 for (
unsigned int i = 0; i < 3; i++) {
77 return (axpos[0] * lax2[1] * lax2[2] + axpos[1] * lax2[2] * lax2[0] +
78 axpos[2] * lax2[0] * lax2[1] - lax2[0] * lax2[1] * lax2[2]) /
79 (2 * (axpos[0] * lax[1] * lax2[2] + axpos[1] * lax[2] * lax2[0] +
80 axpos[2] * lax[0] * lax2[1] + axpos[0] * lax2[1] * lax[2] +
81 axpos[1] * lax2[2] * lax[0] + axpos[2] * lax2[0] * lax[1] -
82 lax[0] * lax2[1] * lax2[2] - lax2[0] * lax[1] * lax2[2] -
83 lax2[0] * lax2[1] * lax[2]));
Vector implementation and trait types for boost qvm interoperability.
void calculate_dist(const Utils::Vector3d &pos, double &dist, Utils::Vector3d &vec) const override
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.
auto hadamard_division(Vector< T, N > const &a, Vector< U, N > const &b)