8 #ifndef IMPALGEBRA_SPHERICAL_VECTOR_3D_H
9 #define IMPALGEBRA_SPHERICAL_VECTOR_3D_H
11 #include <IMP/algebra/algebra_config.h>
17 #include <boost/serialization/access.hpp>
20 IMPALGEBRA_BEGIN_NAMESPACE
31 bool check(
double r,
double theta,
double psi)
const;
44 bool apply_check =
true) {
46 if (!check(r, theta, psi)) {
47 String msg =
"SphericalCoords:: wrong SphericalCoords coordinates.";
56 double operator[](
unsigned int i)
const {
57 IMP_USAGE_CHECK(i < 3,
"Invalid component of SphericalCoords requested: "
62 double& operator[](
unsigned int i) {
63 IMP_USAGE_CHECK(i < 3,
"Invalid component of SphericalCoords requested: "
69 Vector3D get_cartesian_coordinates()
const;
75 void set_cartesian_coordinates(
const Vector3D& v);
78 friend class boost::serialization::access;
80 template<
class Archive>
void serialize(Archive &ar,
const unsigned int) {
81 ar & v_[0] & v_[1] & v_[2];
87 IMPALGEBRA_END_NAMESPACE
Base class for geometric types.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Exception definitions and assertions.
A more IMP-like version of the std::vector.
SphericalVector3D(const Vector3D &v)
Construct from a Cartesian coordinate vector.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
Base class for geometric types.
SphericalVector3D(double r, double theta, double psi, bool apply_check=true)
Construct from provided spherical coordinates.
Various useful constants.
Class to represent a 3D point in spherical coordinates.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
An exception for an invalid value being passed to IMP.
std::string String
Basic string value.
Macros to help with objects that can be printed to a stream.