[Uml-devel] kdesdk/umbrello/umbrello

Klas Kalass klas.kalass at gmx.de
Wed Mar 19 13:37:08 UTC 2003


Am Mittwoch, 19. März 2003 21:46 schrieb Jonathan Riddell:
> On Wed, 19 Mar 2003, Jonathan Riddell wrote:
>
>
> Sorry Klas, there was another problem I found with your changes to
> linepath so I've reverted to the old version keeping the rint()'s.
> Hopefully you can work out what was wrong.
Argh - I was so sure that hypotenuse could never be 0 so I did not check for 
it. But this is exactly what happens - because the function is called when 
there are no sensible values set yet.

I will commit a new version that catches it after I tested it. 
Note to self: *ALWAYS* secure against devision by zero, even if you are sure 
it cannot happen...

Klas

>
> Jonathan
>
> > CVS commit by jriddell:
> >
> > reverted linepath.cpp to revision 1.4 with rounding rint()
> > This version caused a freeze on creating a diamond headed association
> > (composition etc)
> >
> >
> >   M +4 -7      linepath.cpp   1.8
> >
> >
> > --- kdesdk/umbrello/umbrello/linepath.cpp  #1.7:1.8
> > @@ -8,5 +8,5 @@
> >  
> > *************************************************************************
> >**/
> >
> > -#include <cmath>
> > +#include <math.h>
> >
> >  #include <kdebug.h>
> > @@ -358,7 +358,4 @@ void LinePath::calculateHead() {
> >          int xb = getPoint(size -1).x();
> >          int yb = getPoint(size -1).y();
> > -        double deltaX = xb - xa;
> > -        double deltaY = yb - ya;
> > -        double hypotenuse = sqrt(deltaX*deltaX + deltaY*deltaY); // the
> > length int halfLength = 10;
> >          double arrowAngle = 0.5 * atan(sqrt(3.0) / 3.0);
> > @@ -368,8 +365,8 @@ void LinePath::calculateHead() {
> >                  halfLength += 3;        // longer
> >          }
> > -        double slope = atan2(deltaY, deltaX);   //slope of line
> > -        double cosx = halfLength * deltaX/hypotenuse;
> > +        double slope = atan2(double(yb - ya), double(xb - xa)); //slope
> > of line +        double cosx = halfLength * cos(slope);
> >
> > -        double siny = halfLength * deltaY/hypotenuse;
> > +        double siny = halfLength * sin(slope);
> >          double arrowSlope = slope + arrowAngle;
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Does your code think in ink?
> > You could win a Tablet PC. Get a free Tablet PC hat just for playing.
> > What are you waiting for?
> > http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
> > _______________________________________________
> > Uml-devel mailing list
> > umbrello-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/umbrello-devel
>
> ________________________________________________________
> 4/4 Geddes Court    |  jr at jriddell.org
> Stirling University |  http://www.jriddell.org
> FK9 4LR, Scotland   |  07941 938912
>  Umbrello UML Modeller: http://uml.sf.net

-- 
Geektalk from the Mandrake Cooker mailing list:
 
Subject: Re: [Cooker] What happened to the program "more"?

It was probably replaced with less, which is more or less more, but a bit more 
(a.f.a.i.k). Paul.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/umbrello-devel/attachments/20030319/7bf21d25/attachment.sig>


More information about the umbrello-devel mailing list