20#include <shapes/Torus.hpp>
69 auto const z =
e_z * c_dist;
70 auto const r_vec = c_dist - z *
e_z;
71 auto const r = r_vec.
norm();
78 auto const e_r = (r == 0.) ?
e_r_axis : r_vec / r;
80 auto const dir_vec = r_vec - e_r *
m_rad + z *
e_z;
81 auto const dir_vec_norm = dir_vec.
norm();
82 if (dir_vec_norm < 1e-14) {
85 vec = dist * c_dist / c_dist.
norm();
87 vec = dir_vec * (
m_direction * dist / dir_vec_norm);
Vector implementation and trait types for boost qvm interoperability.
Utils::Vector3d e_z
Unit vector in z direction.
void calculate_dist(const Utils::Vector3d &pos, double &dist, Utils::Vector3d &vec) const override
Utils::Vector3d e_r_axis
Alternative e_r for the on-axis corner case.
Utils::Vector3d m_center
center of the shape.
double m_direction
direction -1: inside, +1 outside
double m_tube_rad
tube radius.
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.