igmeou Posted March 17, 2005 Posted March 17, 2005 Hi, I know that I can use 2 for loops to draw a 2 dimension grid line. something like this: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 But is there any way to draw a diamond shape grid line something like this: 00100 01010 10101 01010 00100 Sorry that I can't describe what I meant exactly but is general a 45 degree rotation of a normal 2 dimensional grid. Hope your get what I meant. [font="Arial"]Thanks[/font]If @error = me Then $sorry Else Do $clarifyMe Until $meClear EndIF MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever)
jdickens Posted March 18, 2005 Posted March 18, 2005 (edited) There's prob. a few ways. Depends what you're "drawing" to. 0) Make all locations = 0 1) Find middle column (mc) of first row: DiamondRA[1,mc] = 1 2) For CurR = 2 to middle row (mr) do: for CurC = mc-CurR to mc+CurR do: If IsOdd(CurC) then DiamondRA[CurR, CurC] = 1 3) DiamondRA[LastR, mc] = 1 4) For CurR = LastR downto mr+1 do: for CurC = mc-CurR to mc+CurR do: If IsOdd(CurC) then DiamondRA[CurR, CurC] = 1 This is just off the top of my head. Hope it's not all bunged up. 1); Start with 1 diamond point 2); Go to next row, make points on each side of diamond point into acks ; Go to next row, make points on each side of diamond point into acks plus a point in between ; etc. to the middle 3)+4) do the same thing from the bottom up PS All is contingent on boundaries of array; if odd in length or height, must adapt alg., etc. J Edited March 18, 2005 by jdickens If I am too verbose, just say so. You don't need to run on and on.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now