Skip to content

Commit 448d0b9

Browse files
committed
Fix the logic so that when value is precisely zero it is still read in as long as its residual is not -1.
1 parent afa8fc0 commit 448d0b9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

OpenSim/Common/C3DFileAdapter.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,12 @@ C3DFileAdapter::extendRead(const std::string& fileName) const {
120120
// BTK reads empty values as zero, but sets a "residual" value
121121
// to -1 and it is how it knows to export these values as
122122
// blank, instead of 0, when exporting to .trc
123-
if (!pt->GetValues().row(f).isZero() && //not precisely zero
123+
// Read in value if it is not zero or residual is not -1
124+
if (!pt->GetValues().row(f).isZero() || //not precisely zero
124125
(pt->GetResiduals().coeff(f) != -1) ) {//residual is not -1
125126
row[m] = SimTK::Vec3{ pt->GetValues().coeff(f, 0),
126-
pt->GetValues().coeff(f, 1),
127-
pt->GetValues().coeff(f, 2) };
127+
pt->GetValues().coeff(f, 1),
128+
pt->GetValues().coeff(f, 2) };
128129
}
129130
++m;
130131
}

0 commit comments

Comments
 (0)