22#include <shapes/Ellipsoid.hpp>
38 int distance_prefactor = -1;
39 if (not inside_ellipsoid(ppos_e)) {
40 l = *std::max_element(m_semiaxes.
begin(), m_semiaxes.
end()) * ppos_e.
norm();
41 distance_prefactor = 1;
47 while ((eps >= 1e-12) and (step < 100)) {
49 l -= newton_term(ppos_e, l0);
50 eps = std::abs(l - l0);
55 for (
unsigned int i = 0; i < 3; i++) {
56 auto const semi_sq =
Utils::sqr(m_semiaxes[i]);
57 vec[i] = (ppos_e[i] - semi_sq * ppos_e[i] / (l + semi_sq));
60 dist = distance_prefactor * m_direction * vec.
norm();
68 const double &l)
const {
70 for (
unsigned int i = 0; i < 3; i++) {
76 return (axpos[0] * lax2[1] * lax2[2] + axpos[1] * lax2[2] * lax2[0] +
77 axpos[2] * lax2[0] * lax2[1] - lax2[0] * lax2[1] * lax2[2]) /
78 (2 * (axpos[0] * lax[1] * lax2[2] + axpos[1] * lax[2] * lax2[0] +
79 axpos[2] * lax[0] * lax2[1] + axpos[0] * lax2[1] * lax[2] +
80 axpos[1] * lax2[2] * lax[0] + axpos[2] * lax2[0] * lax[1] -
81 lax[0] * lax2[1] * lax2[2] - lax2[0] * lax[1] * lax2[2] -
82 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)
DEVICE_QUALIFIER constexpr iterator begin() noexcept
DEVICE_QUALIFIER constexpr iterator end() noexcept