mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 02:22:17 +00:00
Building igl statically and moving to the dep scripts
Fixing dep build script on Windows and removing some warnings. Use bundled igl by default. Not building with the dependency scripts if not explicitly stated. This way, it will stay in Fix the libigl patch to include C source files in header only mode.
This commit is contained in:
46
src/libigl/igl/max.cpp
Normal file
46
src/libigl/igl/max.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "max.h"
|
||||
#include "for_each.h"
|
||||
#include "find_zero.h"
|
||||
|
||||
template <typename AType, typename DerivedB, typename DerivedI>
|
||||
IGL_INLINE void igl::max(
|
||||
const Eigen::SparseMatrix<AType> & A,
|
||||
const int dim,
|
||||
Eigen::PlainObjectBase<DerivedB> & B,
|
||||
Eigen::PlainObjectBase<DerivedI> & I)
|
||||
{
|
||||
const int n = A.cols();
|
||||
const int m = A.rows();
|
||||
B.resize(dim==1?n:m);
|
||||
B.setConstant(std::numeric_limits<typename DerivedB::Scalar>::lowest());
|
||||
I.resize(dim==1?n:m);
|
||||
for_each(A,[&B,&I,&dim](int i, int j,const typename DerivedB::Scalar v)
|
||||
{
|
||||
if(dim == 2)
|
||||
{
|
||||
std::swap(i,j);
|
||||
}
|
||||
// Coded as if dim == 1, assuming swap for dim == 2
|
||||
if(v > B(j))
|
||||
{
|
||||
B(j) = v;
|
||||
I(j) = i;
|
||||
}
|
||||
});
|
||||
Eigen::VectorXi Z;
|
||||
find_zero(A,dim,Z);
|
||||
for(int j = 0;j<I.size();j++)
|
||||
{
|
||||
if(Z(j) != (dim==1?m:n) && 0 > B(j))
|
||||
{
|
||||
B(j) = 0;
|
||||
I(j) = Z(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
// Explicit template instantiation
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::max<bool, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::SparseMatrix<bool, 0, int> const&, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
#endif
|
||||
Reference in New Issue
Block a user