Re: XForms: xyplot problem

T.C. Zhao (tc_zhao@yahoo.com)
Thu, 1 Oct 1998 21:33:06 -0700 (PDT)

# To subscribers of the xforms list from "T.C. Zhao" <tc_zhao@yahoo.com> :

Interesting problem. This might be a problem that has no
solution. If you look at the data carefully, once the data
is mapped into pixel space, the derivative at each point
is more than 5,000, i.e., vertical lines. (sin(0) is 0,
sin(1) is about 0.85. You want to map -0.001 to y=10 and
-0.001 to about y=200 pixels, this means at point 0 (sin(0),
y is about 100, at point 1 (sin(1)), y is about -75,000, i.e.,
way outside the window. If you try to draw such a line
(0,100) to (10,75000), you'll get a vertical line). This
has nothing to do with precision.

The above said, xforms might've been responsible for triggering
the server bug in that xforms did not clamp the converted
coordinates that wrapped to within (0,2^16-1). I am not sure xforms
should. Clamping -75000 to 0 introduces too much error and the
resulting plot looks crappy anyway.

-75000 to 0 modifies the

---moini@eleceng.adelaide.edu.au wrote:
>
> # To subscribers of the xforms list from
moini@eleceng.adelaide.edu.au :
>
> Hi,
> When I use xyplot and try to zoom in the Y direction, I see many
vertical
> lines appearing. If I continue zooming then I will see thousands of
line.
>
> The really BIG problem is that if I doublebuffer the xyplot or its
form,
> the whole Xserver crashes.
>
> Here comes a file that simulates the problem. Unfortunately, with
this file
> I couldn't crash my Xserver!!
>
> My application heavily relies on the performance and reliability of
the
> xyplot, and I would really like to see it without major problems.
>
> Thanks
> Ali
> /****************************************************************/
> #include "forms.h"
> #include <math.h>
> #include <stdlib.h>
> /** Header file generated with fdesign on Fri Oct 2 10:14:31 1998.**/
>
> #ifndef FD_xy_h_
> #define FD_xy_h_
>
> /** Callbacks, globals and object handlers **/
>
>
> /**** Forms and Objects ****/
> typedef struct {
> FL_FORM *xy;
> void *vdata;
> char *cdata;
> long ldata;
> FL_OBJECT *xy1;
> FL_OBJECT *xy2;
> } FD_xy;
>
> extern FD_xy * create_form_xy(void);
>
> #endif /* FD_xy_h_ */
> /* Form definition file generated with fdesign. */
>
>
> FD_xy *create_form_xy(void)
> {
> FL_OBJECT *obj;
> FD_xy *fdui = (FD_xy *) fl_calloc(1, sizeof(*fdui));
>
> fdui->xy = fl_bgn_form(FL_NO_BOX, 320, 550);
> obj = fl_add_box(FL_UP_BOX,0,0,320,550,"");
> fdui->xy1 = obj = fl_add_xyplot(FL_NORMAL_XYPLOT,10,20,300,220,"");
> fdui->xy2 = obj = fl_add_xyplot(FL_NORMAL_XYPLOT,10,290,300,220,"");
> fl_end_form();
>
> fdui->xy->fdui = fdui;
>
> return fdui;
> }
> /*---------------------------------------*/
>
>
> static FD_xy *F;
> #define N 100
>
> int
> main(int argc, char *argv[])
> {
> int i, j;
> float tmp_f=0;
> float x[N];
> float y[N];
>
> fl_initialize(&argc, argv, "FormDemo", 0, 0);
> F=create_form_xy();
>
> for(i=0;i<N;i++){
> x[i]=i;
> y[i]=sin(i);
> }
>
> /* make sure double buffer also works */
>
> fl_show_form(F->xy, FL_PLACE_ASPECT, FL_TRANSIENT, "XYplot");
> fl_set_xyplot_data(F->xy1, &tmp_f, &tmp_f, 1, "", "", "");
> fl_set_xyplot_data(F->xy2, &tmp_f, &tmp_f, 1, "", "", "");
>
> fl_set_object_dblbuffer(F->xy1, 1);
> fl_set_object_dblbuffer(F->xy2, 1);
> fl_add_xyplot_overlay(F->xy1,1,x,y,N,FL_RED);
> fl_add_xyplot_overlay(F->xy2,1,x,y,N,FL_RED);
> fl_set_xyplot_linewidth(F->xy1, 1, 2);
> fl_set_xyplot_linewidth(F->xy2, 1, 2);
> fl_set_xyplot_overlay_type(F->xy1,1,2);
> fl_set_xyplot_overlay_type(F->xy2,1,2);
> fl_set_xyplot_xbounds(F->xy1,0.0,(float)N);
> fl_set_xyplot_xbounds(F->xy2,0.0,(float)N);
> fl_set_xyplot_ybounds(F->xy2,-1.E-3,1.E-3);
>
>
>
> while (1){
> fl_do_forms();
> }
> return 0;
> }
>
>
>
> _________________________________________________
> To unsubscribe, send the message "unsubscribe" to
> xforms-request@bob.usuf2.usuhs.mil or see
> http://bob.usuf2.usuhs.mil/mailserv/xforms.html
> XForms Home Page: http://bragg.phys.uwm.edu/xforms
> List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/
>
>

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at /cgi-bin/exit-to?http://mail.yahoo.com

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/