| 1 |
/* |
| 2 |
* (C) Copyright 2013 ECMWF. |
| 3 |
* |
| 4 |
* This software is licensed under the terms of the Apache Licence Version 2.0 |
| 5 |
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 6 |
* In applying this licence, ECMWF does not waive the privileges and immunities |
| 7 |
* granted to it by virtue of its status as an intergovernmental organisation |
| 8 |
* nor does it submit to any jurisdiction. |
| 9 |
*/ |
| 10 |
|
| 11 |
#include <iostream> |
| 12 |
|
| 13 |
#include "atlas/interpolation/method/Ray.h" |
| 14 |
|
| 15 |
//---------------------------------------------------------------------------------------------------------------------- |
| 16 |
|
| 17 |
namespace atlas { |
| 18 |
namespace interpolation { |
| 19 |
namespace method { |
| 20 |
|
| 21 |
Ray::Ray(const double* p) { |
| 22 |
orig = Vector3D::Map(p); |
| 23 |
dir = -orig; |
| 24 |
} |
| 25 |
|
| 26 |
Ray::Ray(const double* o, const double* d) { |
| 27 |
orig = Vector3D::Map(o); |
| 28 |
dir = Vector3D::Map(d); |
| 29 |
} |
| 30 |
|
| 31 |
Ray::Ray(const PointXYZ& p) { |
| 32 |
orig = Vector3D::Map(p.data()); |
| 33 |
dir = -orig; |
| 34 |
} |
| 35 |
|
| 36 |
Ray::Ray(const PointXYZ& o, const Vector3D& d) { |
| 37 |
orig = Vector3D::Map(o.data()); |
| 38 |
dir = d; |
| 39 |
} |
| 40 |
|
| 41 |
void Ray::print(std::ostream& s) const { |
| 42 |
s << "Ray[orig=" << orig << ",dir=" << dir << "]"; |
| 43 |
} |
| 44 |
|
| 45 |
std::ostream& operator<<(std::ostream& s, const Ray& p) { |
| 46 |
p.print(s); |
| 47 |
return s; |
| 48 |
} |
| 49 |
|
| 50 |
//---------------------------------------------------------------------------------------------------------------------- |
| 51 |
|
| 52 |
} // namespace method |
| 53 |
} // namespace interpolation |
| 54 |
} // namespace atlas |