source: Sophya/trunk/SophyaLib/Samba/spherepos.cc@ 568

Last change on this file since 568 was 525, checked in by ansari, 26 years ago

Corrections bugs , Reza 27/10/99

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