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

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

Introduction de SpherePosition and SphereCoordSys, and Initiator for module Samba - Reza+I. Grivell 26/10/99

File size: 1.6 KB
Line 
1#include "spherepos.h"
2
3static 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
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
18// Temporary implementation of PPersist::
19// To be changed later ($CHECK$ Reza 26/10/99)
20void SphereCoordSys::ReadSelf(PInPersist& is)
21{
22uint_8 itab[3];
23is.Get(itab, 3);
24id_ = itab[1];
25is.GetStr(description_);
26}
27
28void SphereCoordSys::WriteSelf(POutPersist& os) const
29{
30// On ecrit 3 uint_8
31// 0 : Numero de version, 1 : Id, 2 reserve a l
32uint_8 itab[3];
33itab[0] = 1;
34itab[1] = id_;
35itab[2] = 0;
36os.Put(itab, 3);
37os.PutStr(description_);
38}
39
40//................. SpherePosition class .................
41
42SpherePosition::SpherePosition()
43 : UnitVector()
44{
45 cs_ = new SphereCoordSys;
46}
47
48SpherePosition::SpherePosition(double theta, double phi, SphereCoordSys* cs)
49 : UnitVector(theta, phi)
50{
51if (cs == NULL) cs_ = new SphereCoordSys;
52else cs_ = cs;
53}
54
55SpherePosition::SpherePosition(double x, double y, double z, SphereCoordSys* cs)
56 : UnitVector(x, y, z)
57{
58if (cs == NULL) cs_ = new SphereCoordSys;
59else cs_ = cs;
60}
61
62UnitVector SpherePosition::Transform(const SphereCoordSys& cs) const
63{
64return(*this);
65}
66
67double SpherePosition::Separation(const SpherePosition& gamma) const
68{
69return(this->SepAngle(gamma));
70}
Note: See TracBrowser for help on using the repository browser.