XForms: XYplot xmapping report seems to be off.

From: Bill Unruh (unruh@physics.ubc.ca)
Date: Fri Dec 22 2000 - 16:55:24 EST

  • Next message: \\ivind Wikst|l: "XForms: problem with runing fdesign"

    # To subscribers of the xforms list from Bill Unruh <unruh@physics.ubc.ca> :

    Re my previous report of problems with the XYplot callback report of the
    position of the cursor, I have now tried a different tack
    and am trying to use a positioner object to
    choose a screen location. I overlay the positioner on the XYplot (
    giving both the same size-- 600x220, and the same starting location) and
    am using the
    fl_get_xyplot_xmapping function to return a and b for the translation.
    But the reported value of "a" seems to be too large by about .7% ( which
    corresponds to about 5 pixels on a 600 pixel screen)

    To give the relevant code fragments:

    From the fdesign generated form.c

      fdui->xyplotgr = obj = fl_add_xyplot(FL_NORMAL_XYPLOT,100,40,600,220,"");
        fl_set_object_boxtype(obj,FL_DOWN_BOX);
        fl_set_object_color(obj,FL_WHITE,FL_BLUE);
        fl_set_object_lalign(obj,FL_ALIGN_TOP|FL_ALIGN_INSIDE);
      fdui->positioner = obj = fl_add_positioner(FL_OVERLAY_POSITIONER,100,40,600,220,"");
        fl_set_object_callback(obj,position,0);
        fl_set_positioner_xvalue(obj, 0.001);
        fl_set_positioner_return(obj, FL_RETURN_END_CHANGED);

    I plot a graph (no x axis markers)
       fl_set_xyplot_xtics(ui->xyplotgr,-1,-1);
       for(i=0,i<1024;i++)
         {
           x[i]=i;
           y[i]= sin(i/200);
         }
       fl_set_xyplot_data( ui->xyplotgr,x,y,1024);

    Then I readback in the positioner
    void position(FL_OBJECT * positioner, long val)
     {
       float y0,xo, xp,a,bi,cx,cy,w,h,fudge ;
       xp=fl_get_positioner_xvalue(ui->positioner);
       y0=8.;
       fl_get_xyplot_xmapping(ui->xyplot,&a,&b);
       fl_get_object_geometry(ui->positioner,&cx,&cy,&w,&h);
       fudge=1.;
       x0= fudge*((xp*w +h-b)/a)*1023;
       y0=8;
       fl_set_xyplot_overlay_type(ui->xyplotgr,1,FL_IMPULSE_XYPLOT);
       fl_add_xyplot_overlay(ui->xyplotgr,1,xo,yo,1,FL_RED);
    }

    While the vertical line drawn agrees with the position
    if the positioner near the origin (x=0) for all values of fudge, it
    disagrees more and more with fudge=1. Only if I set fudge=.993 does it
    seem to agree well all across the scale (I have not tried to fine tune
    that.993-- it is accurate to about 1 pixel across the 600 pixel screen)
     For fudge=1, it is out by about 4 or 5 pixels at the high end of the
     scale (which is certainly visible on the screen).

    Note that this would seem to imply that the value of "a" delivered by the
    xmapping call is out (too low) by about .7%

    (Again, this is on Mandrake 6.1, xforms .89, XFree 3.3.5, 1024x767 video
    card resolution).

    Another question about the positioner. I have it as an overlay over the
    xygraph. When I redraw the xygraph, the positioner seems to get
    overwritten. and disappers from the screen. When I click again with the
    mouse, it reappears, but with both the new cross hairs (at the position
    of the cursor) and the old cross hairs( at the old position of the
    cursor before the redraw).

    -- 
    William G. Unruh	Canadian Institute for		Tel: +1(604)822-3273
    Physics&Astronomy	   Advanced Research		Fax: +1(604)822-5324
    UBC, Vancouver,BC	 Program in Cosmology		unruh@physics.ubc.ca
    Canada V6T 1Z1		     and Gravity	http://axion.physics.ubc.ca/
    For step by step instructions about setting up ppp under Linux, see
                  http://axion.physics.ubc.ca/ppp-linux.html
    

    _________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuhs.mil or see http://bob.usuhs.mil/mailserv/xforms.html XForms Home Page: http://world.std.com/~xforms List Archive: http://bob.usuhs.mil/mailserv/list-archives/



    This archive was generated by hypermail 2b29 : Fri Dec 22 2000 - 17:00:01 EST