php - Overlayed angled axis limits -
first off, isn't of programming question (syntax , such), me trying figure out issue). apologize if isn't right area, or right site. record, being calculated in php, data gotten sql database. i've been working on map system x-y coordinate system, however, way laid out in 'cells', organized on larger scale standard grid system (right x+, y+) tricky part, actual 'contents' laid out x , y axis on angle, making general idea this:
the red lettering shows "cell coordinates" (marked solid black outlines)
the black lettering inside 'cells' content coordinates. cell 0,0 starts content 0,0, , cell 0,1 starts 5,5 way shows in product (cell outlined--ignore mis-matched river tiles) positioning staggered overlap appearance. in product y axis runs diagonal, , x axis runs perpendicular.
i know find content coord 'root' coord (relative 0,0) goes this:
$contentrootx=($cellx+$celly)*5; $contentrooty=($celly-$cellx)*5;
my issue coming in, when i'm trying find cellx , celly when given set of coordinates. unless brain abandoning basic algebra , equations... cant solve cellx without celly why i've come here: have solution, or simple workaround able calculate cell's x , y.
side note: have tried equation simplification, resulting in cellx=(x-5y)/26 ... return decimal every time, , no matter how round (middle round, ceil, floor), return invalid x response. examples:
2,-3 (should return cellx=0). 0.653. valid action floor 0 if floor result, 0,10 exception: -1.923 (should round 1)....even in same cell, result require rounding down....so standard equations aren't providing info can work with... if can find pattern in values returned equation, , find way distinguish between when must round down , up, lemme know
so you're working 2 primary parts: "cell coordinates" , "content coordinates". me, seems rather confusing because using (x,y) system both cells , content same can create potential problems. need separate two. example, have letters (a,b,c,d) cell coordinates , numbers content coordinates. although, on second thought, doesn't seem necessary have both @ all. whether should keep both depends on reasoning using them in first place.
the first chart provided inaccurate, hope it's example explain method solving problem. cell locations incorrect. if cell coordinates incorrect, nothing else make sense. digress.
i think question circular: "when i'm trying find cellx , celly when given set of coordinates... cant solve cell x without cell y"
well...when you're "given set of coordinates" don't have information need? if true question "how locate set of coordinates using different set of coordinates?" that's different question. if that's question, answer other question - depends on if desired coordinates located differently both on x , y axis. if desired cell (the cell you're looking for) in 1 direction, need 1 coordinate given system. example, if tell drive north (latitude) 5 miles in car, don't need know east/west (longitude)...because you're driving north.
it looks me need make sure charting system solid. if you're charting system off doesn't matter coordinates have. practice plotting points on graph paper , calculating "slope" did in high-school. using formula finding slope figure stuff out.
btw - i'm not expert on stuff means , don't have experience in gaming industry (programming, anyway). however, program , studied fair amount of calc in college.
Comments
Post a Comment