Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Vertexdata - different results each time I run program???

Author
Message
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 5th Aug 2012 14:05
ok so Im trying to calculate the furthest vertex from an objects center using the mesh, but Im getting odd changes in results each time I run the executable or code - approx 6 times out of 10 the result is as expected, the other times the results are way out



Ive found that inscreen testing doesnt work 100% with rotated objects(using u7.5) and so instead am using a box object that covers the area of rotation an object can have. Have been using objects Ive created manually but now need to automate the process.

Attached is the mesh

Assuming my code was ok, the only thing I can think of is that its the media - maybe because there are values in the file like "-6.92581e-009", although this doesnt explain why I get different results each time I run the same code, but perhaps why the results are so far out when they arent the expected results..

Even if what I just suggested was true - I dont know how I would get around it - even if I switch to memblocks then surely the same problem would exist? In any case Im at a loss
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 5th Aug 2012 15:56
It's hard to get random results from the same code without any rnd() in the code. When I try to figure out what could be random the only thing I can come up with is Sync Rate 30. Which may be random compared with the sync rate of your screen. I'm just guessing. You start by guessing, and see if it solves anything to make it sync rate 60.

James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 5th Aug 2012 16:09 Edited at: 5th Aug 2012 16:17
well i took distance out to make sure it wasnt that - dont need it anyway

code went to this;


still got same results of differences between running same code/exe using comparison

so just went memblock root with almost the same code;



memblock method works perfect everytime(so far 100 tests)

@pincho, thankyou, have tested various rates and display options vsync - no differences to results


EDIT:
I am just read floating point stuff and not making much sense of it - Significant digits × baseexponent
now those are the types of values I see in mesh data of media, now Im second guessing but is it possible that internally that calculation can produce different results at different times? or do i have this completely wrong?
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 5th Aug 2012 17:27 Edited at: 5th Aug 2012 17:27
i always get the same value except when i get an illegal value which i get because your code is wrong

this


should be this


you don't need "convert mesh to vertexdata 1" and vertex range is from 0 to vertex count-1

James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 5th Aug 2012 17:36
That was it Brendy boy, thanks very much, my error, its even in the helpfile example

Login to post a reply

Server time is: 2026-07-08 05:37:24
Your offset time is: 2026-07-08 05:37:24