OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::TriangleSelector::Cursor Class Referenceabstract

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

Inheritance diagram for Slic3r::TriangleSelector::Cursor:
Collaboration diagram for Slic3r::TriangleSelector::Cursor:

Public Member Functions

 Cursor ()=delete
virtual ~Cursor ()=default
bool is_pointer_in_triangle (const Triangle &tr, const std::vector< Vertex > &vertices) const
virtual bool is_mesh_point_inside (const Vec3f &point) const =0
virtual bool is_pointer_in_triangle (const Vec3f &p1, const Vec3f &p2, const Vec3f &p3) const =0
virtual int vertices_inside (const Triangle &tr, const std::vector< Vertex > &vertices) const
virtual bool is_edge_inside_cursor (const Triangle &tr, const std::vector< Vertex > &vertices) const =0
virtual bool is_facet_visible (int facet_idx, const std::vector< Vec3f > &face_normals) const =0

Static Public Member Functions

static bool is_facet_visible (const Cursor &cursor, int facet_idx, const std::vector< Vec3f > &face_normals)

Protected Member Functions

 Cursor (const Vec3f &source_, float radius_world, const Transform3d &trafo_, const ClippingPlane &clipping_plane_)

Protected Attributes

Transform3f trafo
Vec3f source
bool uniform_scaling
Transform3f trafo_normal
float radius
float radius_sqr
Vec3f dir = Vec3f(0.f, 0.f, 0.f)
ClippingPlane clipping_plane
friend TriangleSelector

Detailed Description

Constructor & Destructor Documentation

◆ Cursor() [1/2]

Slic3r::TriangleSelector::Cursor::Cursor ( )
delete

Referenced by Slic3r::TriangleSelector::DoublePointCursor::DoublePointCursor(), Slic3r::TriangleSelector::SinglePointCursor::SinglePointCursor(), is_facet_visible(), and is_facet_visible().

Here is the caller graph for this function:

◆ ~Cursor()

virtual Slic3r::TriangleSelector::Cursor::~Cursor ( )
virtualdefault

◆ Cursor() [2/2]

Slic3r::TriangleSelector::Cursor::Cursor ( const Vec3f & source_,
float radius_world,
const Transform3d & trafo_,
const ClippingPlane & clipping_plane_ )
explicitprotected
2090 : source{source_}, trafo{trafo_.cast<float>()}, clipping_plane{clipping_plane_}
2091{
2092 Vec3d sf = Geometry::Transformation(trafo_).get_scaling_factor();
2093 if (is_approx(sf(0), sf(1)) && is_approx(sf(1), sf(2))) {
2094 radius = float(radius_world / sf(0));
2095 radius_sqr = float(Slic3r::sqr(radius_world / sf(0)));
2096 uniform_scaling = true;
2097 } else {
2098 // In case that the transformation is non-uniform, all checks whether
2099 // something is inside the cursor should be done in world coords.
2100 // First transform source in world coords and remember that we did this.
2101 source = trafo * source;
2102 uniform_scaling = false;
2103 radius = radius_world;
2104 radius_sqr = Slic3r::sqr(radius_world);
2105 trafo_normal = trafo.linear().inverse().transpose();
2106 }
2107}
Transform3f trafo
Definition TriangleSelector.hpp:121
Transform3f trafo_normal
Definition TriangleSelector.hpp:125
ClippingPlane clipping_plane
Definition TriangleSelector.hpp:130
bool uniform_scaling
Definition TriangleSelector.hpp:124
Vec3f source
Definition TriangleSelector.hpp:122
float radius
Definition TriangleSelector.hpp:126
float radius_sqr
Definition TriangleSelector.hpp:127
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68
constexpr bool is_approx(Number value, Number test_value, Number precision=EPSILON)
Definition libslic3r.h:320
constexpr T sqr(T x)
Definition libslic3r.h:301

References Slic3r::cast(), clipping_plane, Slic3r::Geometry::Transformation::get_scaling_factor(), Slic3r::is_approx(), radius, radius_sqr, source, Slic3r::sqr(), trafo, trafo_normal, and uniform_scaling.

Here is the call graph for this function:

Member Function Documentation

◆ is_edge_inside_cursor()

virtual bool Slic3r::TriangleSelector::Cursor::is_edge_inside_cursor ( const Triangle & tr,
const std::vector< Vertex > & vertices ) const
pure virtual

