Subject: Re: Beziergon Bounding Box Broken and other Bugs
Date: Thu, 14 Jun 2001 19:56:07 +0200
At 13:30 14.06.01 +0200, Cyrille Chepelov wrote:
>Le mer, jun 13, 2001, à 01:00:40 +0200, Hans Breuer a écrit:
>
>> recent CVS doesn't allow to draw Beziergons anymore - most of
>> the time. There are only some few angles for the control lines
>> which give a visible outline.
>>
>> Bezier lines are drwan more often but there are modes which
>> make them dissappear as well, e.g. a straight vertical line
>> or a sharp rectangular edge build with a three point bezier.
>>
>
>Hans,
>
> this is a bit embarrassing ; this happens precisely the day when I
>have real work to do :-(. I've tried in a hurry to reproduce the problem,
>but failed (here are a few attempts).
>
> On what platform does the problem happen ? Win32 ?
Yepp, my favourite :)
>I hope it's not a
>porting bug (especially -lm issues). Without going as far as diving into the
>code, perhaps you can spot places where I used non-portable math code in
>lib/boundingbox.c? Can you also send me problematic samples (in .dia form) ?
>
the following patch fixes - or better works around the problem.
Doing a normalization of (0,0) vector gave the interesting behaviour.
What do you think the 'portable' result of 0/0 should be ?
Hans
--- from-cvs/dia/lib/geometry.h Sat May 26 09:37:26 2001
+++ my-gtk/dia/lib/geometry.h Thu Jun 14 18:55:42 2001
@@ -138,8 +138,14 @@
len = sqrt(p->x*p->x + p->y*p->y);
- p->x /= len;
- p->y /= len;
+ if (len > 0.0) {
+ p->x /= len;
+ p->y /= len;
+ } else {
+ p->x = 0.0;
+ p->y = 0.0;
+ }
+
}
#endif
-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it. -- Dilbert