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.

Newcomers DBPro Corner / Matrix Boundaries

Author
Message
Mr909
12
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 10th Nov 2012 19:46
So, I'm trying to establish a limiting code that ensures that (relx+x) and (relz+z) doesn't fall off the matrix boundaries. There may be an ARRAY INDEX EXISTS, but there is nothing to determine matrix in-bounds as far as I know, and the current code doesn't seem to adequately check if it is in-bounds.

Basically, I'm grabbing the nearest 5 points and averaging them together against the current, causing the surface to level out.

Previously in the code:



Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 11th Nov 2012 03:20
Not a good way to smooth the surface out. You grab your 5 points, average them, then set the new height. However, when you grab your next point, one of the 5 points it uses will be of the new already averaged height, giving inaccurate smoothing results.

You should store all the heights into a temp array, and when averaging your 5 points you pull the data from that temp array but set the height on the actual matrix.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Mr909
12
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 11th Nov 2012 22:40
Yeah, I was aware of the numeric bias, but it returned all the same.
Using 25 points by the way, not 5. Bias is much more severe there.

I'll give the temp array thing a shot. Thanks for the idea Phaelax.
Mr909
12
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 11th Nov 2012 22:56 Edited at: 11th Nov 2012 23:07
Why is this not compiling correctly? Do I have a bad understanding of what ARRAY INDEX VALID does?




This didn't work either... :\


EDIT: Nevermind, fixed it. Bad IF-AND range-thingy.

Login to post a reply

Server time is: 2024-11-23 18:08:45
Your offset time is: 2024-11-23 18:08:45