8#ifndef IMPALGEBRA_SPHERICAL_VECTOR_3D_H
9#define IMPALGEBRA_SPHERICAL_VECTOR_3D_H
11#include <IMP/algebra/algebra_config.h>
17#include <cereal/access.hpp>
20IMPALGEBRA_BEGIN_NAMESPACE
30class IMPALGEBRAEXPORT SphericalVector3D :
public GeometricPrimitiveD<3> {
31 bool check(
double r,
double theta,
double psi)
const;
34 SphericalVector3D() {};
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: "
75 void set_cartesian_coordinates(
const Vector3D& v);
78 friend class cereal::access;
80 template<
class Archive>
void serialize(Archive &ar) {
81 ar(v_[0], v_[1], v_[2]);
87IMPALGEBRA_END_NAMESPACE
Base class for geometric types.
Various useful constants.
#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.
Class to represent a 3D point in spherical coordinates.
SphericalVector3D(const Vector3D &v)
Construct from a Cartesian coordinate vector.
Vector3D get_cartesian_coordinates() const
Returns a vector with the Cartesian coordinates.
SphericalVector3D(double r, double theta, double psi, bool apply_check=true)
Construct from provided spherical coordinates.
Exception definitions and assertions.
IMP::Vector< SphericalVector3D > SphericalVector3Ds
std::string String
Basic string value.
Macros to help with objects that can be printed to a stream.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.