Re: error while displaying a line



The fix is very straight forward. All you just is need a simple check
to see if the error will occur and prevent it.  Something like this.

If (y1 == y2)
gtk_databox_set_total_limits(box, x1, x2, y1+margin, y1-margin);
else if (x1 == x2)
gtk_databox_set_total_limits(box, x1-margin, x1+margin, y1, y2);

But like we were saying before what is this margin variable, that's up
to the developer based on the application.

On Fri, Sep 26, 2008 at 12:31 AM,  <z pekar gmail com> wrote:
> I have to have autorescale on that place in my function. For the cases
> when its no longer a line I get no error.
> So where should I use the gtk_databox_set_total_limits? - autorescale
> will anyway internally call the same function with the problematic
> values and cause the warning...
>
> so maybe we should enhance the autorescale function parameters list to
> include 4 more:
> gfloat left,gfloat right,gfloat top,gfloat bottom
> to be used in case when a line is being displayed?
>
> On Fri, Sep 26, 2008 at 10:11 AM, Eric Work <work eric gmail com> wrote:
>> void gtk_databox_set_total_limits (GtkDatabox *box,
>>                                   gfloat left,
>>                                   gfloat right,
>>                                   gfloat top,
>>                                   gfloat bottom);
>>
>> This function is used to set the limits of the total display area of
>> box. This function can be used to invert the orientation of the
>> displayed graphs, e.g. top=-1000 and bottom=0.
>>
>> Side effect: The box also internally calls
>> gtk_databox_set_visible_limits() with the same values.
>>
>> -Eric
>>
>> On Thu, Sep 25, 2008 at 1:13 PM,  <z pekar gmail com> wrote:
>>> how can I set those values manually?
>>>
>>> On Fri, Sep 19, 2008 at 7:24 PM, Eric Work <work eric gmail com> wrote:
>>>> Hey,
>>>>
>>>> I tend to think it would often incorrectly "guess" what the developer
>>>> visually prefers, as with Alexey's example showing zero or not.  Also,
>>>> do you show a range of +/-0.01 or +/-100 around the value?  These
>>>> could be settings, a new struct argument containing bool zero_x, bool
>>>> zero_y, int offset_x, int offset_y, with the default behavior
>>>> undefined (passed a NULL pointer?) resulting in this error.  I feel
>>>> you'd have to overwrite the default behavior quite often.  The
>>>> developer might also benefit from having this error displayed as a
>>>> warning; to possibly indicate an algorithm problem. The developer can
>>>> also handle this error with a trivial if/else statement when they have
>>>> specific needs.  One example: for an oscilloscope the user sets the
>>>> desired volts/div so often you won't autoscale, but if you did
>>>> autoscale it would be to allowable division sizes.
>>>>
>>>> That's my $0.02
>>>>
>>>> -Eric
>>>>
>>>> On Fri, Sep 19, 2008 at 2:25 AM,  <z pekar gmail com> wrote:
>>>>> so maybe some default behavior should be implemented in order to avoid
>>>>> the error output, and if the app. developer doesn't like it - he can
>>>>> always rewrite it.
>>>>>
>>>>> On Fri, Sep 19, 2008 at 11:14 AM, Alexey Shuvaev
>>>>> <shuvaev physik uni-wuerzburg de> wrote:
>>>>>> On Thu, Sep 18, 2008 at 10:04:10PM +0200, Dr. Roland Bock wrote:
>>>>>>> z pekar gmail com wrote:
>>>>>>>> Hello,
>>>>>>>> I get an error while displaying a line (parallel to x-achse; y(x) = c)
>>>>>>>>
>>>>>>>> gtk_databox_set_total_limits: assertion `left != right' failed
>>>>>>>>
>>>>>>>> what could it be?
>>>>>>>> thank you
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> you are probably calling gtk_databox_auto_rescale?
>>>>>>>
>>>>>>> That function calculates
>>>>>>>
>>>>>>> (Pixel_max - Pixel_min)/(Value_max - Value_min)
>>>>>>>
>>>>>>> This fails for a line parallel to the x axis (and would also fail for a
>>>>>>> line parallel to the y axis).
>>>>>>>
>>>>>>> Of course it would be possible to "guess" a useful data range. The
>>>>>>> question is: What is the right heuristic, which seems natural for
>>>>>>> viewers at different values?
>>>>>>>
>>>>>>> Solutions are welcome :-)
>>>>>>>
>>>>>> I don't think one can have a good "guess" for all cases.
>>>>>> For example, when plotting some abstract mathematical function one may
>>>>>> set y_scale = x_scale. On the other hand, in a physics application when
>>>>>> x = time and y = voltage one may want to always include zero (y = 0) in
>>>>>> the graph and to set y scale to full device range if the signal is
>>>>>> a constant zero too.
>>>>>>
>>>>>> So, IMHO, the proper scaling is a responsibility of the application developer
>>>>>> and not the library.
>>>>>>
>>>>>> Just my 0.02$,
>>>>>> Alexey.
>>>>>> _______________________________________________
>>>>>> gtkdatabox-list mailing list
>>>>>> gtkdatabox-list gnome org
>>>>>> http://mail.gnome.org/mailman/listinfo/gtkdatabox-list
>>>>>>
>>>>> _______________________________________________
>>>>> gtkdatabox-list mailing list
>>>>> gtkdatabox-list gnome org
>>>>> http://mail.gnome.org/mailman/listinfo/gtkdatabox-list
>>>>>
>>>>
>>>
>>
> _______________________________________________
> gtkdatabox-list mailing list
> gtkdatabox-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkdatabox-list
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]