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