1 | #include "spherepos.h"
|
---|
2 |
|
---|
3 | static char *head_spherepos_cc_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/Samba/spherepos.cc,v 1.1 1999-10-26 14:31:40 ansari Exp $";
|
---|
4 |
|
---|
5 |
|
---|
6 | //................. SphereCoordSys class .................
|
---|
7 |
|
---|
8 | SphereCoordSys::SphereCoordSys(){
|
---|
9 | id_ = SphereCoordSys_NEUTRAL;
|
---|
10 | description_ = "NEUTRAL SphereCoordSystem";
|
---|
11 | }
|
---|
12 |
|
---|
13 | SphereCoordSys::SphereCoordSys(int id, const string& description){
|
---|
14 | id_ = id;
|
---|
15 | description_ = description;
|
---|
16 | }
|
---|
17 |
|
---|
18 | // Temporary implementation of PPersist::
|
---|
19 | // To be changed later ($CHECK$ Reza 26/10/99)
|
---|
20 | void SphereCoordSys::ReadSelf(PInPersist& is)
|
---|
21 | {
|
---|
22 | uint_8 itab[3];
|
---|
23 | is.Get(itab, 3);
|
---|
24 | id_ = itab[1];
|
---|
25 | is.GetStr(description_);
|
---|
26 | }
|
---|
27 |
|
---|
28 | void SphereCoordSys::WriteSelf(POutPersist& os) const
|
---|
29 | {
|
---|
30 | // On ecrit 3 uint_8
|
---|
31 | // 0 : Numero de version, 1 : Id, 2 reserve a l
|
---|
32 | uint_8 itab[3];
|
---|
33 | itab[0] = 1;
|
---|
34 | itab[1] = id_;
|
---|
35 | itab[2] = 0;
|
---|
36 | os.Put(itab, 3);
|
---|
37 | os.PutStr(description_);
|
---|
38 | }
|
---|
39 |
|
---|
40 | //................. SpherePosition class .................
|
---|
41 |
|
---|
42 | SpherePosition::SpherePosition()
|
---|
43 | : UnitVector()
|
---|
44 | {
|
---|
45 | cs_ = new SphereCoordSys;
|
---|
46 | }
|
---|
47 |
|
---|
48 | SpherePosition::SpherePosition(double theta, double phi, SphereCoordSys* cs)
|
---|
49 | : UnitVector(theta, phi)
|
---|
50 | {
|
---|
51 | if (cs == NULL) cs_ = new SphereCoordSys;
|
---|
52 | else cs_ = cs;
|
---|
53 | }
|
---|
54 |
|
---|
55 | SpherePosition::SpherePosition(double x, double y, double z, SphereCoordSys* cs)
|
---|
56 | : UnitVector(x, y, z)
|
---|
57 | {
|
---|
58 | if (cs == NULL) cs_ = new SphereCoordSys;
|
---|
59 | else cs_ = cs;
|
---|
60 | }
|
---|
61 |
|
---|
62 | UnitVector SpherePosition::Transform(const SphereCoordSys& cs) const
|
---|
63 | {
|
---|
64 | return(*this);
|
---|
65 | }
|
---|
66 |
|
---|
67 | double SpherePosition::Separation(const SpherePosition& gamma) const
|
---|
68 | {
|
---|
69 | return(this->SepAngle(gamma));
|
---|
70 | }
|
---|