Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I load ellips.txt file using ellipse fitting algorithm.
But different results occurred debug and release mode.

Release :
centre X 247.47
centre Y 165.47
major axis 0.0 <- I think this is wrong
minor axis 0.0 <- I think this is wrong
rotation 2.25

Debug :
No solution. Cannot invert matrix.

I compiled win32 at VS2017 (v141), Windows 10.

What's wrong?

ellipse.txt file is ... ----------------
178
208.0,1.0
200.0,4.0
192.0,8.0
184.0,11.0
176.0,17.0
168.0,24.0
161.0,31.0
154.0,39.0
149.0,47.0
144.0,55.0
140.0,63.0
136.0,71.0
134.0,79.0
132.0,87.0
131.0,95.0
130.0,103.0
129.0,111.0
129.0,119.0
130.0,127.0
130.0,119.0
132.0,111.0
138.0,103.0
145.0,95.0
153.0,87.0
160.0,80.0
166.0,73.0
173.0,67.0
174.0,70.0
167.0,78.0
163.0,86.0
158.0,94.0
155.0,102.0
154.0,110.0
153.0,118.0
152.0,126.0
152.0,134.0
153.0,142.0
155.0,150.0
157.0,158.0
161.0,166.0
165.0,174.0
170.0,182.0
178.0,190.0
186.0,197.0
194.0,202.0
202.0,206.0
210.0,209.0
218.0,211.0
226.0,212.0
234.0,213.0
242.0,213.0
250.0,212.0
258.0,211.0
266.0,209.0
274.0,207.0
282.0,204.0
290.0,200.0
298.0,195.0
306.0,189.0
313.0,181.0
319.0,173.0
325.0,165.0
328.0,157.0
331.0,149.0
334.0,141.0
335.0,133.0
336.0,125.0
336.0,117.0
335.0,109.0
333.0,101.0
331.0,93.0
327.0,85.0
323.0,77.0
317.0,69.0
313.0,61.0
314.0,54.0
320.0,51.0
328.0,59.0
333.0,67.0
337.0,75.0
341.0,83.0
343.0,91.0
345.0,99.0
346.0,107.0
346.0,115.0
346.0,123.0
345.0,131.0
343.0,139.0
341.0,147.0
339.0,155.0
335.0,163.0
331.0,171.0
326.0,179.0
320.0,187.0
313.0,195.0
305.0,202.0
297.0,208.0
289.0,213.0
281.0,216.0
273.0,219.0
265.0,222.0
257.0,224.0
249.0,224.0
241.0,225.0
233.0,225.0
225.0,224.0
217.0,223.0
209.0,222.0
201.0,219.0
193.0,217.0
185.0,212.0
177.0,207.0
169.0,202.0
161.0,195.0
154.0,187.0
147.0,179.0
142.0,171.0
138.0,163.0
135.0,155.0
133.0,147.0
131.0,139.0
131.0,143.0
133.0,151.0
135.0,159.0
138.0,167.0
141.0,175.0
145.0,183.0
150.0,191.0
155.0,199.0
161.0,207.0
168.0,215.0
175.0,222.0
183.0,228.0
191.0,234.0
199.0,238.0
207.0,241.0
215.0,243.0
223.0,246.0
231.0,247.0
239.0,248.0
247.0,248.0
255.0,248.0
263.0,247.0
271.0,245.0
279.0,243.0
287.0,240.0
295.0,236.0
303.0,231.0
311.0,225.0
319.0,218.0
326.0,210.0
333.0,202.0
337.0,194.0
341.0,186.0
344.0,178.0
347.0,170.0
348.0,162.0
350.0,154.0
351.0,146.0
352.0,138.0
353.0,130.0
353.0,122.0
354.0,114.0
353.0,106.0
353.0,98.0
352.0,90.0
350.0,82.0
347.0,74.0
344.0,66.0
341.0,58.0
337.0,50.0
332.0,42.0
325.0,34.0
318.0,26.0
310.0,19.0
302.0,14.0
294.0,8.0
286.0,4.0


What I have tried:

The ellipse.txt coord resembles a donut shape.
And, I think debug mode is right, release mode is wrong.
If release mode is correct, it should print major, minor axis value.
Posted
Updated 11-Oct-22 22:27pm
v2
Comments
OriginalGriff 12-Oct-22 4:17am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with - we get no other context for your project.
Imagine this: you go for a drive in the country, but you have a problem with the car. You call the garage, say "it broke" and turn off your phone. How long will you be waiting before the garage arrives with the right bits and tools to fix the car given they don't know what make or model it is, who you are, what happened when it all went wrong, or even where you are?

That's what you've done here. So stop typing as little as possible and try explaining things to people who have no way to access your project!

Without your code or any idea of your settings, we can't even begin to guess!
Use the "Improve question" widget to edit your question and provide better information.
charlieg 12-Oct-22 6:29am    
In all my years of developing software, the most common reason for debug/release behavioral differences is initialization. The debugger will typically help you in this area. Read up on increasing your warning levels when compiling. Let the compiler help you.
Rick York 12-Oct-22 11:03am    
How can debug mode be right when it fails to invert the matrix?

The fact is we can't help with anything when we can't see your code.

1 solution

A typical error that causes a difference between Debug and Release is the use of ASSERT. In the Debug build, ASSERT executes what you write between the parentheses, and if it evaluates to something that is equivalent to FALSE, a breakpoint is triggered. (The purists have a more sophisticated explanation, but this one will do for the moment.) In the Release build, ASSERT translates to simply nothing.

For example, assuming a function like
C++
bool InvertMatrix(/* some parameters */)
{
   //some useful code
}

which returns 'true' in case of success, and later you write
C++
ASSERT(InvertMatrix(...));

then InvertMatrix is executed in the Debug build, and if it doesn't return 'true' your program will break into the debugger.
In the Release build however, InvertMatrix is not even called.
The solution is to use VERIFY instead of ASSERT. VERIFY and ASSERT are MFC specific macros. See also here: Using VERIFY Instead of ASSERT | Microsoft Learn[^].
 
Share this answer
 
Comments
CPallini 14-Sep-23 5:45am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900