Menu

#9 BLT's vectors indexes min / max do not work

open
nobody
BLT (8)
8
2011-10-11
2011-10-11
Karl
No

2011-10-11 18:06:24 CDT
BLT's vectors have defined indexes such as min max end
min and max do not work in 6.51, the value returned is NaN.
Everthing is OK in an older version such as freewrapBLT44.
All tests on Windows with the Binaries from Sourceforge.

I am attaching a simple example for your review:

package require BLT
namespace import ::blt::vector
namespace import ::blt::graph

proc wputs { text } {
tk_messageBox -parent . -message "$text" -icon info
}

set ::X [ vector create xd]
set ::Y [ vector create yd]

# fill one vector
$::X seq 0 100

wputs "xd(min)= $xd(min) "
wputs "xd(max)= $xd(max) "

Discussion

  • Karl

    Karl - 2011-10-11

    Essentially the same example as in the text

     
  • Karl

    Karl - 2011-10-11
    • priority: 5 --> 8
     
  • Peter MacDonald

    Peter MacDonald - 2011-10-12

    This looks to be a windows only bug. You could try the following patch
    to bltVecMath.c (also attached as bvec.pat).

    -- bltVecMath.c.old 2011-10-11 18:22:10.273099021 -0700
    +++ bltVecMath.c 2011-10-11 18:22:54.989099135 -0700
    @@ -361,7 +361,7 @@
    {
    VectorObject *vPtr = (VectorObject *)vecPtr;

    - if (!FINITE(vPtr->min)) {
    + if (1 || (!FINITE(vPtr->min))) {
    double min;
    register int i;

    @@ -390,7 +390,7 @@
    {
    VectorObject *vPtr = (VectorObject *)vecPtr;

    - if (!FINITE(vPtr->max)) {
    + if (1 || (!FINITE(vPtr->max))) {
    double max;
    register int i;

     
  • Peter MacDonald

    Peter MacDonald - 2011-10-14

    > Thank you very much for this fix !

    Karl,

    The problem with the above patch is it is inefficient with large vectors.
    Can you try the following instead (also attached as vecmath.pat)

    --- bltVecMath.c.old 2011-10-11 18:22:10.273099021 -0700
    +++ bltVecMath.c 2011-10-14 07:43:10.819812934 -0700
    @@ -361,7 +361,7 @@
    {
    VectorObject *vPtr = (VectorObject *)vecPtr;

    - if (!FINITE(vPtr->min)) {
    + if (vPtr->min == bltNaN || (!FINITE(vPtr->min))) {
    double min;
    register int i;

    @@ -390,7 +390,7 @@
    {
    VectorObject *vPtr = (VectorObject *)vecPtr;

    - if (!FINITE(vPtr->max)) {
    + if (vPtr->max == bltNaN || (!FINITE(vPtr->max))) {
    double max;
    register int i;

     
  • Nobody/Anonymous

    Peter,
    I am very thankful to you for fixing this issue.

    My problem is that I am using the windows version of Wize embedded in freewrapPLUS651,
    and it appears that this version of Wize / BLT is broken in several places.

    Example:
    Blt_ZoomStack (is not available)
    $w axis configure x -stepsize value (produces an exception)
    And in the end the plot is not right, the min value of the x axis is wrong, etc,
    and the same script works fine with freewrap44 which was using an old version
    of BLT, but the problem is that with that version the max size of the image that can be created is only 400x400.

    It would be great if you could fix this issues so that Wize works on Windows !

    Thanks,

     
  • Karl

    Karl - 2011-10-16

    Peter,

    Actually I wanted to clarify or rectify that part of the issue described below was not due t o WIZE.
    The exception in the code generated by freewrap exists, and we would not want fatal exceptions not handled by TCLTK, but in this case the exception was caused by a script/data that was not good.
    And the issue with images limited to 400x400 is due to not having the Img extension in freewrapBLT or freewrapPLUS, so this has nothing to do with WIZE.

    In any case most liketly you have fixed the min/max issue, and perhaps you can fix the Blt_ZoomStack (not available) issue.

    Thanks again,
    Cheers,

     
  • Peter MacDonald

    Peter MacDonald - 2011-10-17

    carlsoba,

    Several things:

    1) did you test my revised patch for min/max?
    2) the Blt_ZoomStack should be opened as a separate issue.
    3) I see no problem with ZoomStack or axis configure on wize-win 3.2

    Maybe you are not setting up the tclIndex file for BLT (to source graph.tcl)?

     

Log in to post a comment.