OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
boost::polygon::voronoi_visual_utils< CT > Class Template Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Geometry/VoronoiVisualUtils.hpp>

Static Public Member Functions

template<class InCT1, class InCT2, template< class > class Point, template< class > class Segment>
static enable_if< typenamegtl_and< typenamegtl_if< typenameis_point_concept< typenamegeometry_concept< Point< InCT1 > >::type >::type >::type, typenamegtl_if< typenameis_segment_concept< typenamegeometry_concept< Segment< InCT2 > >::type >::type >::type >::type, void >::type discretize (const Point< InCT1 > &point, const Segment< InCT2 > &segment, const CT max_dist, std::vector< Point< CT > > *discretization)

Static Private Member Functions

static CT parabola_y (CT x, CT a, CT b)
template<class InCT, template< class > class Point, template< class > class Segment>
static enable_if< typenamegtl_and< typenamegtl_if< typenameis_point_concept< typenamegeometry_concept< Point< int > >::type >::type >::type, typenamegtl_if< typenameis_segment_concept< typenamegeometry_concept< Segment< long > >::type >::type >::type >::type, CT >::type get_point_projection (const Point< CT > &point, const Segment< InCT > &segment)
template<typename InCT>
static CT cast (const InCT &value)

Detailed Description

template<typename CT>
class boost::polygon::voronoi_visual_utils< CT >

Member Function Documentation

◆ cast()

template<typename CT>
template<typename InCT>
CT boost::polygon::voronoi_visual_utils< CT >::cast ( const InCT & value)
inlinestaticprivate
193 {
194 return static_cast<CT>(value);
195 }
Definition VoronoiVisualUtils.hpp:35

Referenced by discretize(), and get_point_projection().

Here is the caller graph for this function:

◆ discretize()

template<typename CT>
template<class InCT1, class InCT2, template< class > class Point, template< class > class Segment>
enable_if< typenamegtl_and< typenamegtl_if< typenameis_point_concept< typenamegeometry_concept< Point< InCT1 > >::type >::type >::type, typenamegtl_if< typenameis_segment_concept< typenamegeometry_concept< Segment< InCT2 > >::type >::type >::type >::type, void >::type boost::polygon::voronoi_visual_utils< CT >::discretize ( const Point< InCT1 > & point,
const Segment< InCT2 > & segment,
const CT max_dist,
std::vector< Point< CT > > * discretization )
inlinestatic
76 {
77 // Apply the linear transformation to move start point of the segment to
78 // the point with coordinates (0, 0) and the direction of the segment to
79 // coincide the positive direction of the x-axis.
83
84 // Compute x-coordinates of the endpoints of the edge
85 // in the transformed space.
91
92 // Compute parabola parameters in the transformed space.
93 // Parabola has next representation:
94 // f(x) = ((x-rot_x)^2 + rot_y^2) / (2.0*rot_y).
99
100 // Save the last point.
101 Point<CT> last_point = (*discretization)[1];
102 discretization->pop_back();
103
104 // Use stack to avoid recursion.
109
110 // Adjust max_dist parameter in the transformed space.
112 while (!point_stack.empty()) {
113 CT new_x = point_stack.top();
115
116 // Compute coordinates of the point of the parabola that is
117 // furthest from the current line segment.
118 CT mid_x = (new_y - cur_y) / (new_x - cur_x) * rot_y + rot_x;
120 assert(mid_x != cur_x || mid_y != cur_y);
121 assert(mid_x != new_x || mid_y != new_y);
122
123 // Compute maximum distance between the given parabolic arc
124 // and line segment that discretize it.
125 CT dist = (new_y - cur_y) * (mid_x - cur_x) -
126 (new_x - cur_x) * (mid_y - cur_y);
127 CT div = (new_y - cur_y) * (new_y - cur_y) + (new_x - cur_x) * (new_x - cur_x);
128 assert(div != 0);
129 dist = dist * dist / div;
130 if (dist <= max_dist_transformed) {
131 // Distance between parabola and line segment is less than max_dist.
132 point_stack.pop();
138 cur_x = new_x;
139 cur_y = new_y;
140 } else {
141 point_stack.push(mid_x);
142 }
143 }
144
145 // Update last point.
146 discretization->back() = last_point;
147 }
static enable_if< typenamegtl_and< typenamegtl_if< typenameis_point_concept< typenamegeometry_concept< Point< int > >::type >::type >::type, typenamegtl_if< typenameis_segment_concept< typenamegeometry_concept< Segment< long > >::type >::type >::type >::type, CT >::type get_point_projection(const Point< CT > &point, const Segment< InCT > &segment)
Definition VoronoiVisualUtils.hpp:180
static CT parabola_y(CT x, CT a, CT b)
Definition VoronoiVisualUtils.hpp:151
static CT cast(const InCT &value)
Definition VoronoiVisualUtils.hpp:193

References cast(), get_point_projection(), and parabola_y().

Referenced by Slic3r::Voronoi::Internal::sample_curved_edge().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_point_projection()

template<typename CT>
template<class InCT, template< class > class Point, template< class > class Segment>
enable_if< typenamegtl_and< typenamegtl_if< typenameis_point_concept< typenamegeometry_concept< Point< int > >::type >::type >::type, typenamegtl_if< typenameis_segment_concept< typenamegeometry_concept< Segment< long > >::type >::type >::type >::type, CT >::type boost::polygon::voronoi_visual_utils< CT >::get_point_projection ( const Point< CT > & point,
const Segment< InCT > & segment )
inlinestaticprivate

References cast().

Referenced by discretize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parabola_y()

template<typename CT>
CT boost::polygon::voronoi_visual_utils< CT >::parabola_y ( CT x,
CT a,
CT b )
inlinestaticprivate
151 {
152 return ((x - a) * (x - a) + b * b) / (b + b);
153 }

Referenced by discretize().

Here is the caller graph for this function:

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