Code Comments
Programming Forum and web based access to our favorite programming groups.Hi all, I know what I want to do, but don't know how to go about it! My problem: I have two arrays containing height data. The first array contains relative heights measured in the x-direction. Essentially, I'm measuring the heights along strips of a surface, but have n o idea of zero height for any of the strips. The heights in any one row are correct relative to each other. However, ther e is no established relationship between the heights in row 1 and the height s in row 2. eg row 1: 2, 3, 5, 7 row 2: 6, 7, 9, 11 row 1 and 2 have the same height variation along the rows but I have no idea whether row 2 is actaully 4 units above row 1 or not. The 2nd array contains strips of height data measured in the y-direction. Ag ain, elements along a row are correct relative to each other, but between ro ws there is no established relationship. I should be able to use the y-height values to establish the x-height off se ts or vice versa. However, due to small errors, this is not the case and dep ending on the path taken (ie use y heights to correct x-heights or vice vers a) I get differing surfaces
Post Follow-up to this messageHi GrahamG, Thanks for your reply and interest. I haven't got a code written for this bu t I have a pseudo algorithm written (if you can call it that!). I was thinking a "random walk" method would work best. If I have the actual 6 x 4 height field as shown below: 0 0 2 4 5 6 1 1 4 6 6 7 2 3 4 5 6 7 2 2 5 5 7 8 In my measurements I get the X-heights: heights along a row are correct rela tive to elements in that row 1 1 3 5 6 7 2 2 5 7 7 8 6 7 8 9 10 11 -1-1 2 2 4 5 and Y-heights: heights in a column are correct relative to elements in that column. 3 1 2 0 4 -1 4 2 4 2 5 0 5 4 4 1 5 0 5 3 5 1 6 1 Start with an empty array, choose start point and enter into array. So if I start with element row 2, col 2 in th X data: height = 8. (rows and columns numbered 0->5 and 0->3) start point (2,2) height= 8 move to next adjacent point in vertical or horizontal direction to star t point (not diagonal) choice of (1,2), (3,2), (2,1), (2,3). choose (1,2) as move in vertical direction check the relation in the Y-data between (2,2) and (1,2): Y (1,2) h=4, Y (2,2) h= 4 =>dh =0 therefore height (1,2) =8+dh =8+0=8 move to next adjacent point in vertical or horizontal direc tion to point (1,2) choose (1,3) as move in horizontal direction check relation in X-data between (1,2) and ( 1,2) X(1,2) h=5, X(1,3) h=7 =>dh = +2 therefore height (1,3) = 8+dh=8+2=10 repeat until all points have been adjusted (keep track with another arr ay?) This gives the correct relative heights for all points along columns an d rows. following the above pseudo algorithm would get 4 4 6 8 9 10 5 5 8 10 10 11 6 7 8 9 10 11 6 6 9 9 11 12 each point is 4 greater than actual but relatively correct. Now that I have written it out like this it becomes a bit clearer for me! and will try to implement this solution. In the meantime any help gladly accepted.
Post Follow-up to this messageThat was a really good explanation and it seems as though you have a gr eat idea of how to work on it from here. So as to save us both working on th e same problem in parallel, if you are a little more confident now I would r ecommend that you have a fi rst attempt and if you get to a stage where you are not sure where to procee de then post it up here and I shall take a look. At the stage of your applic ation that you are now, you are the expert with your algorithm but once you have something, whethe r it works or not, post it up and then two minds debugging it are better tha n one. I should be happy to help. best regards
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.