@@ -170,6 +170,12 @@ void PolynomialPathFitter::run() {
170
170
" Expected 'num_parallel_threads' to be between 1 and {}, but "
171
171
" received {}." , std::thread::hardware_concurrency (),
172
172
get_num_parallel_threads ())
173
+ OPENSIM_THROW_IF_FRMOBJ (
174
+ static_cast <int >(values.getNumRows ()) < get_num_parallel_threads (),
175
+ Exception, " Expected the number of time points in the coordinate "
176
+ " values table to be greater than 'num_parallel_threads', but "
177
+ " received {} and {}, respectively." ,
178
+ values.getNumRows (), get_num_parallel_threads ())
173
179
log_info (" Number of parallel threads = {}" , get_num_parallel_threads ());
174
180
175
181
// Number of samples per frame.
@@ -662,7 +668,8 @@ TimeSeriesTable PolynomialPathFitter::sampleCoordinateValues(
662
668
int timeIdx = 0 ;
663
669
const auto & times = values.getIndependentColumn ();
664
670
TimeSeriesTable valuesSampled;
665
- double dt = (times[1 ] - times[0 ]) / (get_num_samples_per_frame () + 2 );
671
+ double dt = (times.size () < 2 ) ? 0.01 :
672
+ (times[1 ] - times[0 ]) / (get_num_samples_per_frame () + 2 );
666
673
for (int i = 0 ; i < get_num_parallel_threads (); ++i) {
667
674
int numTimeIndexes = outputs[i].nrow () / get_num_samples_per_frame ();
668
675
for (int j = 0 ; j < numTimeIndexes; ++j) {
0 commit comments