Home
Products
Community
Manuals
Contact
Login or Signup

Code archives/3D Graphics - Maths/SuperFloor and SuperCeil

This code has been declared by its author to be Public Domain code.

Download source code

SuperFloor and SuperCeil by Weijtenburg(Posted 1+ years ago)
I invented 2 new functions, basicly its a Floor and Ceil function but you can specify the size and it works with ints. This comes in handy when you work with grids or anything below the 0 where negative number, when divided, truncate towards 0. This proccess can so be manipuled in a legal way.
Function SuperFloor:Int(val:Int, size:Int) 
	Return val - Abs(val Mod size) 
End Function

Function SuperCeil:Int(val:Int, size:Int) 
	Return val + Abs(val Mod size) 
End Function

Comments

Koriolis(Posted 1+ years ago)
EDIT: removed. You modified your code so my reply looks out of place now. Obviously I was talking about the version with loops. And BTW did YOU test what I suggested. It appears you didn't.


Weijtenburg(Posted 1+ years ago)
Did you test that? cause it aint working here. See, there have been 101 theories. So far only this approach that worked.


Code Archives Forum