Bug 98515 - Skip mode fencepost errors
Summary: Skip mode fencepost errors
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: George Staikos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-03 18:36 UTC by Netterfield
Modified: 2005-02-08 01:54 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
case 1 (12.85 KB, image/png)
2005-02-03 18:38 UTC, Netterfield
Details
case 2 (12.98 KB, image/png)
2005-02-03 18:39 UTC, Netterfield
Details
case 3 (12.75 KB, image/png)
2005-02-03 18:39 UTC, Netterfield
Details
What I have for skip (22.31 KB, image/png)
2005-02-07 22:04 UTC, George Staikos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Netterfield 2005-02-03 18:36:17 UTC
Version:           1.1.0_devel (using KDE 3.3.0, SuSE)
Compiler:          gcc version 3.3.4 (pre 3.3.5 20040809)
OS:                Linux (i686) release 2.6.8-24.11-default

skip is borked.
Demo:
make a plot of a dirfile_maker file
2 curves both with points but no lines for clarity
  10 frames of sine, no skip
  10 frames of sine, with skip set. (need a second INDEX vector for X)
We will change starting frame and the skip value for curve 2

Case 1: starting frame = 0 and skip = 1 for both vectors of curve 2
        everything seems fine: curve 2 has the 1st sample of each frame

Case 2: starting frame = 10 (anything !=0), curve 2 skip = 1
        The X (INDEX) vector seems to have the correct value,
        but the Y (sine) vector seems to be shifted by by ~19 samples


Case 3: starting frame = 10 (anything !=0), curve 2 skip = 2
        X and Y vectors are both shifted, so the points are correct,
        but start 1 frame early, and end 1 frame early
Comment 1 Netterfield 2005-02-03 18:38:52 UTC
Created attachment 9413 [details]
case 1
Comment 2 Netterfield 2005-02-03 18:39:29 UTC
Created attachment 9414 [details]
case 2
Comment 3 Netterfield 2005-02-03 18:39:59 UTC
Created attachment 9415 [details]
case 3
Comment 4 George Staikos 2005-02-03 22:28:27 UTC
Investigating
Comment 5 George Staikos 2005-02-03 22:33:21 UTC
Note: this is specific to SPF!=1 right?
Comment 6 George Staikos 2005-02-07 22:04:20 UTC
Created attachment 9472 [details]
What I have for skip

This is what I see.  Everything appears to line up just right.	Those curves
are with no skip, and skip=1, 2, 3.

Can you attach your data file so I can try to reproduce this with it?
Comment 7 Netterfield 2005-02-07 22:45:12 UTC
Yup.  That is case 1 above. "Everything seems fine".

Try starting at a frame other than frame 0 (case 2 and 3).

I was using the dirfile_writer output.
Comment 8 George Staikos 2005-02-08 01:54:10 UTC
CVS commit by staikos: 

seems to fix Skip alignment errors?  Please reopen with a new testcase if there
are still problems
BUG: 98515


  M +1 -1      kstrvector.cpp   1.79


--- kdeextragear-2/kst/kst/kstrvector.cpp  #1.78:1.79
@@ -468,5 +468,5 @@ KstObject::UpdateType KstRVector::doUpda
     // new_f0 == 0 results in (new_f0 - 1)/Skip being -0.x which rounds the
     // wrong way on us.  Therefore new_f0 == 0 is a special case.
-    new_f0 = new_f0 == 0 ? 0 : (((new_f0 - 1)/Skip) + 1) * Skip - 1;
+    new_f0 = new_f0 == 0 ? 0 : (((new_f0 - 1)/Skip) + 1) * Skip;
     new_nf = tmp_fn - new_f0 + 1;
   }