update bundled_deps

This commit is contained in:
QIDI TECH
2024-11-09 14:05:44 +08:00
parent 17c9bfd127
commit cfc606fea9
1662 changed files with 710 additions and 168 deletions

View File

@@ -0,0 +1,41 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
//
// 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/.
#include "from_cork_mesh.h"
template <
typename DerivedV,
typename DerivedF>
IGL_INLINE void igl::copyleft::cork::from_cork_mesh(
const CorkTriMesh & mesh,
Eigen::PlainObjectBase<DerivedV > & V,
Eigen::PlainObjectBase<DerivedF > & F)
{
using namespace std;
F.resize(mesh.n_triangles,3);
V.resize(mesh.n_vertices,3);
for(size_t v = 0;v<mesh.n_vertices;v++)
{
for(size_t c = 0;c<3;c++)
{
V(v,c) = mesh.vertices[v*3+c];
}
}
for(size_t f = 0;f<mesh.n_triangles;f++)
{
for(size_t c = 0;c<3;c++)
{
F(f,c) = mesh.triangles[f*3+c];
}
}
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template void igl::copyleft::cork::from_cork_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(CorkTriMesh const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
template void igl::copyleft::cork::from_cork_mesh<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(CorkTriMesh const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
#endif

View File

@@ -0,0 +1,39 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
//
// 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/.
#ifndef IGL_COPYLEFT_CORK_FROM_CORK_MESH_H
#define IGL_COPYLEFT_CORK_FROM_CORK_MESH_H
#include "../../igl_inline.h"
#include <cork.h>
#include <Eigen/Core>
namespace igl
{
namespace copyleft
{
namespace cork
{
// Convert cork's triangle mesh representation to a (V,F) mesh.
//
// Inputs:
// mesh cork representation of mesh
// Outputs:
// V #V by 3 list of vertex positions
// F #F by 3 list of triangle indices into V
template <
typename DerivedV,
typename DerivedF>
IGL_INLINE void from_cork_mesh(
const CorkTriMesh & mesh,
Eigen::PlainObjectBase<DerivedV > & V,
Eigen::PlainObjectBase<DerivedF > & F);
}
}
}
#ifndef IGL_STATIC_LIBRARY
# include "from_cork_mesh.cpp"
#endif
#endif

View File

@@ -0,0 +1,99 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
//
// 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/.
#include "mesh_boolean.h"
#include "to_cork_mesh.h"
#include "from_cork_mesh.h"
template <
typename DerivedVA,
typename DerivedFA,
typename DerivedVB,
typename DerivedFB,
typename DerivedVC,
typename DerivedFC>
IGL_INLINE void igl::copyleft::cork::mesh_boolean(
const Eigen::PlainObjectBase<DerivedVA > & VA,
const Eigen::PlainObjectBase<DerivedFA > & FA,
const Eigen::PlainObjectBase<DerivedVB > & VB,
const Eigen::PlainObjectBase<DerivedFB > & FB,
const MeshBooleanType & type,
Eigen::PlainObjectBase<DerivedVC > & VC,
Eigen::PlainObjectBase<DerivedFC > & FC)
{
CorkTriMesh A,B,C;
// pointer to output so it's easy to redirect on degenerate cases
CorkTriMesh *ret = &C;
to_cork_mesh(VA,FA,A);
to_cork_mesh(VB,FB,B);
switch(type)
{
case MESH_BOOLEAN_TYPE_UNION:
if(A.n_triangles == 0)
{
ret = &B;
}else if(B.n_triangles == 0)
{
ret = &A;
}else
{
computeUnion(A,B,ret);
}
break;
case MESH_BOOLEAN_TYPE_INTERSECT:
if(A.n_triangles == 0 || B.n_triangles == 0)
{
ret->n_triangles = 0;
ret->n_vertices = 0;
}else
{
computeIntersection(A,B,ret);
}
break;
case MESH_BOOLEAN_TYPE_MINUS:
if(A.n_triangles == 0)
{
ret->n_triangles = 0;
ret->n_vertices = 0;
}else if(B.n_triangles == 0)
{
ret = &A;
}else
{
computeDifference(A,B,ret);
}
break;
case MESH_BOOLEAN_TYPE_XOR:
if(A.n_triangles == 0)
{
ret = &B;
}else if(B.n_triangles == 0)
{
ret = &A;
}else
{
computeSymmetricDifference(A,B,&C);
}
break;
case MESH_BOOLEAN_TYPE_RESOLVE:
resolveIntersections(A,B,&C);
break;
default:
assert(false && "Unknown type");
return;
}
from_cork_mesh(*ret,VC,FC);
freeCorkTriMesh(&A);
freeCorkTriMesh(&B);
freeCorkTriMesh(&C);
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template void igl::copyleft::cork::mesh_boolean<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
template void igl::copyleft::cork::mesh_boolean<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
#endif

View File

@@ -0,0 +1,55 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
//
// 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/.
#ifndef IGL_COPYLEFT_CORK_MESH_BOOLEAN_H
#define IGL_COPYLEFT_CORK_MESH_BOOLEAN_H
#include "../../MeshBooleanType.h"
#include "../../igl_inline.h"
#include <Eigen/Core>
#include <cork.h> // for consistent uint
namespace igl
{
namespace copyleft
{
namespace cork
{
// Compute a boolean operation on two input meshes using the cork library.
//
// Inputs:
// VA #VA by 3 list of vertex positions of first mesh
// FA #FA by 3 list of triangle indices into VA
// VB #VB by 3 list of vertex positions of second mesh
// FB #FB by 3 list of triangle indices into VB
// type of boolean operation see MeshBooleanType.h
// Outputs:
// VC #VC by 3 list of vertex positions of output mesh
// FC #FC by 3 list of triangle indices into VC
template <
typename DerivedVA,
typename DerivedFA,
typename DerivedVB,
typename DerivedFB,
typename DerivedVC,
typename DerivedFC>
IGL_INLINE void mesh_boolean(
const Eigen::PlainObjectBase<DerivedVA > & VA,
const Eigen::PlainObjectBase<DerivedFA > & FA,
const Eigen::PlainObjectBase<DerivedVB > & VB,
const Eigen::PlainObjectBase<DerivedFB > & FB,
const MeshBooleanType & type,
Eigen::PlainObjectBase<DerivedVC > & VC,
Eigen::PlainObjectBase<DerivedFC > & FC);
}
}
}
#ifndef IGL_STATIC_LIBRARY
# include "mesh_boolean.cpp"
#endif
#endif

View File

@@ -0,0 +1,43 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
//
// 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/.
#include "to_cork_mesh.h"
template <
typename DerivedV,
typename DerivedF>
IGL_INLINE void igl::copyleft::cork::to_cork_mesh(
const Eigen::PlainObjectBase<DerivedV > & V,
const Eigen::PlainObjectBase<DerivedF > & F,
CorkTriMesh & mesh)
{
using namespace std;
assert((F.cols() == 0 || F.cols() == 3) && "Facets should be triangles.");
assert((V.cols() == 0 || V.cols() == 3) && "Vertices should be in 3D.");
mesh.n_triangles = F.rows();
mesh.n_vertices = V.rows();
mesh.vertices = new float[mesh.n_vertices*3];
mesh.triangles = new uint[mesh.n_triangles*3];
for(size_t v = 0;v<mesh.n_vertices;v++)
{
for(size_t c = 0;c<3;c++)
{
mesh.vertices[v*3+c] = V(v,c);
}
}
for(size_t f = 0;f<mesh.n_triangles;f++)
{
for(size_t c = 0;c<3;c++)
{
mesh.triangles[f*3+c] = F(f,c);
}
}
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template void igl::copyleft::cork::to_cork_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, CorkTriMesh&);
template void igl::copyleft::cork::to_cork_mesh<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, CorkTriMesh&);
#endif

View File

@@ -0,0 +1,39 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
//
// 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/.
#ifndef IGL_COPYLEFT_CORK_TO_CORK_MESH_H
#define IGL_COPYLEFT_CORK_TO_CORK_MESH_H
#include "../../igl_inline.h"
#include <cork.h>
#include <Eigen/Core>
namespace igl
{
namespace copyleft
{
namespace cork
{
// Convert a (V,F) mesh to a cork's triangle mesh representation.
//
// Inputs:
// V #V by 3 list of vertex positions
// F #F by 3 list of triangle indices into V
// Outputs:
// mesh cork representation of mesh
template <
typename DerivedV,
typename DerivedF>
IGL_INLINE void to_cork_mesh(
const Eigen::PlainObjectBase<DerivedV > & V,
const Eigen::PlainObjectBase<DerivedF > & F,
CorkTriMesh & mesh);
}
}
}
#ifndef IGL_STATIC_LIBRARY
# include "to_cork_mesh.cpp"
#endif
#endif