OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::Linef3 Class Reference

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

Public Types

using Scalar = Vec3d::Scalar

Public Member Functions

 Linef3 ()
 Linef3 (const Vec3d &_a, const Vec3d &_b)
 Linef3 (const Vec2d &_a, const Vec2d &_b, double z)
Vec3d intersect_plane (double z) const
void scale (double factor)
Vec3d vector () const
Vec3d unit_vector () const
double length () const
double distance_to_infinite_squared (const Vec3d &point, Vec3d *closest_point) const
double distance_to_infinite_squared (const Vec3d &point) const

Static Public Member Functions

static double distance_to_infinite_squared (const Vec3d &point, const Vec3d &a, const Vec3d &b)

Public Attributes

Vec3d a
Vec3d b

Static Public Attributes

static const constexpr int Dim = 3

Detailed Description

Member Typedef Documentation

◆ Scalar

using Slic3r::Linef3::Scalar = Vec3d::Scalar

Constructor & Destructor Documentation

◆ Linef3() [1/3]

Slic3r::Linef3::Linef3 ( )
inline
275: a(Vec3d::Zero()), b(Vec3d::Zero()) {}
Vec3d b
Definition Line.hpp:312
Vec3d a
Definition Line.hpp:311

References a, and b.

Referenced by distance_to_infinite_squared().

Here is the caller graph for this function:

◆ Linef3() [2/3]

Slic3r::Linef3::Linef3 ( const Vec3d & _a,
const Vec3d & _b )
inline
276: a(_a), b(_b) {}

References a, and b.

◆ Linef3() [3/3]

Slic3r::Linef3::Linef3 ( const Vec2d & _a,
const Vec2d & _b,
double z )
inline
277: a(Vec3d(_a.x(), _a.y(), z)), b(Vec3d(_b.x(), _b.y(), z)) {}
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68

References a, and b.

Member Function Documentation

◆ distance_to_infinite_squared() [1/3]

double Slic3r::Linef3::distance_to_infinite_squared ( const Vec3d & point) const
inline
301 {
302 Vec3d nearest_point;
303 return distance_to_infinite_squared(point, &nearest_point);
304 }
double distance_to_infinite_squared(const Vec3d &point, Vec3d *closest_point) const
Definition Line.hpp:285

References distance_to_infinite_squared().

Here is the call graph for this function:

◆ distance_to_infinite_squared() [2/3]

double Slic3r::Linef3::distance_to_infinite_squared ( const Vec3d & point,
const Vec3d & a,
const Vec3d & b )
inlinestatic
306 {
307 Linef3 line{a, b};
308 return line.distance_to_infinite_squared(point);
309 }
Linef3()
Definition Line.hpp:275

References Linef3(), a, b, and distance_to_infinite_squared().

Here is the call graph for this function:

◆ distance_to_infinite_squared() [3/3]

double Slic3r::Linef3::distance_to_infinite_squared ( const Vec3d & point,
Vec3d * closest_point ) const
inline
285 {
286 const Vec3d v = this->b - this->a;
287 const Vec3d va = point - this->a;
288 const double l2 = v.squaredNorm();
289 if (l2 == 0.) {
290 // a == b case
291 *closest_point = this->a;
292 return va.squaredNorm();
293 }
294 // Consider the line extending the segment, parameterized as a + t (b - a).
295 // Find parameter value t of the projection of point onto the line.
296 const double t = va.dot(v) / l2;
297 *closest_point = this->a + t * v;
298 return (point - *closest_point).squaredNorm();
299 }
T l2(const boost::geometry::model::d2::point_xy< T > &v)
Definition ExtrusionSimulator.cpp:177

References a, b, and Slic3r::l2().

Referenced by Slic3r::contour_extrusion_path(), distance_to_infinite_squared(), and distance_to_infinite_squared().

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

◆ intersect_plane()

Vec3d Slic3r::Linef3::intersect_plane ( double z) const
134{
135 Vec3d v = (this->b - this->a).cast<double>();
136 double t = (z - this->a(2)) / v(2);
137 return Vec3d(this->a(0) + v(0) * t, this->a(1) + v(1) * t, z);
138}
auto cast(const BoundingBoxBase< Tin > &b)
Definition BoundingBox.hpp:299

