Selecting groups of 5 coords from a set of n (nC5) [message #47836] |
Fri, 03 March 2006 07:26 |
Olivia
Messages: 16 Registered: February 2006
|
Junior Member |
|
|
Dear All,
I am trying to write a loop to perform a calculation on all possible
sets of 5 coordinates from a group of n. The test case I am working on
has a total number of coordinates of 8, so there will be 8c5=56 unique
solutions. At the moment, I am thinking of using 5 for loops as an
extension of a similar problem I worked on choosing 3 points. The 3
point code ran like this:
;Select groups of 3 boundary points
;for p=1, n, 1 do begin
; for k=1, n, 1 do begin
; for m=0, n-1, 1 do begin
; ellipse_points=[[bx[m], by[m]],$
; [bx[m+k], by[m+k]],$
; [bx[m+k+p], by[m+k+p]]]
On reflection, I was wondering if there might be a better way of doing
this. This is probably only a fear as my code is already looking really
complicated and I am worried about putting rubbish in and getting
rubbish out whilst being completely unaware. If anyone has any ideas I
would be really grateful to hear them. Thank you very much,
Olivia
|
|
|