Skip to content

Commit 8d82e31

Browse files
ADD cpp header declarations.
1 parent 1a197ac commit 8d82e31

File tree

10 files changed

+184
-12
lines changed

10 files changed

+184
-12
lines changed

docs/examples/example_geodistance_multiple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@
5050
# Highlight boundary vertices
5151
for vertex in boundary_vertices:
5252
point = Point(*mesh.vertex_attributes(vertex, "xyz"))
53-
viewer.scene.add(point, pointsize=20, pointcolor=Color.red())
53+
viewer.scene.add(point, pointsize=20, pointcolor=Color.black())
5454

5555
viewer.show()

src/boundaries.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,14 @@
22

33
#include "compas.hpp"
44
#include <igl/boundary_loop.h>
5-
#include <Eigen/StdVector>
5+
6+
/**
7+
* Compute all ordered boundary loops of a manifold triangle mesh.
8+
*
9+
* @param F The face matrix of the triangle mesh (n x 3).
10+
* @return A vector of vectors containing vertex indices for each boundary loop.
11+
*
12+
* @note The input mesh should be manifold for correct results.
13+
*/
14+
std::vector<std::vector<int>> trimesh_boundaries(
15+
const compas::RowMatrixXi& F);

src/curvature.hpp

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,39 @@
22

33
#include "compas.hpp"
44
#include <igl/gaussian_curvature.h>
5-
#include <igl/principal_curvature.h>
5+
#include <igl/principal_curvature.h>
6+
7+
namespace compas_libigl {
8+
9+
/**
10+
* Compute the discrete gaussian curvature of a triangle mesh.
11+
*
12+
* @param V The vertex matrix of the triangle mesh (n x 3).
13+
* @param F The face matrix of the triangle mesh (m x 3).
14+
* @return A vector of gaussian curvature values per vertex.
15+
*/
16+
Eigen::VectorXd trimesh_gaussian_curvature(
17+
compas::RowMatrixXd V,
18+
compas::RowMatrixXi F
19+
);
20+
21+
/**
22+
* Compute the principal curvatures and directions of a triangle mesh.
23+
*
24+
* @param V The vertex matrix of the triangle mesh (n x 3).
25+
* @param F The face matrix of the triangle mesh (m x 3).
26+
* @param[out] PD1 Principal direction 1 per vertex (normalized vectors).
27+
* @param[out] PD2 Principal direction 2 per vertex (normalized vectors).
28+
* @param[out] PV1 Principal curvature value 1 per vertex (maximum curvature).
29+
* @param[out] PV2 Principal curvature value 2 per vertex (minimum curvature).
30+
*/
31+
void trimesh_principal_curvature(
32+
compas::RowMatrixXd V,
33+
compas::RowMatrixXi F,
34+
Eigen::MatrixXd& PD1,
35+
Eigen::MatrixXd& PD2,
36+
Eigen::VectorXd& PV1,
37+
Eigen::VectorXd& PV2
38+
);
39+
40+
} // namespace compas_libigl

src/geodistance.hpp

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,36 @@
33
#include "compas.hpp"
44
#include <igl/avg_edge_length.h>
55
#include <igl/exact_geodesic.h>
6-
#include <igl/heat_geodesics.h>
6+
#include <igl/heat_geodesics.h>
7+
8+
/**
9+
* Compute geodesic distance from a source vertex to all other vertices.
10+
*
11+
* @param V The vertex matrix of the triangle mesh (n x 3).
12+
* @param F The face matrix of the triangle mesh (m x 3).
13+
* @param source Index of the source vertex.
14+
* @param method Method to use: "exact" or "heat".
15+
* @return Vector of geodesic distances from source to all vertices.
16+
*/
17+
Eigen::VectorXd trimesh_geodistance(
18+
compas::RowMatrixXd V,
19+
compas::RowMatrixXi F,
20+
int source,
21+
const std::string& method
22+
);
23+
24+
/**
25+
* Compute geodesic distance from multiple source vertices.
26+
*
27+
* @param V The vertex matrix of the triangle mesh (n x 3).
28+
* @param F The face matrix of the triangle mesh (m x 3).
29+
* @param sources Vector of source vertex indices.
30+
* @param method Method to use: "exact" or "heat".
31+
* @return Vector of minimum geodesic distances from any source to all vertices.
32+
*/
33+
Eigen::VectorXd trimesh_geodistance_multiple(
34+
compas::RowMatrixXd V,
35+
compas::RowMatrixXi F,
36+
Eigen::VectorXi sources,
37+
const std::string& method
38+
);

src/intersections.hpp

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
#pragma once
22