References a, b, and Slic3r::cast().

Referenced by Slic3r::SeamPlacerImpl::PaintedContour::crossings(), Slic3r::GUI::GLGizmoCut3D::mouse_position_in_local_plane(), Slic3r::GUI::GLGizmoRotate::mouse_position_in_local_plane(), and Slic3r::GUI::GLCanvas3D::on_mouse().

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

◆ length()

double Slic3r::Linef3::length ( ) const
inline
283{ return vector().norm(); }
Vec3d vector() const
Definition Line.hpp:281

References vector().

Referenced by unit_vector().

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

◆ scale()

void Slic3r::Linef3::scale ( double factor)
inline
280{ this->a *= factor; this->b *= factor; }

References a, and b.

◆ unit_vector()

Vec3d Slic3r::Linef3::unit_vector ( ) const
inline
282{ return (length() == 0.0) ? Vec3d::Zero() : vector().normalized(); }
double length() const
Definition Line.hpp:283

References length(), and vector().

Referenced by Slic3r::GUI::GLGizmoMove3D::calc_projection(), Slic3r::GUI::GLGizmoScale3D::calc_ratio(), Slic3r::GUI::GLGizmoCut3D::dragging_grabber_move(), and Slic3r::GUI::GLCanvas3D::on_mouse().

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

◆ vector()

Vec3d Slic3r::Linef3::vector ( ) const
inline
281{ return this->b - this->a; }

References a, and b.

Referenced by length(), Slic3r::GUI::GLGizmoRotate::mouse_position_in_local_plane(), Slic3r::GUI::DesignSketchTool::on_mouse_impl(), Slic3r::GUI::ray_axis_proj(), Slic3r::GUI::DesignSketchTool::screen_to_plane(), Slic3r::GUI::DesignSketchTool::screen_tol(), Slic3r::GUI::DesignSketchTool::select_at_screen(), and unit_vector().

Here is the caller graph for this function:

Member Data Documentation

◆ a

Vec3d Slic3r::Linef3::a

Referenced by Linef3(), Linef3(), Linef3(), Slic3r::GUI::GLCanvas3D::_picking_pass_imex_ghosts(), Slic3r::GUI::DesignSketchTool::arc_mouse_angle(), Slic3r::GUI::GLGizmoMove3D::calc_projection(), Slic3r::GUI::GLGizmoScale3D::calc_ratio(), Slic3r::SeamPlacerImpl::PaintedContour::crossings(), distance_to_infinite_squared(), distance_to_infinite_squared(), Slic3r::GUI::DesignSketchTool::drag_datum_handle(), Slic3r::GUI::DesignSketchTool::drag_draft_arc(), Slic3r::GUI::DesignSketchTool::drag_extrude_arrow(), Slic3r::GUI::DesignSketchTool::drag_helix_handle(), Slic3r::GUI::DesignSketchTool::drag_hole_handle(), Slic3r::GUI::DesignSketchTool::drag_pattern_handle(), Slic3r::GUI::DesignSketchTool::drag_revolve_arc(), Slic3r::GUI::DesignSketchTool::drag_rib_handle(), Slic3r::GUI::DesignSketchTool::drag_thread_handle(), Slic3r::GUI::GLGizmoCut3D::dragging_grabber_move(), Slic3r::GUI::DesignSketchTool::fillet_axis_proj(), Slic3r::GUI::DesignSketchTool::hit_test_base_pick(), Slic3r::GUI::DesignSketchTool::hit_test_cut_arrow(), Slic3r::GUI::DesignSketchTool::hit_test_datum_handle(), Slic3r::GUI::DesignSketchTool::hit_test_draft_handle(), Slic3r::GUI::DesignSketchTool::hit_test_extrude_arrow(), Slic3r::GUI::DesignSketchTool::hit_test_fillet_arrow(), Slic3r::GUI::DesignSketchTool::hit_test_helix_handle(), Slic3r::GUI::DesignSketchTool::hit_test_hole_handle(), Slic3r::GUI::DesignSketchTool::hit_test_move_arc(), Slic3r::GUI::DesignSketchTool::hit_test_move_arrow(), Slic3r::GUI::DesignSketchTool::hit_test_pattern_handle(), Slic3r::GUI::DesignSketchTool::hit_test_revolve_handle(), Slic3r::GUI::DesignSketchTool::hit_test_rib_handle(), Slic3r::GUI::DesignSketchTool::hit_test_shell_arrow(), Slic3r::GUI::DesignSketchTool::hit_test_thread_handle(), intersect_plane(), Slic3r::GUI::GLGizmoRotate::mouse_position_in_local_plane(), Slic3r::GUI::GLCanvas3D::on_mouse(), Slic3r::GUI::DesignSketchTool::on_mouse_impl(), Slic3r::GUI::ray_axis_proj(), Slic3r::GUI::DesignSketchTool::resolve_solid_pick(), scale(), Slic3r::GUI::DesignSketchTool::screen_to_plane(), Slic3r::GUI::DesignSketchTool::screen_tol(), Slic3r::GUI::DesignSketchTool::select_at_screen(), Slic3r::GUI::DesignSketchTool::start_hole_drag(), Slic3r::GUI::DesignSketchTool::start_thread_drag(), Slic3r::transform(), and vector().

