Prusa Slicer 2.6.0
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 CutMeshobject
 
const CutMeshshape
 
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
1103 :
1106 {}
VertexShapeMap vert_shape_map
Definition CutSurface.cpp:1116
const CutMesh & shape
Definition CutSurface.cpp:1109
bool * is_valid
Definition CutSurface.cpp:1119
const CutMesh & object
Definition CutSurface.cpp:1108
EdgeShapeMap edge_shape_map
Definition CutSurface.cpp:1112
FaceShapeMap face_shape_map
Definition CutSurface.cpp:1113

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).
1252{
1253 if (i_id >= intersections.size()) {
1254 size_t capacity = Slic3r::next_highest_power_of_2(i_id + 1);
1255 intersections.reserve(capacity);
1256 intersections.resize(capacity);
1257 }
1258
1259 const IntersectingElement *intersection_ptr = nullptr;
1260 if (&tm_e == &shape) {
1261 assert(&tm_f == &object);
1262 switch (sdim) {
1263 case 1:
1264 // edge x edge intersection
1265 intersection_ptr = &edge_shape_map[shape.edge(h_e)];
1266 break;
1267 case 2:
1268 // edge x face intersection
1269 intersection_ptr = &face_shape_map[shape.face(h_e)];
1270 break;
1271 default: assert(false);
1272 }
1273 if (is_target_coplanar)
1274 vert_shape_map[object.source(h_f)] = intersection_ptr;
1275 if (is_source_coplanar)
1276 vert_shape_map[object.target(h_f)] = intersection_ptr;
1277 } else {
1278 assert(&tm_f == &shape && &tm_e == &object);
1279 assert(!is_target_coplanar);
1280 assert(!is_source_coplanar);
1281 if (is_target_coplanar || is_source_coplanar)
1282 *is_valid = false;
1283 intersection_ptr = &edge_shape_map[shape.edge(h_f)];
1284 if (sdim == 0) vert_shape_map[object.target(h_e)] = intersection_ptr;
1285 }
1286
1287 if (intersection_ptr->shape_point_index == std::numeric_limits<uint32_t>::max()) {
1288 // there is unexpected intersection
1289 // Top (or Bottom) shape contour edge (or vertex) intersection
1290 // Suggest to change projection min/max limits
1291 *is_valid = false;
1292 }
1293 intersections[i_id] = intersection_ptr;
1294}
uint16_t next_highest_power_of_2(uint16_t v)
Definition Utils.hpp:125
std::vector< const IntersectingElement * > intersections
Definition CutSurface.cpp:1123

References priv::is_valid(), Slic3r::next_highest_power_of_2(), and priv::IntersectingElement::shape_point_index.

+ 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
1297{
1298 assert(&tm == &object);
1299 assert(i_id < intersections.size());
1300 const IntersectingElement *intersection_ptr = intersections[i_id];
1301 assert(intersection_ptr != nullptr);
1302 // intersection was not filled in function intersection_point_detected
1303 //assert(intersection_ptr->point_index != std::numeric_limits<uint32_t>::max());
1304 vert_shape_map[v] = intersection_ptr;
1305}

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

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