Merge remote-tracking branch 'upstream/master' into viewer
This commit is contained in:
@@ -11,15 +11,15 @@ import pyigl as igl
|
||||
|
||||
def p2e(m):
|
||||
if isinstance(m, np.ndarray):
|
||||
if not m.flags['C_CONTIGUOUS']:
|
||||
raise TypeError("p2e only support C-contiguous order")
|
||||
if m.dtype.type == np.int32:
|
||||
return igl.eigen.MatrixXi(m)
|
||||
elif m.dtype.type == np.float64:
|
||||
return igl.eigen.MatrixXd(m)
|
||||
if not (m.flags['C_CONTIGUOUS'] or m.flags['F_CONTIGUOUS']):
|
||||
raise TypeError('p2e support either c-order or f-order')
|
||||
if m.dtype.type in [np.int32, np.int64]:
|
||||
return igl.eigen.MatrixXi(m.astype(np.int32))
|
||||
elif m.dtype.type in [np.float64, np.float32]:
|
||||
return igl.eigen.MatrixXd(m.astype(np.float64))
|
||||
elif m.dtype.type == np.bool:
|
||||
return igl.eigen.MatrixXb(m)
|
||||
raise TypeError("p2e only support dtype float64, int32 and bool")
|
||||
raise TypeError("p2e only support dtype float64/32, int64/32 and bool")
|
||||
if sparse.issparse(m):
|
||||
# convert in a dense matrix with triples
|
||||
coo = m.tocoo()
|
||||
|
||||
@@ -598,6 +598,23 @@ const char *__doc_igl_embree_reorient_facets_raycast = R"igl_Qu8mg5v7(// Orient
|
||||
// Outputs:
|
||||
// I #F list of whether face has been flipped
|
||||
// C #F list of patch ID (output of bfs_orient > manifold patches))igl_Qu8mg5v7";
|
||||
const char *__doc_igl_exact_geodesic = R"igl_Qu8mg5v7(
|
||||
// Exact geodesic algorithm for triangular mesh with the implementation from https://code.google.com/archive/p/geodesic/,
|
||||
// and the algorithm first described by Mitchell, Mount and Papadimitriou in 1987
|
||||
//
|
||||
// Inputs:
|
||||
// V #V by 3 list of 3D vertex positions
|
||||
// F #F by 3 list of mesh faces
|
||||
// VS #VS by 1 vector specifying indices of source vertices
|
||||
// FS #FS by 1 vector specifying indices of source faces
|
||||
// VT #VT by 1 vector specifying indices of target vertices
|
||||
// FT #FT by 1 vector specifying indices of target faces
|
||||
// Output:
|
||||
// D #VT+#FT by 1 vector of geodesic distances of each target w.r.t. the nearest one in the source set
|
||||
//
|
||||
// Note:
|
||||
// Specifying a face as target/source means its center.
|
||||
//)igl_Qu8mg5v7";
|
||||
const char *__doc_igl_find_cross_field_singularities = R"igl_Qu8mg5v7(// Inputs:
|
||||
// V #V by 3 eigen Matrix of mesh vertex 3D positions
|
||||
// F #F by 3 eigen Matrix of face (quad) indices
|
||||
@@ -1453,3 +1470,33 @@ const char *__doc_igl_readPLY= R"igl_Qu8mg5v7(// Read a mesh from an ascii ply f
|
||||
// N double matrix of corner normals #N by 3
|
||||
// UV #V by 2 texture coordinates
|
||||
// Returns true on success, false on errors)igl_Qu8mg5v7";
|
||||
const char *__doc_igl_seam_edges=R"igl_Qu8mg5v7(// Finds all UV-space boundaries of a mesh.
|
||||
//
|
||||
// Inputs:
|
||||
// V #V by dim list of positions of the input mesh.
|
||||
// TC #TC by 2 list of 2D texture coordinates of the input mesh
|
||||
// F #F by 3 list of triange indices into V representing a
|
||||
// manifold-with-boundary triangle mesh
|
||||
// FTC #F by 3 list of indices into TC for each corner
|
||||
// Outputs:
|
||||
// seams Edges where the forwards and backwards directions have different
|
||||
// texture coordinates, as a #seams-by-4 matrix of indices. Each row is
|
||||
// organized as [ forward_face_index, forward_face_vertex_index,
|
||||
// backwards_face_index, backwards_face_vertex_index ] such that one side
|
||||
// of the seam is the edge:
|
||||
// F[ seams( i, 0 ), seams( i, 1 ) ], F[ seams( i, 0 ), (seams( i, 1 ) + 1) % 3 ]
|
||||
// and the other side is the edge:
|
||||
// F[ seams( i, 2 ), seams( i, 3 ) ], F[ seams( i, 2 ), (seams( i, 3 ) + 1) % 3 ]
|
||||
// boundaries Edges with only one incident triangle, as a #boundaries-by-2
|
||||
// matrix of indices. Each row is organized as
|
||||
// [ face_index, face_vertex_index ]
|
||||
// such that the edge is:
|
||||
// F[ boundaries( i, 0 ), boundaries( i, 1 ) ], F[ boundaries( i, 0 ), (boundaries( i, 1 ) + 1) % 3 ]
|
||||
// foldovers Edges where the two incident triangles fold over each other
|
||||
// in UV-space, as a #foldovers-by-4 matrix of indices.
|
||||
// Each row is organized as [ forward_face_index, forward_face_vertex_index,
|
||||
// backwards_face_index, backwards_face_vertex_index ]
|
||||
// such that one side of the foldover is the edge:
|
||||
// F[ foldovers( i, 0 ), foldovers( i, 1 ) ], F[ foldovers( i, 0 ), (foldovers( i, 1 ) + 1) % 3 ]
|
||||
// and the other side is the edge:
|
||||
// F[ foldovers( i, 2 ), foldovers( i, 3 ) ], F[ foldovers( i, 2 ), (foldovers( i, 3 ) + 1) % 3 ])igl_Qu8mg5v7";
|
||||
|
||||
+3
-1
@@ -48,6 +48,7 @@ extern const char *__doc_igl_eigs;
|
||||
extern const char *__doc_igl_embree_ambient_occlusion;
|
||||
extern const char *__doc_igl_embree_line_mesh_intersection;
|
||||
extern const char *__doc_igl_embree_reorient_facets_raycast;
|
||||
extern const char *__doc_igl_exact_geodesic;
|
||||
extern const char *__doc_igl_find_cross_field_singularities;
|
||||
extern const char *__doc_igl_fit_rotations;
|
||||
extern const char *__doc_igl_fit_rotations_planar;
|
||||
@@ -99,6 +100,7 @@ extern const char *__doc_igl_readTGF;
|
||||
extern const char *__doc_igl_read_triangle_mesh;
|
||||
extern const char *__doc_igl_remove_duplicate_vertices;
|
||||
extern const char *__doc_igl_rotate_vectors;
|
||||
extern const char *__doc_igl_seam_edges;
|
||||
extern const char *__doc_igl_setdiff;
|
||||
extern const char *__doc_igl_signed_distance;
|
||||
extern const char *__doc_igl_signed_distance_pseudonormal;
|
||||
@@ -125,4 +127,4 @@ extern const char *__doc_igl_winding_number_2;
|
||||
extern const char *__doc_igl_writeMESH;
|
||||
extern const char *__doc_igl_writeOBJ;
|
||||
extern const char *__doc_igl_writePLY;
|
||||
extern const char *__doc_igl_readPLY;
|
||||
extern const char *__doc_igl_readPLY;
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <igl/edge_lengths.h>
|
||||
#include <igl/edge_topology.h>
|
||||
#include <igl/eigs.h>
|
||||
#include <igl/exact_geodesic.h>
|
||||
#include <igl/find_cross_field_singularities.h>
|
||||
#include <igl/fit_rotations.h>
|
||||
#include <igl/floor.h>
|
||||
@@ -102,6 +103,7 @@
|
||||
#include <igl/writeOBJ.h>
|
||||
#include <igl/writePLY.h>
|
||||
#include <igl/readPLY.h>
|
||||
#include <igl/seam_edges.h>
|
||||
|
||||
void python_export_igl(py::module &m)
|
||||
{
|
||||
@@ -141,6 +143,7 @@ void python_export_igl(py::module &m)
|
||||
#include "py_igl/py_edge_lengths.cpp"
|
||||
#include "py_igl/py_edge_topology.cpp"
|
||||
#include "py_igl/py_eigs.cpp"
|
||||
#include "py_igl/py_exact_geodesic.cpp"
|
||||
#include "py_igl/py_find_cross_field_singularities.cpp"
|
||||
#include "py_igl/py_fit_rotations.cpp"
|
||||
#include "py_igl/py_floor.cpp"
|
||||
@@ -199,4 +202,5 @@ void python_export_igl(py::module &m)
|
||||
#include "py_igl/py_writeOBJ.cpp"
|
||||
#include "py_igl/py_writePLY.cpp"
|
||||
#include "py_igl/py_readPLY.cpp"
|
||||
#include "py_igl/py_seam_edges.cpp"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2018 Zhongshi Jiang <jiangzs@nyu.edu>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
m.def("exact_geodesic", []
|
||||
(
|
||||
const Eigen::MatrixXd &V,
|
||||
const Eigen::MatrixXi &F,
|
||||
const Eigen::MatrixXi &VS,
|
||||
const Eigen::MatrixXi &FS,
|
||||
const Eigen::MatrixXi &VT,
|
||||
const Eigen::MatrixXi &FT,
|
||||
Eigen::MatrixXd &D
|
||||
)
|
||||
{
|
||||
return igl::exact_geodesic(V, F, VS,FS,VT,FT, D);
|
||||
}, __doc_igl_exact_geodesic,
|
||||
py::arg("V"), py::arg("F"), py::arg("VS"), py::arg("FS"), py::arg("VT"), py::arg("FT"), py::arg("D"));
|
||||
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
m.def("seam_edges", []
|
||||
(
|
||||
const Eigen::MatrixXd& V,
|
||||
const Eigen::MatrixXd& TC,
|
||||
const Eigen::MatrixXi& F,
|
||||
const Eigen::MatrixXi& FTC,
|
||||
Eigen::MatrixXi& seams,
|
||||
Eigen::MatrixXi& boundaries,
|
||||
Eigen::MatrixXi& foldovers
|
||||
)
|
||||
{
|
||||
return igl::seam_edges( V, TC, F, FTC, seams, boundaries, foldovers);
|
||||
}, __doc_igl_seam_edges,
|
||||
py::arg("V"),
|
||||
py::arg("TC"),
|
||||
py::arg("F"),
|
||||
py::arg("FTC"),
|
||||
py::arg("seams"),
|
||||
py::arg("boundaries"),
|
||||
py::arg("foldovers"));
|
||||
|
||||
Reference in New Issue
Block a user