KillingFusion icon indicating copy to clipboard operation
KillingFusion copied to clipboard

make error !

Open peteryuan123 opened this issue 4 years ago • 3 comments

Hi, I compile your code and it turns out that

In member function ‘Eigen::Vector3d DisplacementField::computeKillingEnergyGradient(const Vector3i&) const’:
/home/peteryuan/Desktop/KillingFusion/KillingFusion/src/DisplacementField.cpp:276:102: error: no match for ‘operator-’ (operand types are ‘const Eigen::ArrayWrapper<const Eigen::Matrix<int, 3, 1> >’ and ‘double’)
     if ((spatialIndex.array() < 2 * deltaSize).any() || (spatialIndex.array() >= (m_gridSize.array() - 2 * deltaSize)).any())

Seem like type m_gridSize.array() and double can't do minus operation.

Using Eigen 3.3.4 on ubuntu 18.04.

I also don't find overloaded operator in ArrayWrapper. How can I solve this problem, thanks.

peteryuan123 avatar May 07 '20 11:05 peteryuan123

@daxiong-123 I dont think this should happen. However, I will need some time to get free to look into this.

saurabheights avatar Jun 08 '20 07:06 saurabheights

Hi, I compile your code and it turns out that

In member function ‘Eigen::Vector3d DisplacementField::computeKillingEnergyGradient(const Vector3i&) const’:
/home/peteryuan/Desktop/KillingFusion/KillingFusion/src/DisplacementField.cpp:276:102: error: no match for ‘operator-’ (operand types are ‘const Eigen::ArrayWrapper<const Eigen::Matrix<int, 3, 1> >’ and ‘double’)
     if ((spatialIndex.array() < 2 * deltaSize).any() || (spatialIndex.array() >= (m_gridSize.array() - 2 * deltaSize)).any())

Seem like type m_gridSize.array() and double can't do minus operation.

Using Eigen 3.3.4 on ubuntu 18.04.

I also don't find overloaded operator in ArrayWrapper. How can I solve this problem, thanks.

Hello, I have met the same problem. Did you fix it?

HerB1998 avatar Dec 07 '21 15:12 HerB1998

@HerB1998 The error is coming from minus operation between an Eigen Vector(const Eigen::ArrayWrapper<const Eigen::Matrix<int, 3, 1> >) and double value: m_gridSize.array() - 2 * deltaSize). See scalar subtraction - https://stackoverflow.com/a/35693493/1874627

I dont remember much of the codebase, but it looks almost valid. There might be a gotcha where I might have introduced a bug by trying to subtract a double from an int vector, but I believe this should be supported. If not, you might have to convert m_gridSize.array() to double before subtraction.

Apologies, but it has been years since I worked on this, can barely recall.

saurabheights avatar Dec 13 '21 17:12 saurabheights