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 Discussion / The Gaussian function - need help

Author
Message
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 6th Jul 2008 22:44
Hello

I got this function from the internet(at least the maths for it), and it just wont work! It`s supposed to make a dint in a matrix, as if you bounce a ball onto a piece of cloth.

Here are some screenies:

This is what it should look like, only a little rounder at the top:


If I change the "spread" value from one(above) to 2, I get these stupid flat spaces:


And if I change "spread" to a higher number, like 5, I get even bigger flat spaces:


I need these flat spaces to smooth out!

here`s the code:



and this is how I use the function:



Any help will be greatly appreciated

TheComet

BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 7th Jul 2008 06:47
Ok I just made it work so here is the solution:

make these variables into floats:
1.spread
2.xterm
3.yterm

That should make it work, it did for me

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
NanoGamez guy
18
Years of Service
User Offline
Joined: 13th Jan 2007
Location: Closer than you think...
Posted: 7th Jul 2008 10:17
Actullay, I think you need to turn all the variables into floats, because I don't think you can return a decimal value when you use and integar in the calculations.


Did you know - 12% of Americans believe Joan of Arc was Noah's wife.
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 7th Jul 2008 16:18
Thanks! It worked perfectly!



TheComet

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 8th Jul 2008 04:28
@TheComet

This is great, TheComet! With some modification, maybe it could lend itself towards some cloth or water physics:



Enjoy your day.
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Jul 2008 11:28
Yep! If you look in the DBC challenge thread tomorrow, I will have something like that posted there for the physics challenge!

Now I`m scared that I will have a competitor, since you got the hang of my function! Anyway, if that`s so, do something with liquid, because I have made balls jump around on cloth, and it would be sad if you made the same thing...

Good luck!

TheComet

Login to post a reply

Server time is: 2025-06-07 06:38:59
Your offset time is: 2025-06-07 06:38:59