33
#include "compas.hpp"
4-
#include <igl/Hit.h>
54
#include <igl/ray_mesh_intersect.h>
6-
#include <igl/readOFF.h>
5+
#include <igl/Hit.h>
6+
#include <Eigen/Core>
7+
8+
/**
9+
* Compute intersection between a single ray and a mesh.
10+
*
11+
* @param point Origin point of the ray
12+
* @param direction Direction vector of the ray
13+
* @param V #V x 3 matrix of vertex coordinates
14+
* @param F #F x 3 matrix of triangle indices
15+
* @return Vector of intersection hits, each containing (face_id, u, v, t) where:
16+
* - face_id: index of intersected face
17+
* - u, v: barycentric coordinates of hit point
18+
* - t: ray parameter at intersection
19+
*/
20+
std::vector<std::tuple<int, float, float, float>>
21+
intersection_ray_mesh(const Eigen::Vector3d& point, const Eigen::Vector3d& direction,
22+
const compas::RowMatrixXd& V, const compas::RowMatrixXi& F);
23+
24+
/**
25+
* Compute intersections between multiple rays and a mesh.
26+
*
27+
* @param points #R x 3 matrix of ray origin points
28+
* @param directions #R x 3 matrix of ray direction vectors
29+
* @param V #V x 3 matrix of vertex coordinates
30+
* @param F #F x 3 matrix of triangle indices
31+
* @return Vector of intersection hits per ray, each hit containing (face_id, u, v, t)
32+
*/
33+
std::vector<std::vector<std::tuple<int, float, float, float>>>
34+
intersection_rays_mesh(const compas::RowMatrixXd& points,
35+
const compas::RowMatrixXd& directions,
36+
const compas::RowMatrixXd& V,
37+
const compas::RowMatrixXi& F);

src/isolines.hpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,21 @@
22

33
#include "compas.hpp"
44
#include <igl/isolines.h>
5-
#include <Eigen/Core>
5+
#include <Eigen/Core>
6+
7+
/**
8+
* Compute isolines on a triangle mesh.
9+
*
10+
* @param V The vertex matrix of the triangle mesh (n x 3).
11+
* @param F The face matrix of the triangle mesh (m x 3).
12+
* @param isovalues The scalar values per vertex (n x 1).
13+
* @param vals The isovalues at which to compute isolines.
14+
* @return Tuple of (vertices, edges, indices) defining the isolines.
15+
*/
16+
std::tuple<compas::RowMatrixXd, compas::RowMatrixXi, compas::RowMatrixXi>
17+
trimesh_isolines(
18+
const compas::RowMatrixXd V,
19+
const compas::RowMatrixXi F,
20+
const Eigen::VectorXd isovalues,
21+
const Eigen::VectorXd vals
22+
);

src/massmatrix.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,16 @@
22

33
#include "compas.hpp"
44
#include <igl/massmatrix.h>
5-
#include <Eigen/Core>
5+
#include <Eigen/Core>
6+
7+
/**
8+
* Compute the mass matrix of a triangle mesh.
9+
*
10+
* @param V The vertex matrix of the triangle mesh (n x 3).
11+
* @param F The face matrix of the triangle mesh (m x 3).
12+
* @return Vector of mass values per vertex.
13+
*/
14+
Eigen::VectorXd trimesh_massmatrix(
15+
compas::RowMatrixXd V,
16+
compas::RowMatrixXi F
17+
);

src/meshing.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <igl/facet_components.h>
66
#include <Eigen/Sparse>
77

8-
// Function to remesh along a single isoline
98
std::tuple<
109
compas::RowMatrixXd,
1110
compas::RowMatrixXi,
@@ -16,7 +15,6 @@ trimesh_remesh_along_isoline(
1615
Eigen::VectorXd S1,
1716
double s);
1817

19-
// Function to remesh along multiple isolines
2018
std::tuple<
2119
compas::RowMatrixXd,
2220
compas::RowMatrixXi,

src/parametrisation.hpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,22 @@
55
#include <igl/harmonic.h>
66
#include <igl/lscm.h>
77
#include <igl/map_vertices_to_circle.h>
8-
#include <Eigen/Core>
8+
#include <Eigen/Core>
9+
10+
/**
11+
* Compute harmonic parametrization of a triangle mesh.
12+
*
13+
* @param V The vertex matrix of the triangle mesh (n x 3).
14+
* @param F The face matrix of the triangle mesh (m x 3).
15+
* @param bnd The boundary vertex indices.
16+
* @param bnd_uv The UV coordinates for boundary vertices.
17+
* @param harmonic_order The order of harmonic weights (1: harmonic, 2: biharmonic).
18+
* @return Matrix of UV coordinates for all vertices.
19+
*/
20+
Eigen::MatrixXd trimesh_harmonic_parametrisation(
21+
const Eigen::MatrixXd& V,
22+
const Eigen::MatrixXi& F,
23+
const Eigen::VectorXi& bnd,
24+
const Eigen::MatrixXd& bnd_uv,
25+
const int harmonic_order
26+
);

src/planarize.hpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,23 @@
22

33
#include "compas.hpp"
44
#include <igl/planarize_quad_mesh.h>
5-
#include <Eigen/Core>
5+
#include <Eigen/Core>
6+
7+
/**
8+
* Planarize a quad mesh by iteratively projecting faces onto their best-fit planes.
9+
*
10+
* @param V The vertex matrix of the quad mesh (n x 3).
11+
* @param F The face matrix of the quad mesh (m x 4).
12+
* @param maxiter Maximum number of iterations.
13+
* @param threshold Convergence threshold for planarity.
14+
* @return Tuple of (vertices, planarity error).
15+
*/
16+
std::tuple<
17+
compas::RowMatrixXd,
18+
double>
19+
quadmesh_planarize(
20+
compas::RowMatrixXd V,
21+
compas::RowMatrixXi F,
22+
int maxiter,
23+
double threshold
24+
);

0 commit comments

Comments
 (0)