fixed marching tets

This commit is contained in:
Teseo Schneider
2019-09-23 19:04:12 -04:00
parent 9b51e2225e
commit 3840f803f3
2 changed files with 22 additions and 22 deletions
+7 -7
View File
@@ -22,9 +22,9 @@ template <typename DerivedTV,
typename DerivedJ,
typename BCType>
void igl::marching_tets(
const Eigen::PlainObjectBase<DerivedTV>& TV,
const Eigen::PlainObjectBase<DerivedTT>& TT,
const Eigen::PlainObjectBase<DerivedS>& isovals,
const Eigen::MatrixBase<DerivedTV>& TV,
const Eigen::MatrixBase<DerivedTT>& TT,
const Eigen::MatrixBase<DerivedS>& isovals,
double isovalue,
Eigen::PlainObjectBase<DerivedSV>& outV,
Eigen::PlainObjectBase<DerivedSF>& outF,
@@ -94,7 +94,7 @@ void igl::marching_tets(
for (int v = 0; v < 4; v++)
{
const int vid = TT(i, v);
const uint8_t flag = isovals[vid] > isovalue;
const uint8_t flag = isovals(vid, 0) > isovalue;
key |= flag << v;
}
@@ -160,8 +160,8 @@ void igl::marching_tets(
typedef Eigen::Matrix<typename DerivedTV::Scalar, 1, 3, Eigen::RowMajor, 1, 3> RowVector;
const RowVector v1 = TV.row(edge.first);
const RowVector v2 = TV.row(edge.second);
const double a = fabs(isovals[edge.first] - isovalue);
const double b = fabs(isovals[edge.second] - isovalue);
const double a = fabs(isovals(edge.first, 0) - isovalue);
const double b = fabs(isovals(edge.second, 0) - isovalue);
const double w = a / (a+b);
// Create a casted copy in case BCType is a float and we need to downcast
@@ -190,5 +190,5 @@ void igl::marching_tets(
#ifdef IGL_STATIC_LIBRARY
template void igl::marching_tets<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<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, double>(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&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::SparseMatrix<double, 0, int>&);
template void igl::marching_tets<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<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::SparseMatrix<double, 0, int>&);
#endif // IGL_STATIC_LIBRARY
+15 -15
View File
@@ -40,9 +40,9 @@ namespace igl {
typename DerivedJ,
typename BCType>
IGL_INLINE void marching_tets(
const Eigen::PlainObjectBase<DerivedTV>& TV,
const Eigen::PlainObjectBase<DerivedTT>& TT,
const Eigen::PlainObjectBase<DerivedS>& S,
const Eigen::MatrixBase<DerivedTV>& TV,
const Eigen::MatrixBase<DerivedTT>& TT,
const Eigen::MatrixBase<DerivedS>& S,
double isovalue,
Eigen::PlainObjectBase<DerivedSV>& SV,
Eigen::PlainObjectBase<DerivedSF>& SF,
@@ -74,9 +74,9 @@ namespace igl {
typename DerivedJ,
typename BCType>
IGL_INLINE void marching_tets(
const Eigen::PlainObjectBase<DerivedTV>& TV,
const Eigen::PlainObjectBase<DerivedTT>& TT,
const Eigen::PlainObjectBase<DerivedS>& S,
const Eigen::MatrixBase<DerivedTV>& TV,
const Eigen::MatrixBase<DerivedTT>& TT,
const Eigen::MatrixBase<DerivedS>& S,
Eigen::PlainObjectBase<DerivedSV>& SV,
Eigen::PlainObjectBase<DerivedSF>& SF,
Eigen::PlainObjectBase<DerivedJ>& J,
@@ -108,9 +108,9 @@ namespace igl {
typename DerivedSF,
typename DerivedJ>
IGL_INLINE void marching_tets(
const Eigen::PlainObjectBase<DerivedTV>& TV,
const Eigen::PlainObjectBase<DerivedTT>& TT,
const Eigen::PlainObjectBase<DerivedS>& S,
const Eigen::MatrixBase<DerivedTV>& TV,
const Eigen::MatrixBase<DerivedTT>& TT,
const Eigen::MatrixBase<DerivedS>& S,
double isovalue,
Eigen::PlainObjectBase<DerivedSV>& SV,
Eigen::PlainObjectBase<DerivedSF>& SF,
@@ -143,9 +143,9 @@ namespace igl {
typename DerivedSF,
typename BCType>
IGL_INLINE void marching_tets(
const Eigen::PlainObjectBase<DerivedTV>& TV,
const Eigen::PlainObjectBase<DerivedTT>& TT,
const Eigen::PlainObjectBase<DerivedS>& S,
const Eigen::MatrixBase<DerivedTV>& TV,
const Eigen::MatrixBase<DerivedTT>& TT,
const Eigen::MatrixBase<DerivedS>& S,
double isovalue,
Eigen::PlainObjectBase<DerivedSV>& SV,
Eigen::PlainObjectBase<DerivedSF>& SF,
@@ -176,9 +176,9 @@ namespace igl {
typename DerivedSV,
typename DerivedSF>
IGL_INLINE void marching_tets(
const Eigen::PlainObjectBase<DerivedTV>& TV,
const Eigen::PlainObjectBase<DerivedTT>& TT,
const Eigen::PlainObjectBase<DerivedS>& S,
const Eigen::MatrixBase<DerivedTV>& TV,
const Eigen::MatrixBase<DerivedTT>& TT,
const Eigen::MatrixBase<DerivedS>& S,
double isovalue,
Eigen::PlainObjectBase<DerivedSV>& SV,
Eigen::PlainObjectBase<DerivedSF>& SF) {