Line | |
---|
1 | #include "MStarList.h"
|
---|
2 |
|
---|
3 | #include <iostream.h>
|
---|
4 |
|
---|
5 | void MStarList::RemoveTwins(Double_t radius)
|
---|
6 | {
|
---|
7 | MStarList stars;
|
---|
8 |
|
---|
9 | Int_t numfirst=0;
|
---|
10 |
|
---|
11 | while (1)
|
---|
12 | {
|
---|
13 | int idx;
|
---|
14 | MStar *first=NULL;
|
---|
15 | for (idx=numfirst; idx<GetMax(); idx++)
|
---|
16 | if ((first = (*this)[idx]))
|
---|
17 | break;
|
---|
18 |
|
---|
19 | if (!first)
|
---|
20 | return;
|
---|
21 |
|
---|
22 | fStars.RemoveAt(idx);
|
---|
23 |
|
---|
24 | MStarListIter Next(this, *first, radius);
|
---|
25 |
|
---|
26 | MStar *pos;
|
---|
27 | Float_t mx=0;
|
---|
28 | Float_t my=0;
|
---|
29 | Int_t cnt=0;
|
---|
30 | while ((pos=Next()))
|
---|
31 | {
|
---|
32 | mx += pos->GetX();
|
---|
33 | my += pos->GetY();
|
---|
34 | fStars.Remove(pos);
|
---|
35 | cnt++;
|
---|
36 | }
|
---|
37 | mx /= cnt;
|
---|
38 | my /= cnt;
|
---|
39 |
|
---|
40 | AddAt(idx, mx, my, cnt);
|
---|
41 | numfirst = idx+1;
|
---|
42 | }
|
---|
43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.