Skip to content

Conversation

@petrasvestartas
Copy link
Collaborator

CHANGE type binding to type casters defined in compas.h

// Nanobind type casters: https://nanobind.readthedocs.io/en/latest/exchanging.html

namespace compas {
    // Basic Eigen types with clear naming
    using RowMatrixXd = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
    using RowMatrixXi = Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
    using VectorXi = Eigen::VectorXi;
    using VectorXd = Eigen::VectorXd;
    
    // STL containers with descriptive names
    using VectorInt = std::vector<int>;
    using VectorFloat = std::vector<float>;
    using VectorBool = std::vector<bool>;
    using VectorVectorInt = std::vector<VectorInt>;
    
    // Complex types with descriptive names
    using TupleIntFloatFloatFloat = std::tuple<int, float, float, float>;  // face_id, u, v, t
    using VectorTupleIntFloatFloatFloat = std::vector<TupleIntFloatFloatFloat>;
    using VectorVectorTupleIntFloatFloatFloat = std::vector<VectorTupleIntFloatFloatFloat>;
    
    // Tuple types with descriptive names
    using IsolinesResult = std::tuple<RowMatrixXd, RowMatrixXi, RowMatrixXi>;  // vertices, edges, indices
    using RemeshIsolineResult = std::tuple<RowMatrixXd, RowMatrixXi, VectorXi>;  // vertices, faces, labels
    using RemeshIsolinesResult = std::tuple<RowMatrixXd, RowMatrixXi, VectorXd, VectorXi>;  // vertices, faces, scalar_values, face_groups
    using PrincipalCurvatureResult = std::tuple<RowMatrixXd, RowMatrixXd, VectorXd, VectorXd>;  // PD1, PD2, PV1, PV2
    using MeshMapResult = std::tuple<RowMatrixXd, VectorVectorInt, RowMatrixXd, VectorBool, VectorInt>;  // pattern_vertices, pattern_faces, pattern_normals, is_boundary, groups
}

Copy link
Member

@tomvanmele tomvanmele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tomvanmele tomvanmele merged commit 6cae924 into main Jun 25, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants