From d31531d8f981c1dc3916ed9723a3617de5d41404 Mon Sep 17 00:00:00 2001 From: Jiaming Guo Date: Tue, 20 Dec 2016 17:11:38 -0600 Subject: [PATCH] fix minor error in computing geometry metric --- stim/visualization/cylinder.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stim/visualization/cylinder.h b/stim/visualization/cylinder.h index a25ebc5..8eefde0 100644 --- a/stim/visualization/cylinder.h +++ b/stim/visualization/cylinder.h @@ -178,14 +178,14 @@ public: T sum = 0; //initialize the integral to zero T m0, m1; //allocate space for both magnitudes in a single segment m0 = M[0][m]; //initialize the first point and magnitude to the first point in the cylinder - T len = L[0]; //allocate space for the segment length + T len = L[1]; //allocate space for the segment length for (unsigned p = 1; p < size(); p++) { //for every consecutive point in the cylinder m1 = M[p][m]; - if (p > 1) len = (L[p - 1] - L[p - 2]); //calculate the segment length using the L array + if (p > 1) len = (L[p] - L[p - 1]); //calculate the segment length using the L array sum += (m0 + m1) / (T)2.0 * len; //add the average magnitude, weighted by the segment length - m0 = m1; //move to the next segment by shifting points + m0 = m1; //move to the next segment by shifting points } return sum; //return the integral } -- libgit2 0.21.4