◆ b

Vec3d Slic3r::Linef3::b

Referenced by Linef3(), Linef3(), Linef3(), Slic3r::GUI::GLCanvas3D::_picking_pass_imex_ghosts(), Slic3r::GUI::DesignSketchTool::arc_mouse_angle(), Slic3r::SeamPlacerImpl::PaintedContour::crossings(), distance_to_infinite_squared(), distance_to_infinite_squared(), Slic3r::GUI::DesignSketchTool::drag_datum_handle(), Slic3r::GUI::DesignSketchTool::drag_draft_arc(), Slic3r::GUI::DesignSketchTool::drag_extrude_arrow(), Slic3r::GUI::DesignSketchTool::drag_helix_handle(), Slic3r::GUI::DesignSketchTool::drag_hole_handle(), Slic3r::GUI::DesignSketchTool::drag_pattern_handle(), Slic3r::GUI::DesignSketchTool::drag_revolve_arc(), Slic3r::GUI::DesignSketchTool::drag_rib_handle(), Slic3r::GUI::DesignSketchTool::drag_thread_handle(), Slic3r::GUI::DesignSketchTool::fillet_axis_proj(), Slic3r::GUI::DesignSketchTool::hit_test_base_pick(), Slic3r::GUI::DesignSketchTool::hit_test_cut_arrow(), Slic3r::GUI::DesignSketchTool::hit_test_datum_handle(), Slic3r::GUI::DesignSketchTool::hit_test_draft_handle(), Slic3r::GUI::DesignSketchTool::hit_test_extrude_arrow(), Slic3r::GUI::DesignSketchTool::hit_test_fillet_arrow(), Slic3r::GUI::DesignSketchTool::hit_test_helix_handle(), Slic3r::GUI::DesignSketchTool::hit_test_hole_handle(), Slic3r::GUI::DesignSketchTool::hit_test_move_arc(), Slic3r::GUI::DesignSketchTool::hit_test_move_arrow(), Slic3r::GUI::DesignSketchTool::hit_test_pattern_handle(), Slic3r::GUI::DesignSketchTool::hit_test_revolve_handle(), Slic3r::GUI::DesignSketchTool::hit_test_rib_handle(), Slic3r::GUI::DesignSketchTool::hit_test_shell_arrow(), Slic3r::GUI::DesignSketchTool::hit_test_thread_handle(), intersect_plane(), Slic3r::GUI::GLGizmoRotate::mouse_position_in_local_plane(), Slic3r::GUI::DesignSketchTool::resolve_solid_pick(), scale(), Slic3r::GUI::DesignSketchTool::start_hole_drag(), Slic3r::GUI::DesignSketchTool::start_thread_drag(), Slic3r::transform(), and vector().

◆ Dim

const constexpr int Slic3r::Linef3::Dim = 3
staticconstexpr

The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Line.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Line.cpp