OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
priv::Visitor Struct Reference

Track source of intersection Help for anotate inner and outer faces. More...

Inheritance diagram for priv::Visitor:
Collaboration diagram for priv::Visitor:

Public Member Functions

 Visitor (const CutMesh &object, const CutMesh &shape, EdgeShapeMap edge_shape_map, FaceShapeMap face_shape_map, VertexShapeMap vert_shape_map, bool *is_valid)
void intersection_point_detected (std::size_t i_id, int sdim, HI h_f, HI h_e, const CutMesh &tm_f, const CutMesh &tm_e, bool is_target_coplanar, bool is_source_coplanar)
 Called when a new intersection point is detected. The intersection is detected using a face of tm_f and an edge of tm_e. Intersecting an edge hh_edge from tm_f with a face h_e of tm_e. https://doc.cgal.org/latest/Polygon_mesh_processing/classPMPCorefinementVisitor.html#a00ee0ca85db535a48726a92414acda7f.
void new_vertex_added (std::size_t i_id, VI v, const CutMesh &tm)
 Called when a new vertex is added in tm (either an edge split or a vertex inserted in the interior of a face). Fill vertex_shape_map by intersections.

Public Attributes

const CutMesh & object
const CutMesh & shape
EdgeShapeMap edge_shape_map
FaceShapeMap face_shape_map
VertexShapeMap vert_shape_map
bool * is_valid
std::vector< const IntersectingElement * > intersections

Detailed Description

Track source of intersection Help for anotate inner and outer faces.

Constructor & Destructor Documentation

◆ Visitor()

priv::Visitor::Visitor ( const CutMesh & object,
const CutMesh & shape,
EdgeShapeMap edge_shape_map,
FaceShapeMap face_shape_map,
VertexShapeMap vert_shape_map,
bool * is_valid )
inline
1141 :
1144 {}
VertexShapeMap vert_shape_map
Definition CutSurface.cpp:1154
const CutMesh & shape
Definition CutSurface.cpp:1147
bool * is_valid
Definition CutSurface.cpp:1157
const CutMesh & object
Definition CutSurface.cpp:1146
EdgeShapeMap edge_shape_map
Definition CutSurface.cpp:1150
FaceShapeMap face_shape_map
Definition CutSurface.cpp:1151

References edge_shape_map, face_shape_map, is_valid, object, shape, and vert_shape_map.

Member Function Documentation

◆ intersection_point_detected()

void priv::Visitor::intersection_point_detected ( std::size_t i_id,
int sdim,
HI h_f,
HI h_e,
const CutMesh & tm_f,
const CutMesh & tm_e,
bool is_target_coplanar,
bool is_source_coplanar )

Called when a new intersection point is detected. The intersection is detected using a face of tm_f and an edge of tm_e. Intersecting an edge hh_edge from tm_f with a face h_e of tm_e. https://doc.cgal.org/latest/Polygon_mesh_processing/classPMPCorefinementVisitor.html#a00ee0ca85db535a48726a92414acda7f.

