I need some math help with a project that is being done - my maths seems to have deserted me
I am trying to determine a formula to work out a snap to grid system for this project. I'm working at zoom 3 in SC4, giving me a 1x1 tile that is 22 pixels wide by 14 pixels high. The problem lies in the fact that the othographic projection in SC4 is at 32.5 degrees which means that there is no simple gridding system and it's going to have to be mathematical, and I just can't get my tired out brain cells around it. I need a formula that says:
if x is at such and such and y is at such and such then the nearest grid snap point is at x1 and y1.
I'm sure in the fullness of time I could work it out, but the brain is crying out STOP!!!!
Any help would be greatly appreciated,
Quote from: Pat on January 26, 2008, 03:38:34 PM
I need some math help with a project that is being done - my maths seems to have deserted me
I am trying to determine a formula to work out a snap to grid system for this project. I'm working at zoom 3 in SC4, giving me a 1x1 tile that is 22 pixels wide by 14 pixels high. The problem lies in the fact that the othographic projection in SC4 is at 32.5 degrees which means that there is no simple gridding system and it's going to have to be mathematical, and I just can't get my tired out brain cells around it. I need a formula that says:
if x is at such and such and y is at such and such then the nearest grid snap point is at x1 and y1.
I'm sure in the fullness of time I could work it out, but the brain is crying out STOP!!!!
Any help would be greatly appreciated,
Im not sure what you are asking for here bud... Are you talking about creating a BAT? If so the best way I would suggest is BAT the model with no rotation and then rotate it 32.5 degrees before rendering it..
x1 = Int((x/22)+.5)*22
y1 = Int((y/14)+.5)*14
ty Becca.... Jp what is trying to be done is not a bat but sorta like a simulation ;)
Quote from: Pat on January 26, 2008, 10:47:59 PM
ty Becca.... Jp what is trying to be done is not a bat but sorta like a simulation ;)
I like simulators... I get interested about simulators...
mmmmmmm simulation.... any more than that Pat?
PAt, you are very welcome. I have used that formula quite often, writing windows programs.
JP, Joe, and Becca: Thank you all and yes if you would like to know more about what the SIMulator is about just check in on at SimCities (http://www.simcities.com/forum/) and if you all would like to help out some more just drop Mike a PM about it and I think he might and would love the help as he is starting to look like sooo..........
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg244.imageshack.us%2Fimg244%2F595%2Fithinkthisisitvq7.jpg&hash=ff6480ee042cd0995005158d27f1e1a0241c6c8c)
so here will be my 0.02€ for that, SC4 angle is "around" 32.5°, and "around" depend on the zoom level