OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::sla::PointRing< N > Class Template Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/SLA/SupportTreeBuildsteps.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 > 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
97 {
98 m_phis = linspace_array<N>(0., 2 * PI);
99
100 // We have to address the case when the direction vector v (same as
101 // dir) is coincident with one of the world axes. In this case two of
102 // its components will be completely zero and one is 1.0. Our method
103 // becomes dangerous here due to division with zero. Instead, vector
104 // 'a' can be an element-wise rotated version of 'v'
105 if(is_one(n(X)) || is_one(n(Y)) || is_one(n(Z))) {
106 a = {n(Z), n(X), n(Y)};
107 b = {n(Y), n(Z), n(X)};
108 }
109 else {
110 a(Z) = -(n(Y)*a(Y)) / n(Z); a.normalize();
111 b = a.cross(n);
112 }
113 }
Definition SupportTreeBuildsteps.hpp:77
static bool constexpr is_one(double val)
Definition SupportTreeBuildsteps.hpp:89
std::array< double, N > m_phis
Definition SupportTreeBuildsteps.hpp:78
Vec3d b
Definition SupportTreeBuildsteps.hpp:86
Vec3d a
Definition SupportTreeBuildsteps.hpp:86
std::array< ArithmeticOnly< T >, N > linspace_array(const T &start, const T &stop)
Definition MTUtils.hpp:109

References a, b, is_one(), Slic3r::linspace_array(), m_phis, PI, Slic3r::sla::X, Slic3r::sla::Y, and Slic3r::sla::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
116 {
117 double phi = m_phis[idx];
118 double sinphi = std::sin(phi);
119 double cosphi = std::cos(phi);
120
121 double rpscos = r * cosphi;
122 double rpssin = r * sinphi;
123
124 // Point on the sphere
125 return {src(X) + rpscos * a(X) + rpssin * b(X),
126 src(Y) + rpscos * a(Y) + rpssin * b(Y),
127 src(Z) + rpscos * a(Z) + rpssin * b(Z)};
128 }

References a, b, m_phis, Slic3r::sla::X, Slic3r::sla::Y, and Slic3r::sla::Z.

Referenced by Slic3r::sla::SupportTreeBuildsteps::pinhead_mesh_intersect().

Here is the caller graph for this function:

◆ is_one()

template<size_t N>
bool constexpr Slic3r::sla::PointRing< N >::is_one ( double val)
inlinestaticconstexprprivate
90 {
91 return std::abs(std::abs(val) - 1) < 1e-20;
92 }

Referenced by 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
86{0, 1, 0}, b;

Referenced by PointRing(), and get().

◆ b

template<size_t N>
Vec3d Slic3r::sla::PointRing< N >::b
private

Referenced by PointRing(), and get().

◆ m_phis

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

Referenced by PointRing(), and get().

◆ 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: