Skip to content

Commit 7a5c94e

Browse files
committed
Clean code and add documentation
CURA-12743
1 parent 424a2f4 commit 7a5c94e

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

include/project.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ class Vector3F;
1515

1616
using Polygon = std::vector<Point2F>;
1717

18+
/**
19+
* \brief Projects a 2D stroke polygon onto a 3D mesh and returns the resulting 2D polygons in UV space.
20+
* \param stroke_polygon The 2D stroke polygon to project.
21+
* \param mesh_vertices The coordinates of the 3D vertices of the mesh.
22+
* \param mesh_indices The mesh faces as indices into the vertex array, which may be empty of the mesh doesn't have indices.
23+
* \param mesh_uv The UV coordinates for each mesh vertex.
24+
* \param mesh_faces_connectivity For each face of the mesh, contains the 3 indices of the adjacent faces, or -1 is edge is not connected.
25+
* \param texture_width The width of the texture in pixels.
26+
* \param texture_height The height of the texture in pixels.
27+
* \param camera_projection_matrix The camera projection matrix.
28+
* \param is_camera_perspective True if the camera uses perspective projection, false for orthographic.
29+
* \param viewport_width The width of the viewport in pixels.
30+
* \param viewport_height The height of the viewport in pixels.
31+
* \param camera_normal The normal vector of the camera.
32+
* \param face_id The ID of the initial face to project onto, other will be propagated using connectivity information.
33+
* \return A vector of polygons in UV space resulting from the projection.
34+
*/
1835
std::vector<Polygon> project(
1936
const std::span<Point2F>& stroke_polygon,
2037
const std::span<Point3F>& mesh_vertices,

src/project.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ std::vector<Polygon> toPolygons(const ClipperLib::Paths& paths)
162162
result_polygon.emplace_back(point.X / CLIPPER_PRECISION, point.Y / CLIPPER_PRECISION);
163163
}
164164

165-
result.emplace_back(std::move(result_polygon));
165+
result.push_back(std::move(result_polygon));
166166
}
167167

168168
return result;
@@ -195,10 +195,6 @@ std::vector<Polygon> project(
195195
const uint32_t candidate_face_id = *iterator;
196196
candidate_faces.erase(iterator);
197197

198-
// if (processed_faces.contains(candidate_face_id))
199-
// {
200-
// continue;
201-
// }
202198
processed_faces.insert(candidate_face_id);
203199

204200
const Face face = getFace(mesh_indices, candidate_face_id);

0 commit comments

Comments
 (0)