◆ is_facet_visible() [1/2]

bool Slic3r::TriangleSelector::Cursor::is_facet_visible ( const Cursor & cursor,
int facet_idx,
const std::vector< Vec3f > & face_normals )
static
1101{
1102 assert(facet_idx < int(face_normals.size()));
1103 Vec3f n = face_normals[facet_idx];
1104 if (!cursor.uniform_scaling)
1105 n = cursor.trafo_normal * n;
1106 return n.dot(cursor.dir) < 0.f;
1107}
Eigen::Matrix< float, 3, 1, Eigen::DontAlign > Vec3f
Definition Point.hpp:65

References Cursor(), dir, trafo_normal, and uniform_scaling.

Here is the call graph for this function:

◆ is_facet_visible() [2/2]

virtual bool Slic3r::TriangleSelector::Cursor::is_facet_visible ( int facet_idx,
const std::vector< Vec3f > & face_normals ) const
pure virtual

Implemented in Slic3r::TriangleCursor, Slic3r::TriangleSelector::Capsule2D, Slic3r::TriangleSelector::Capsule3D, Slic3r::TriangleSelector::Circle, Slic3r::TriangleSelector::HeightRange, and Slic3r::TriangleSelector::Sphere.

References Cursor().

Referenced by Slic3r::TriangleSelector::Capsule2D::is_facet_visible(), and Slic3r::TriangleSelector::Circle::is_facet_visible().

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

◆ is_mesh_point_inside()

virtual bool Slic3r::TriangleSelector::Cursor::is_mesh_point_inside ( const Vec3f & point) const
pure virtual

Implemented in Slic3r::TriangleCursor, Slic3r::TriangleSelector::Capsule2D, Slic3r::TriangleSelector::Capsule3D, Slic3r::TriangleSelector::Circle, Slic3r::TriangleSelector::HeightRange, and Slic3r::TriangleSelector::Sphere.

Referenced by vertices_inside().

Here is the caller graph for this function:

◆ is_pointer_in_triangle() [1/2]

bool Slic3r::TriangleSelector::Cursor::is_pointer_in_triangle ( const Triangle & tr,
const std::vector< Vertex > & vertices ) const
1092 {
1093 const Vec3f& p1 = vertices[tr.verts_idxs[0]].v;
1094 const Vec3f& p2 = vertices[tr.verts_idxs[1]].v;
1095 const Vec3f& p3 = vertices[tr.verts_idxs[2]].v;
1096 return this->is_pointer_in_triangle(p1, p2, p3);
1097}
bool is_pointer_in_triangle(const Triangle &tr, const std::vector< Vertex > &vertices) const
Definition TriangleSelector.cpp:1092

References is_pointer_in_triangle(), and Slic3r::TriangleSelector::Triangle::verts_idxs.

Referenced by is_pointer_in_triangle().

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

◆ is_pointer_in_triangle() [2/2]

virtual bool Slic3r::TriangleSelector::Cursor::is_pointer_in_triangle ( const Vec3f & p1,
const Vec3f & p2,
const Vec3f & p3 ) const
pure virtual

◆ vertices_inside()

int Slic3r::TriangleSelector::Cursor::vertices_inside ( const Triangle & tr,
const std::vector< Vertex > & vertices ) const
virtual
1111{
1112 int inside = 0;
1113 for (size_t i = 0; i < 3; ++i)
1114 if (this->is_mesh_point_inside(vertices[tr.verts_idxs[i]].v))
1115 ++inside;
1116
1117 return inside;
1118}
virtual bool is_mesh_point_inside(const Vec3f &point) const =0
bool inside(const Polygons &polygons, const Point &p)
Definition TreeNode.cpp:160

References is_mesh_point_inside(), and Slic3r::TriangleSelector::Triangle::verts_idxs.

Here is the call graph for this function:

Member Data Documentation

◆ clipping_plane

◆ dir

◆ radius

◆ radius_sqr

◆ source

◆ trafo

◆ trafo_normal

Transform3f Slic3r::TriangleSelector::Cursor::trafo_normal
protected

Referenced by Cursor(), and is_facet_visible().

◆ TriangleSelector

friend Slic3r::TriangleSelector::Cursor::TriangleSelector
protected

◆ uniform_scaling


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