sakura_chan 9 Posted February 11, 2009 I'm terrible at math, but I need to figure this out. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> format: [x,y,z] getpos'd array 1 = [300, 1200, 50] getpos'd array 2 = [400, 1600, 40] find x and z [ x, 1400, z ] I need to interpolate the equation between the first two arrays. I have no idea how to do this, math really is a limit for me. Any equations or math links would be appreciated! Share this post Link to post Share on other sites
soul_assassin 1750 Posted February 11, 2009 so in ur case x = 300+(1400-1200)*((400-300)/(1600-1200)) = 350 and z = 50+(1400-1200)*((40-50)/(1600-1200)) = 45 Edit: 1550th post Share this post Link to post Share on other sites
sakura_chan 9 Posted February 11, 2009 thanks for the quick reply! Its working now Share this post Link to post Share on other sites
soul_assassin 1750 Posted February 11, 2009 you can also of course make it abstract: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> array 1 = [300, 1200, 50] array 2 = [400, 1600, 40] intkey = 1400 x = array1[0] + (intkey - array1[1])*((array2[0]-array1[0])/(array2[1]-array1[1])) z = array1[2] + (intkey - array1[1])*((array2[2]-array1[2])/(array2[1]-array1[1])) this way all u have to do is change the arrays and the intkey and the interpolation will happen automatically. NOTE: This is NOT ArmA sqs or SQF syntax but rather pseudocode. Try looking up getting array values I think its somethig like (array1 select 1). Share this post Link to post Share on other sites
sakura_chan 9 Posted February 12, 2009 okay I got it all syntaxed and working. I'm using it to interpolate range data from a range table. Thanks again Share this post Link to post Share on other sites