Skip to content

Commit

Permalink
adjacency list
Browse files Browse the repository at this point in the history
  • Loading branch information
fwilliams committed Dec 12, 2023
1 parent 47f760a commit 00181fa
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ set(PCU_BINDING_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/flood_fill_3d.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/voxelize_triangle_mesh.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/remove_mesh_vertices.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/adjacency_list.cpp
)

set(PCU_BINDING_SOURCES ${PCU_BINDING_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src/lloyd.cpp)
Expand Down
2 changes: 1 addition & 1 deletion point_cloud_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
morton_add, morton_subtract, point_cloud_fast_winding_number, \
sparse_voxel_grid_boundary, marching_cubes_sparse_voxel_grid, decimate_triangle_mesh, \
remove_unreferenced_mesh_vertices, mesh_face_areas, triangle_soup_fast_winding_number, \
_voxel_mesh_internal, remove_mesh_vertices
_voxel_mesh_internal, remove_mesh_vertices, adjacency_list
# mesh_principal_curvatures, \

from ._sinkhorn import *
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def main():

setuptools.setup(
name="point-cloud-utils",
version="0.30.3",
version="0.30.4",
author="Francis Williams",
author_email="[email protected]",
description="A Python library for common tasks on 3D point clouds and meshes",
Expand Down
33 changes: 33 additions & 0 deletions src/adjacency_list.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <npe.h>
#include <pybind11/stl.h>

#include <igl/adjacency_list.h>

#include "common/common.h"



const char* adjacency_list_doc = R"igl_Qu8mg5v7(
Compute the adjacency list given a set of mesh faces.
Args:
f : \#f by 3 Matrix of face (triangle) indices
Returns:
adj_list : a list of lists such that adj_list[i] contains the indexes of vertices adjacent to vertex i
)igl_Qu8mg5v7";
npe_function(adjacency_list)
npe_doc(adjacency_list_doc)
npe_arg(f, dense_int32, dense_int64)
npe_begin_code()
{
validate_mesh_faces(f);

std::vector<std::vector<int>> A;

igl::adjacency_list(f, A);

return A;
}
npe_end_code()
3 changes: 1 addition & 2 deletions src/remove_mesh_vertices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ Removes vertices specified by a mask from a triangle mesh and updates the face i
Returns:
v_out : (\#v, 3)-shaped array of mesh vertices with the mask applied
f_out : (\#f, 3)-shaped array of mesh faces corresponding to mesh with removed vertices
See also:
deduplicate_point_cloud
)igl_Qu8mg5v7";
npe_function(remove_mesh_vertices)
npe_doc(remove_mesh_vertices_doc)
Expand Down

0 comments on commit 00181fa

Please sign in to comment.