Parameters
i_idThe id of the intersection point, starting at 0. Ids are consecutive.
sdimDimension of a simplex part of face(h_e) that is intersected by edge(h_f): 0 for vertex: target(h_e) 1 for edge: h_e 2 for the interior of face: face(h_e)
h_fA halfedge from tm_f indicating the simplex intersected: if sdim==0 the target of h_f is the intersection point, if sdim==1 the edge of h_f contains the intersection point in its interior, if sdim==2 the face of h_f contains the intersection point in its interior. @Vojta: Edge of tm_f, see is_target_coplanar & is_source_coplanar whether any vertex of h_f is coplanar with face(h_e).
h_eA halfedge from tm_e @Vojta: Vertex, halfedge or face of tm_e intersected by h_f, see comment at sdim.
tm_fMesh containing h_f
tm_eMesh containing h_e
is_target_coplanarTrue if the target of h_e is the intersection point @Vojta: source(h_f) is coplanar with face(made by h_e).
is_source_coplanarTrue if the source of h_e is the intersection point @Vojta: target(h_f) is coplanar with face(h_e).
1290{
1291 if (i_id >= intersections.size()) {
1292 size_t capacity = Slic3r::next_highest_power_of_2(i_id + 1);
1293 intersections.reserve(capacity);
1294 intersections.resize(capacity);
1295 }
1296
1297 const IntersectingElement *intersection_ptr = nullptr;
1298 if (&tm_e == &shape) {
1299 assert(&tm_f == &object);
1300 switch (sdim) {
1301 case 1:
1302 // edge x edge intersection
1303 intersection_ptr = &edge_shape_map[shape.edge(h_e)];
1304 break;
1305 case 2:
1306 // edge x face intersection
1307 intersection_ptr = &face_shape_map[shape.face(h_e)];
1308 break;
1309 default: assert(false);
1310 }
1311 if (is_target_coplanar)
1312 vert_shape_map[object.source(h_f)] = intersection_ptr;
1313 if (is_source_coplanar)
1314 vert_shape_map[object.target(h_f)] = intersection_ptr;
1315 } else {
1316 assert(&tm_f == &shape && &tm_e == &object);
1317 assert(!is_target_coplanar);
1318 assert(!is_source_coplanar);
1319 if (is_target_coplanar || is_source_coplanar)
1320 *is_valid = false;
1321 intersection_ptr = &edge_shape_map[shape.edge(h_f)];
1322 if (sdim == 0) vert_shape_map[object.target(h_e)] = intersection_ptr;
1323 }
1324
1325 if (intersection_ptr->shape_point_index == std::numeric_limits<uint32_t>::max()) {
1326 // there is unexpected intersection
1327 // Top (or Bottom) shape contour edge (or vertex) intersection
1328 // Suggest to change projection min/max limits
1329 *is_valid = false;
1330 }
1331 intersections[i_id] = intersection_ptr;
1332}
uint16_t next_highest_power_of_2(uint16_t v)
Definition Utils.hpp:376
std::vector< const IntersectingElement * > intersections
Definition CutSurface.cpp:1161

References edge_shape_map, face_shape_map, intersections, is_valid, Slic3r::next_highest_power_of_2(), shape, priv::IntersectingElement::shape_point_index, and vert_shape_map.

Here is the call graph for this function:

◆ new_vertex_added()

void priv::Visitor::new_vertex_added ( std::size_t i_id,
VI v,
const CutMesh & tm )

Called when a new vertex is added in tm (either an edge split or a vertex inserted in the interior of a face). Fill vertex_shape_map by intersections.

Parameters
i_idOrder number of intersection point
vNew added vertex
tmAffected mesh
1335{
1336 assert(&tm == &object);
1337 assert(i_id < intersections.size());
1338 const IntersectingElement *intersection_ptr = intersections[i_id];
1339 assert(intersection_ptr != nullptr);
1340 // intersection was not filled in function intersection_point_detected
1341 //assert(intersection_ptr->point_index != std::numeric_limits<uint32_t>::max());
1342 vert_shape_map[v] = intersection_ptr;
1343}

References intersections, and vert_shape_map.

Member Data Documentation

◆ edge_shape_map

EdgeShapeMap priv::Visitor::edge_shape_map

◆ face_shape_map

FaceShapeMap priv::Visitor::face_shape_map

◆ intersections

std::vector<const IntersectingElement*> priv::Visitor::intersections

◆ is_valid

bool* priv::Visitor::is_valid

◆ object

const CutMesh& priv::Visitor::object

Referenced by Visitor().

◆ shape

const CutMesh& priv::Visitor::shape

◆ vert_shape_map

VertexShapeMap priv::Visitor::vert_shape_map

The documentation for this struct was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/CutSurface.cpp