Skip to content

use pythonic options instead of _ad hoc_ name variations for igl function overloads #172

@alecjacobson

Description

@alecjacobson

There a bunch of these and maybe later I'll try to enumerate them all.

For example in C++ igl::boundary provides these two overloads:

 template <typename DerivedF, typename Index>
  IGL_INLINE void boundary_loop(
    const Eigen::MatrixBase<DerivedF>& F, 
    std::vector<std::vector<Index> >& L);
  template <typename DerivedF, typename Index>
  IGL_INLINE void boundary_loop(
    const Eigen::MatrixBase<DerivedF>& F, 
    std::vector<Index>& L);

The first returning all boundary loops and the second returning the longest. In the current python bindings these manifest as igl.all_boundary_loop and igl.boundary_loop.

To avoid confusion (see, e.g., #67, #124), the python binding names should match as closely as possible to the underlying C++ function.

The pythonic solution would be to use kwarg optional arguments like

igl.boundary_loop(F) # defaults to return_all=False
igl.boundary_loop(F,return_all=True)

I'm not sure yet how to set these up with pybind11 but it seems possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions