objective c - finding iteration formula for points arranged in a triangle -
i want arrange sprites @ following points using loop:
ccp(240.0, 160.0); ccp(300.0, 120.0); ccp(300.0, 200.0); ccp(360.0, 80.0); ccp(360.0, 160.0); ccp(360.0, 240.0);
i trying iteration formula these points using loop. i've been @ while. below visual representation of points. please help.
* * * * * *
do want this? (its quick, sketch only)
assume initial parameters:
initpoint (x0, y0) initvector (vx,vy) num of iteration c index = c while index for(j = index, currentpoint = initpoint+(c-index)*(0,2*vy); j;j--, currentpoint += initvector) draw currentpoint index--
basically main idea is, start top right point, , shifts context of drawing initial vector many times, iteration holds (to bottom left corner) , draws points. shifts initial point down along y axis , repeat minus 1 times.