Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::sla::PointRing< N > Class Template Reference

#include <src/libslic3r/SLA/SupportTreeUtils.hpp>

+ Collaboration diagram for Slic3r::sla::PointRing< N >:

Public Member Functions

 PointRing (const Vec3d &n)
 
Vec3d get (size_t idx, const Vec3d &src, double r) const
 

Static Private Member Functions

static bool constexpr is_one (double val)
 

Private Attributes

std::array< double, N - 1 > m_phis
 
Vec3d a = {0, 1, 0}
 
Vec3d b
 
double m_radius = 0.
 

Detailed Description

template<size_t N>
class Slic3r::sla::PointRing< N >

Constructor & Destructor Documentation

◆ PointRing()

template<size_t N>
Slic3r::sla::PointRing< N >::PointRing ( const Vec3d n)
inline
54 : m_phis{linspace_array<N - 1>(0., 2 * PI)}
55 {
56 // We have to address the case when the direction vector v (same as
57 // dir) is coincident with one of the world axes. In this case two of
58 // its components will be completely zero and one is 1.0. Our method
59 // becomes dangerous here due to division with zero. Instead, vector
60 // 'a' can be an element-wise rotated version of 'v'
61 if(is_one(n(X)) || is_one(n(Y)) || is_one(n(Z))) {
62 a = {n(Z), n(X), n(Y)};
63 b = {n(Y), n(Z), n(X)};
64 }
65 else {
66 a(Z) = -(n(Y)*a(Y)) / n(Z); a.normalize();
67 b = a.cross(n);
68 }
69 }
static bool constexpr is_one(double val)
Definition SupportTreeUtils.hpp:45
Vec3d b
Definition SupportTreeUtils.hpp:42
Vec3d a
Definition SupportTreeUtils.hpp:42
std::array< double, N - 1 > m_phis
Definition SupportTreeUtils.hpp:34
static constexpr double PI
Definition libslic3r.h:58
std::array< ArithmeticOnly< T >, N > linspace_array(const T &start, const T &stop)
Definition MTUtils.hpp:107
@ Y
Definition libslic3r.h:99
@ Z
Definition libslic3r.h:100
@ X
Definition libslic3r.h:98

References Slic3r::sla::PointRing< N >::a, Slic3r::sla::PointRing< N >::b, Slic3r::sla::PointRing< N >::is_one(), Slic3r::X, Slic3r::Y, and Slic3r::Z.

+ Here is the call graph for this function:

Member Function Documentation

◆ get()

template<size_t N>
Vec3d Slic3r::sla::PointRing< N >::get ( size_t  idx,
const Vec3d src,
double  r 
) const
inline
72 {
73 if (idx == 0)
74 return src;
75
76 double phi = m_phis[idx - 1];
77 double sinphi = std::sin(phi);
78 double cosphi = std::cos(phi);
79
80 double rpscos = r * cosphi;
81 double rpssin = r * sinphi;
82
83 // Point on the sphere
84 return {src(X) + rpscos * a(X) + rpssin * b(X),
85 src(Y) + rpscos * a(Y) + rpssin * b(Y),
86 src(Z) + rpscos * a(Z) + rpssin * b(Z)};
87 }

References Slic3r::sla::PointRing< N >::a, Slic3r::sla::PointRing< N >::b, Slic3r::sla::PointRing< N >::m_phis, Slic3r::X, Slic3r::Y, and Slic3r::Z.

Referenced by Slic3r::sla::pinhead_mesh_hit().

+ Here is the caller graph for this function:

◆ is_one()

template<size_t N>
static bool constexpr Slic3r::sla::PointRing< N >::is_one ( double  val)
inlinestaticconstexprprivate
46 {
47 constexpr double eps = 1e-20;
48
49 return std::abs(std::abs(val) - 1) < eps;
50 }

Referenced by Slic3r::sla::PointRing< N >::PointRing().

+ Here is the caller graph for this function:

Member Data Documentation

◆ a

template<size_t N>
Vec3d Slic3r::sla::PointRing< N >::a = {0, 1, 0}
private

◆ b

◆ m_phis

template<size_t N>
std::array<double, N - 1> Slic3r::sla::PointRing< N >::m_phis
private

◆ m_radius

template<size_t N>
double Slic3r::sla::PointRing< N >::m_radius = 0.
private

The documentation for this class was generated from the following file: