Coordinate values

If you are having problems with QCAD version 3, post here. Please report bugs here.

Moderator: andrew

Coordinate values

Postby MiHeGo » Thu Apr 26, 2012 3:48 pm

Apparently, QCAD 3 converts some coordinates to different value. All my drawings are in millimeter drawing and paper units and I usually specify coordinates with integer values in Q2, like Start Point : X=300 Y = 200 and End Point : X=300 Y =3110.
Now this same line, unmodified, gets the following coordinates in Q3 : Start Point : X=299.999936 Y = 200 and End Point : X=299.999936 Y =3110.000006.
Is it possible to avoid these unexpected differences.
MiHeGo
Active Member
 
Posts: 26
Joined: Tue Dec 08, 2009 12:19 pm

Re: Coordinate values

Postby andrew » Thu Apr 26, 2012 4:15 pm

When are these coordinate changes happening?
- after saving in QCAD 2 / loading in QCAD 3
- after saving / loading in QCAD 3
- directly after drawing

I cannot reproduce this problem but I can imagine that the inaccuracy was already present in the QCAD 2 file (you might find those values in the DXF file with a text editor).
Note that the QCAD 3 property editor shows more decimals than the QCAD 2 property editor, so these errors might not have been so visible in QCAD 2.

There are generally three reasons for these errors:
- Small errors introduced when scaling entities up and down or rotating them (see also third point).
- File format restrictions: QCAD 2 DXF files are stored with only 6 decimals for compatibility reasons (QCAD 3 stores all values with 12 decimals).
- Computers cannot represent all values (not even finite decimals) internally due to the way how they store numbers (long story, Google knows all about it :wink:). For example the exact value of '2.3' will always include an error. The closest representable number for a computer is 2.2999999999999998.
User avatar
andrew
Site Admin
 
Posts: 2568
Joined: Fri Mar 30, 2007 6:07 am

Re: Coordinate values

Postby MiHeGo » Thu Apr 26, 2012 5:44 pm

Logged off before I could submit my completely typed reply ! :evil:
MiHeGo
Active Member
 
Posts: 26
Joined: Tue Dec 08, 2009 12:19 pm

Re: Coordinate values

Postby andrew » Thu Apr 26, 2012 7:33 pm

MiHeGo wrote:Logged off before I could submit my completely typed reply ! :evil:


This shouldn't happen as cookies (sessions) are set to expire in a year. Tip: In most decent browsers you can simply hit back and rescue your content.
User avatar
andrew
Site Admin
 
Posts: 2568
Joined: Fri Mar 30, 2007 6:07 am

Re: Coordinate values

Postby MiHeGo » Fri Apr 27, 2012 9:24 am

To-day, I was again logged off while typing my reply... But now as I saved my text, I could paste it in a new reply. Then I used the "Save Draft" button but now I have to investigate where to retrieve it (or delete it as I can again paste my text).

I'm replying to Andrew comments on coordinates in a next Post.
MiHeGo
Active Member
 
Posts: 26
Joined: Tue Dec 08, 2009 12:19 pm

Re: Coordinate values

Postby MiHeGo » Fri Apr 27, 2012 9:57 am

andrew wrote:When are these coordinate changes happening?

As soon as I opened a copy of a Q2 file withQ3.

andrew wrote:...I can imagine that the inaccuracy was already present in the QCAD 2 file

Actually, most of my values were typed as integer, some times at most with 2 decimals. If I change in Q3 a value like "281,999967" into a "281" and save the file, close Q3 and reopen the file, the integer value is there as "281" and not some "281,000000" and not scaled or adjusted to some internal number. What Q3 can do when processing its values, why is it impossible when opening a Q2 file ?

andrew wrote:- Small errors introduced when scaling entities up and down or rotating them...

I totally agree, also when extending a line until it crosses some other lines. But not when it comes about values entered at the keyboard.
What matters here is that all other entities touching an entity for which I change a value, must also be changed. Otherwise, you will get problems for instance when hatching an area. I guess 2 adjacent lines must have the same coordinates for the junction point including up to the 6the decimal ... or the 12th ???

andrew wrote:- Computers cannot represent all values (not even finite decimals) internally due to the way how they store numbers

Sorry, this time, I have to completely disagree with that position. As a professsional programmer for 40 years (and more to come), I had never a problem storing and retrieving integer values or fixed decimals ones. Merely a matter of selecting the right data type.
For instance an Ariane missile was lost because some internal routines were using 64-bits arithmetic and values where others were using 128-bits precision.
Simply, would you accept to receive a payement of an amount of 23,99 swiss Francs (QCAD 3 update) instead of 24,00 SWF ? Or a salary of approximately 4.999,98 € instead of 5.000,00 € ?
MiHeGo
Active Member
 
Posts: 26
Joined: Tue Dec 08, 2009 12:19 pm

Re: Coordinate values

Postby andrew » Fri Apr 27, 2012 10:22 am

MiHeGo wrote:
andrew wrote:...I can imagine that the inaccuracy was already present in the QCAD 2 file

Actually, most of my values were typed as integer, some times at most with 2 decimals. If I change in Q3 a value like "281,999967" into a "281" and save the file, close Q3 and reopen the file, the integer value is there as "281" and not some "281,000000" and not scaled or adjusted to some internal number. What Q3 can do when processing its values, why is it impossible when opening a Q2 file ?


As previously mentioned: the error is very likely there already in the QCAD 2 file. QCAD 3 cannot possibly guess that 281,999967 is not exactly what you want.

MiHeGo wrote:
andrew wrote:- Computers cannot represent all values (not even finite decimals) internally due to the way how they store numbers

Sorry, this time, I have to completely disagree with that position. As a professsional programmer for 40 years (and more to come), I had never a problem storing and retrieving integer values or fixed decimals ones. Merely a matter of selecting the right data type.
For instance an Ariane missile was lost because some internal routines were using 64-bits arithmetic and values where others were using 128-bits precision.
Simply, would you accept to receive a payement of an amount of 23,99 swiss Francs (QCAD 3 update) instead of 24,00 SWF ? Or a salary of approximately 4.999,98 € instead of 5.000,00 € ?


I'm not talking about integers or your specific case but finite decimals in general (2.3, 0.1, ..). Maybe you're still willing to learn something new?
http://en.wikipedia.org/wiki/Floating_p ... y_problems

[Edit: the financial world has ways of dealing with this. Highly off-topic and not my beer..]
User avatar
andrew
Site Admin
 
Posts: 2568
Joined: Fri Mar 30, 2007 6:07 am


Return to QCAD 3 Troubleshooting and Problems

Who is online

Users browsing this forum: No registered users and 1 guest