No, that formula is wrong. I can found at least 2 issues there.Without using Abs, there will be 75% chances the formula gives incorrect resultshttps://www.freepascal.org/docs-html/rtl/system/abs.html
Also as already mentioned, it needs 2 delta values, not summary.It seems the OP is very careless or maybe he need a cup of coffee to boost his concentration.Don't write code when you're unable to concentrate.
The formula looks correct to me.I have a problem with the two loops:Code: Pascal [Select][+][-] for c := 1 to 20 do begin for c2 := 1 to 20 do beginImagine that two circles are touching like circle number 5 and circle number 10. This loop will pass them twice:when c = 5, and c2 = 10when c = 10 and c2 = 5
Quote from: Handoko on December 31, 2017, 02:33:32 pmNo, that formula is wrong. I can found at least 2 issues there.Without using Abs, there will be 75% chances the formula gives incorrect resultshttps://www.freepascal.org/docs-html/rtl/system/abs.htmlHow did you come with that percentage? By my calculations the square of any delta value (positive or negative) will always be the same so abs is only a waste of cpu cycles.
But I still have an issue with the two loops. Taazz can you explain how the direction is changed only once?
We all need a cup of coffee.
Happy New Year 2018
Quote from: Handoko on December 31, 2017, 03:33:31 pm Happy New Year 2018 Happy new year to every one.