 IMP Reference Guide  develop.b708a66810,2021/08/02 The Integrative Modeling Platform
IMP::algebra Namespace Reference

General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP modules. More...

## Detailed Description

General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP modules.

# Geometric primitives

IMP has a number of geometric primitives. They support the following namespace functions as appropriate

In addition, they cannot be compared against one another due to floating point implementation issues (eg Vector3D v=v2 does not imply v==v2).

Geometric primitives are not put into a defined state by their constructor. Such classes mimic POD types (int, float etc) in C++ and are optimized for efficiency. All operations on a default initialized instance other than assigning to it from a non-default initialized instance should be assumed to be invalid.

# Geometry and dimensions

Many of the geometric primitives and operations in IMP are written to work in any dimension. In C++, this is implemented via templates (such as IMP::algebra::VectorD). In the Python side, the different dimensions are named explicitly instead. That means, a 2-D point is IMP::algebra::VectorD<2> in C++, and IMP::algebra::Vector2D in Python and the function IMP::algebra::get_basis_vector_d<3>() in C++ becomes IMP.algebra.get_basis_vector_3d() in Python. Similarly, a collection of 2D points is IMP::Vector<IMP::algebra::VectorD<2> > in C++ and IMP.algebra.Vector2Ds in Python, which as with all collections, look like Python lists. For convenience, we provide typedefs in C++ to the IMP::algebra::Vector2D and IMP::algebra::Vector2Ds style names.

# Generic geometry

Geometry in IMP can be stored in a variety of ways. For example, a point in 3D can be stored using an IMP::algebra::VectorD<3> or using an IMP::core::XYZ particle. It is often useful to be able to write algorithms that work on sets of points without worrying how they are stored, the Generic Geometry layer provides that. It works using a set of functions get_vector_3d() and set_vector_3d() which manipulate the geometry in terms of the IMP::algebra representation of the geometry in question. That is, get_vector_3d() returns a IMP::algebra::VectorD<3> for both an IMP::algebra::Vector3D and a IMP::core::XYZ. Algorithms take their arguments as C++ templates and use the generic geometry methods to manipulate the geometry. And versions of the function for both types of storage are exported to Python, so one could also write generic functions in Python.

For example, IMP::atom::get_rmsd() takes any combination of IMP::algebra::Vector3Ds or IMP::core::XYZs or IMP::core::XYZsTemp as arguments. Versions for all combinations of those are exported to Python.

# ANN

ANN is a library implementing fast nearest neighbor searches. Certain data structures will be faster if it is installed. While compilation of the library from source is quite straightforward, it is not available as a package for common platforms. In addition, ANN must be built as a shared library rather than a static library.

# Info

Author(s): Daniel Russel, Keren Lasker, Ben Webb, Javier Angel Velázquez-Muriel

Maintainer: benmwebb

License: LGPL This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Publications:

## Classes

class  BoundedGridRangeD

class  BoundingBoxD
An axis-aligned bounding box. More...

class  Cone3D
Represent a cone in 3D. More...

class  ConnollySurfacePoint
Represent a point on the Connolly surface. More...

class  Cylinder3D
Represent a cylinder in 3D. More...

class  DefaultEmbeddingD
Embed a grid as an evenly spaced axis aligned grid. More...

struct  DenseFloatLogGridKD

struct  DenseGrid3D
A dense grid of values. More...

class  DenseGridStorageD

struct  DenseIntLogGrid3D

class  DynamicNearestNeighbor3D
Provide an incremental nearest neighbor search function. More...

class  Ellipsoid3D
Represent an ellipsoid in 3D. More...

class  EuclideanVectorKDMetric
The l2 norm on the distance vector. More...

class  ExtendedGridIndexD
An index in an infinite grid on space. More...

class  FixedXYZ
A simple class for returning XYZ Euler angles. More...

class  Gaussian3D
A Gaussian distribution in 3D. More...

class  GeometricPrimitiveD
Base class for geometric types. More...

class  GridD
A voxel grid in d-dimensional space. More...

class  GridIndexD
Represent a real cell in a grid (one within the bounding box) More...

class  Line3D
Simple implementation of lines in 3D. More...

class  LinearFit2D
Calculate line that fits best the input data points (Linear least squares) More...

class  LogEmbeddingD

class  MaxVectorKDMetric

class  NearestNeighborD
Build a structure for finding nearest neighbors. More...

class  ParabolicFit2D
Calculate parabola that fits best the input data points. More...

class  Plane3D
Represent a plane in 3D. More...

class  PrincipalComponentAnalysisD
Represent an eigen analysis of some data. More...

class  ReferenceFrame3D
A reference frame in 3D. More...

class  Reflection3D
Reflect about a plane in 3D. More...

class  Rotation2D
Represent a rotation in 2D space. More...

class  Rotation3D
3D rotation class. More...

class  Segment3D
Simple implementation of segments in 3D. More...

struct  SparseGrid3D
A sparse grid of values. More...

class  SparseGridStorageD

struct  SparseUnboundedGrid3D
A sparse, infinite grid of values. More...

struct  SparseUnboundedGridD
A sparse, infinite grid of values. More...

class  SphereD
Represent a sphere in D-dimensions. More...

class  SpherePatch3D
A sphere patch is defined as all points above the plane and on the sphere. More...

class  SphericalVector3D
Class to represent a 3D point in spherical coordinates. More...

class  Torus3D
Represent a torus in 3D. More...

class  Transformation2D
Simple 2D transformation class. More...

class  Transformation3D
Simple 3D transformation class. More...

class  Triangle3D
Represent a triangle in 3D. More...

class  UnboundedGridRangeD

class  UnitSimplexBaseD
Base class for a unit simplex embedded in D-dimensional real space. More...

class  UnitSimplexD
Represent a unit simplex embedded in D-dimensional real space. More...

class  UnitSimplexD<-1 >
Represent a unit simplex embedded in d-dimensional real space. More...

class  VectorBaseD
A Cartesian vector in D-dimensions. More...

class  VectorD
A Cartesian vector in D-dimensions. More...

class  VectorKDMetric
The base class for a metric on VectorKDs. More...

## Typedefs

typedef std::pair< Vector3D,
double >
AxisAnglePair

typedef BoundingBoxD< 1 > BoundingBox1D
Typedef for Python. More...

typedef IMP::Vector
< BoundingBox1D
BoundingBox1Ds

typedef BoundingBoxD< 2 > BoundingBox2D
Typedef for Python. More...

typedef IMP::Vector
< BoundingBox2D
BoundingBox2Ds

typedef BoundingBoxD< 3 > BoundingBox3D
Typedef for Python. More...

typedef IMP::Vector
< BoundingBox3D
BoundingBox3Ds

typedef BoundingBoxD< 4 > BoundingBox4D
Typedef for Python. More...

typedef IMP::Vector
< BoundingBox4D
BoundingBox4Ds

typedef BoundingBoxD< 5 > BoundingBox5D
Typedef for Python. More...

typedef IMP::Vector
< BoundingBox5D
BoundingBox5Ds

typedef BoundingBoxD< 6 > BoundingBox6D
Typedef for Python. More...

typedef IMP::Vector
< BoundingBox6D
BoundingBox6Ds

typedef BoundingBoxD<-1 > BoundingBoxKD
Typedef for Python. More...

typedef IMP::Vector
< BoundingBoxKD
BoundingBoxKDs

typedef std::pair

typedef std::pair

typedef IMP::Vector< Cone3DCone3Ds

typedef IMP::Vector
< ConnollySurfacePoint
ConnollySurfacePoints

typedef IMP::Vector< Cylinder3DCylinder3Ds

typedef IMP::Vector< Ellipsoid3DEllipsoid3Ds

typedef IMP::Vector< Gaussian3DGaussian3Ds

typedef IMP::Vector< Line3DLine3Ds

typedef IMP::Vector< LinearFit2DLinearFit2Ds

typedef IMP::Vector
< ParabolicFit2D
ParabolicFit2Ds

typedef IMP::Vector< Plane3DPlane3Ds

typedef IMP::Vector
< ReferenceFrame3D
ReferenceFrame3Ds

typedef IMP::Vector< Reflection3DReflection3Ds

typedef std::pair< Vector3D,

typedef IMP::Vector< Rotation2DRotation2Ds

typedef IMP::Vector< Rotation3DRotation3Ds

typedef IMP::Vector< Segment3DSegment3Ds

typedef SphereD< 1 > Sphere1D
Typedef for Python. More...

typedef IMP::Vector< Sphere1DSphere1Ds

typedef SphereD< 2 > Sphere2D
Typedef for Python. More...

typedef IMP::Vector< Sphere2DSphere2Ds

typedef SphereD< 3 > Sphere3D
Typedef for Python. More...

typedef IMP::Vector< Sphere3DSphere3Ds

typedef SphereD< 4 > Sphere4D
Typedef for Python. More...

typedef IMP::Vector< Sphere4DSphere4Ds

typedef SphereD< 5 > Sphere5D
Typedef for Python. More...

typedef IMP::Vector< Sphere5DSphere5Ds

typedef SphereD< 6 > Sphere6D
Typedef for Python. More...

typedef IMP::Vector< Sphere6DSphere6Ds

typedef SphereD<-1 > SphereKD
Typedef for Python. More...

typedef IMP::Vector< SphereKDSphereKDs

typedef IMP::Vector
< SpherePatch3D
SpherePatch3Ds

typedef IMP::Vector
< SphericalVector3D
SphericalVector3Ds

typedef IMP::Vector< Torus3DTorus3Ds

typedef IMP::Vector
< Transformation2D
Transformation2Ds

typedef std::pair< Vector4D,
Vector3D

typedef IMP::Vector
< Transformation3D
Transformation3Ds

typedef std::pair< Vector3D,

typedef IMP::Vector< Triangle3DTriangle3Ds

typedef UnitSimplexD< 1 > UnitSimplex1D

typedef IMP::Vector
< UnitSimplex1D
UnitSimplex1Ds

typedef UnitSimplexD< 2 > UnitSimplex2D

typedef IMP::Vector
< UnitSimplex2D
UnitSimplex2Ds

typedef UnitSimplexD< 3 > UnitSimplex3D

typedef IMP::Vector
< UnitSimplex3D
UnitSimplex3Ds

typedef UnitSimplexD< 4 > UnitSimplex4D

typedef IMP::Vector
< UnitSimplex4D
UnitSimplex4Ds

typedef UnitSimplexD< 5 > UnitSimplex5D

typedef IMP::Vector
< UnitSimplex5D
UnitSimplex5Ds

typedef UnitSimplexD< 6 > UnitSimplex6D

typedef IMP::Vector
< UnitSimplex6D
UnitSimplex6Ds

typedef UnitSimplexD<-1 > UnitSimplexKD

typedef IMP::Vector
< UnitSimplexKD
UnitSimplexKDs

typedef VectorD< 1 > Vector1D

typedef Vector< VectorD< 1 > > Vector1Ds

typedef VectorD< 2 > Vector2D

typedef Vector< VectorD< 2 > > Vector2Ds

typedef VectorD< 3 > Vector3D

typedef Vector< VectorD< 3 > > Vector3Ds

typedef VectorD< 4 > Vector4D

typedef Vector< VectorD< 4 > > Vector4Ds

typedef VectorD< 5 > Vector5D

typedef Vector< VectorD< 5 > > Vector5Ds

typedef VectorD< 6 > Vector6D

typedef Vector< VectorD< 6 > > Vector6Ds

typedef VectorD<-1 > VectorKD

typedef IMP::Vector
< IMP::Pointer< VectorKDMetric > >
VectorKDMetrics

typedef IMP::Vector
< IMP::WeakPointer
< VectorKDMetric > >
VectorKDMetricsTemp

typedef Vector< VectorD<-1 > > VectorKDs

## Functions

template<int D>
int compare (const VectorD< D > &a, const VectorD< D > &b)
lexicographic comparison of two vectors More...

Rotation2D compose (const Rotation2D &a, const Rotation2D &b)
Compose two rotations a and b. More...

Transformation2D compose (const Transformation2D &a, const Transformation2D &b)
Compose two transformations. More...

Transformation3D compose (const Transformation3D &a, const Transformation3D &b)
Compose two transformations. More...

Rotation3D compose (const Rotation3D &a, const Rotation3D &b)

Get adjoint of inputs to compose from adjoint of output. More...

Get adjoint of inputs to compose from adjoint of output. More...

Get adjoint of inputs to compose from adjoint of output. More...

Get adjoint of inputs to compose from adjoint of output. More...

Transformation3Ds get_alignments_from_first_to_second (const PrincipalComponentAnalysisD< 3 > &pca1, const PrincipalComponentAnalysisD< 3 > &pca2)
Get all alignments of the first principal component system to the second one. More...

double get_angle (const Line3D &a, const Line3D &b)
Get angle in radians between two lines around their closest points. More...

bool get_are_almost_equal (const double a, const double b, const double epsilon)
Compare two values for "almost equal" (intended for doubles) More...

bool get_are_colinear (const Vector3D &p1, const Vector3D &p2, const Vector3D &p3)
Return true if the three points are co-linear. More...

template<class Geometry >
double get_area (const Geometry &)
Compute the area of any surface object. More...

std::pair< Vector3D, double > get_axis_and_angle (const Rotation3D &rot)
Decompose a Rotation3D object into a rotation around an axis. More...

Return the radius of a sphere with a given volume. More...

template<int D>
VectorD< D > get_basis_vector_d (unsigned int coordinate)
Return the basis vector for the given coordinate. More...

template<int D>
VectorD< D > get_basis_vector_kd (int Di, unsigned int coordinate)
Return the basis vector for the given coordinate. More...

template<>
VectorD<-1 > get_basis_vector_kd (int D, unsigned int coordinate)
Return a dynamically sized basis vector. More...

template<class Geometry >
BoundingBoxD< 3 > get_bounding_box (const Geometry &)
Compute the bounding box of any geometric object. More...

template<int D, class Storage , class Value , class Embedding >
BoundingBoxD< D > get_bounding_box (const GridD< D, Storage, Value, Embedding > &g)

double get_closer_power_of_2 (double x)
Closest power of 2 for a number, not necessarily higher. More...

ConnollySurfacePoints get_connolly_surface (const algebra::Sphere3Ds &spheres, double density, double probe_radius)

template<typename T >
get_constrained (const T x, const T x0, const T xF)
Constrain a value between two given limits. More...

Eigen::Matrix3d get_covariance (const Gaussian3D &g)

template<unsigned int D>
BoundingBoxD< D > get_cube_d (double radius)
Cube with radius of length radius. More...

BoundingBoxD<-1 > get_cube_kd (unsigned int d, double radius)
Cube with radius of length side. More...

double get_distance (const Segment3D &s, const Vector3D &p)
Get the distance between a segment and a point. More...

double get_distance (const Plane3D &pln, const Vector3D &p)
Return the distance between a plane and a point in 3D. More...

double get_distance (const Segment3D &a, const Segment3D &b)
Get the distance between two segments. More...

double get_distance (const Line3D &s, const Vector3D &p)
Get closest distance between a line and a point. More...

double get_distance (const Line3D &a, const Line3D &b)
Get the closest distance between two lines. More...

template<int D>
double get_distance (const SphereD< D > &a, const SphereD< D > &b)
Return the distance between the two spheres if they are disjoint. More...

template<int D>
double get_distance (const VectorD< D > &v1, const VectorD< D > &v2)
Compute the distance between two vectors. More...

double get_distance (const Rotation3D &r0, const Rotation3D &r1)
Return a distance between the two rotations. More...

IntPairs get_edges (const BoundingBoxD< 3 > &)
Return the edges of the box as indices into the vertices list. More...

template<int D>
VectorD< D > get_elementwise_product (const algebra::VectorD< D > &a, const algebra::VectorD< D > &b)
Return the vector that is the elementwise product of the two. More...

template<int D>
VectorD< D > get_elementwise_product (const Ints &a, const algebra::VectorD< D > &b)
Return the vector that is the elementwise product of the two. More...

template<int D>
VectorD< D > get_embedded_from_increasing (const UnitSimplexD< D > &s, const VectorD< D > &p)
Convert point on simplex from increasing to embedded coordinates. More...

Sphere3D get_enclosing_sphere (const Sphere3Ds &ss)
Return a sphere containing the listed spheres. More...

Sphere3D get_enclosing_sphere (const Vector3Ds &ss)
Return a sphere containing the listed vectors. More...

Gaussian3D get_gaussian_from_covariance (const Eigen::Matrix3d &covariance, const Vector3D &center)
Return a Gaussian centered at the origin from a covariance matrix. More...

Eigen::MatrixXd get_gradient_of_composed_with_respect_to_first (const Rotation3D &q, const Rotation3D &p, bool wrt_unnorm=true)

Eigen::MatrixXd get_gradient_of_composed_with_respect_to_second (const Rotation3D &q, const Rotation3D &p, bool wrt_unnorm=true)

Rotation2D get_identity_rotation_2d ()
Build an identity rotation in 2D. More...

Rotation3D get_identity_rotation_3d ()
Return a rotation that does not do anything. More...

Transformation2D get_identity_transformation_2d ()
Return a transformation that does not do anything. More...

Transformation3D get_identity_transformation_3d ()
Return a transformation that does not do anything. More...

template<int D>
VectorD< D > get_increasing_from_embedded (const UnitSimplexD< D > &s, const VectorD< D > &p)
Convert point on simplex from embedded to increasing coordinates. More...

template<int D>
bool get_interiors_intersect (const SphereD< D > &a, const SphereD< D > &b)
Return true if the two balls bounded by the two spheres intersect. More...

template<int D>
bool get_interiors_intersect (const BoundingBoxD< D > &a, const BoundingBoxD< D > &b)
Return true if they intersect. More...

Rotation3D get_interpolated (const Rotation3D &a, const Rotation3D &b, double f)
Interpolate between two rotations. More...

template<int D>
BoundingBoxD< D > get_intersection (const BoundingBoxD< D > &a, const BoundingBoxD< D > &b)
Return the intersecting bounding box. More...

Eigen::MatrixXd get_jacobian_of_composed_wrt_first (const Rotation3D &q, const Rotation3D &p, bool wrt_unnorm=false)
Get gradient of quaternion product with respect to first quaternion. More...

Eigen::MatrixXd get_jacobian_of_composed_wrt_second (const Rotation3D &q, const Rotation3D &p, bool wrt_unnorm=false)
Get Jacobian of quaternion product with respect to second quaternion. More...

Triangle3D get_largest_triangle (const Vector3Ds &points)
Return the largest triangle defined by 3 points from the input. More...

template<int D, class Storage , class Value , class Embedding >
Value get_linearly_interpolated (const GridD< D, Storage, Value, Embedding > &g, const VectorD< D > &pt)
Get the value from the grid with linear interpolation. More...

template<class VT >
double get_magnitude_and_normalize_in_place (VT &vt)
Returns the magnitude of vt and turns it to a unit vector in place. More...

template<int D>
double get_maximum_length (const BoundingBoxD< D > &a)
Return the maximum axis aligned extent. More...

float get_next_larger_power_of_2 (float x)
Closest power of 2 that can contain a number x. More...

double get_next_larger_power_of_2 (double x)
Closest power of 2 that can contain a number x. More...

template<int D>
VectorD< D > get_ones_vector_d (double v=1)
Return a vector of ones (or another constant) More...

template<int D>
VectorD< D > get_ones_vector_kd (unsigned int Di, double v=1)
Return a vector of ones (or another constant) More...

template<>
VectorD<-1 > get_ones_vector_kd (unsigned int D, double v)
Return a vector of ones (or another constant) More...

template<int D>
double get_power_distance (const SphereD< D > &a, const SphereD< D > &b)
Return the power distance between the two spheres. More...

template<int D>
PrincipalComponentAnalysisD< D > get_principal_components (const Vector< VectorD< D > > &ps)
Perform principal components analysis on a set of vectors. More...

Vector3D get_projected (const Line3D &l, const Vector3D &p)
Project a point onto the line. More...

algebra::Segment3D get_projected (const Line3D &l, const algebra::Segment3D &s)
Project a segment onto a line. More...

template<int D>
VectorD< D > get_projected (const UnitSimplexD< D > &s, const VectorD< D > &p)

Transformation3D get_random_local_transformation (Vector3D origin, double max_translation=5., double max_angle_in_rad=0.26)
Get a local transformation. More...

Rotation2D get_random_rotation_2d ()
Build an identity rotation in 2D. More...

Rotation3D get_random_rotation_3d ()
Pick a rotation at random from all possible rotations. More...

Rotation3D get_random_rotation_3d (const Rotation3D &center, double distance)
Pick a rotation at random near the provided one. More...

DenseGrid3D< double > get_rasterized (const Gaussian3Ds &gmm, const Floats &weights, double cell_width, const BoundingBox3D &bb)
Rasterize the Gaussians to a grid. More...

DenseGrid3D< double > get_rasterized_fast (const Gaussian3Ds &gmm, const Floats &weights, double cell_width, const BoundingBox3D &bb, double factor=2.5)
Rasterize the Gaussians to a grid. More...

Vector3D get_reflected (const Plane3D &pln, const Vector3D &p)
Return the point reflected about the plane. More...

double get_relative_projection_on_segment (const Segment3D &s, const algebra::Vector3D &p)
Return the 'relative' projection of a point p onto the line that contains s. More...

template<class Vector3DsOrXYZs0 , class Vector3DsOrXYZs1 >
double get_rmsd (const Vector3DsOrXYZs0 &m1, const Vector3DsOrXYZs1 &m2)

template<class Vector3DsOrXYZs0 , class Vector3DsOrXYZs1 >
double get_rmsd_transforming_first (const Transformation3D &tr, const Vector3DsOrXYZs0 &m1, const Vector3DsOrXYZs1 &m2)
Calculate the root mean square deviation between two sets of 3D points. More...

Rotation3D get_rotation_about_axis (const Vector3D &axis, double angle)
Generate a Rotation3D object from a rotation around an axis. More...

Rotation3D get_rotation_about_normalized_axis (const Vector3D &axis_norm, double angle)

Transformation2D get_rotation_about_point (const Vector2D &point, const Rotation2D &rotation)
Generate a Transformation2D object from a rotation around a point. More...

Transformation3D get_rotation_about_point (const Vector3D &point, const Rotation3D &rotation)
Generate a Transformation3D object from a rotation around a point. More...

Rotation3D get_rotation_from_matrix (double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
Generate a Rotation3D object from a rotation matrix. More...

Rotation3D get_rotation_from_matrix (Eigen::Matrix3d m)
Generate a Rotation3D object from a rotation matrix. More...

Rotation3D get_rotation_from_vector4d (const VectorD< 4 > &v)
Compute a rotation from an unnormalized quaternion. More...

Rotation3D get_rotation_from_x_y_axes (const Vector3D &x, const Vector3D &y)

Rotation3D get_rotation_taking_first_to_second (const Vector3D &v1, const Vector3D &v2)
Create a rotation from the first vector to the second one. More...

Rotation2D get_rotation_to_x_axis (const Vector2D &v)

template<typename T >
int get_rounded (const T &x)
Rounds a number to next integer. More...

algebra::Segment3D get_segment_connecting_first_to_second (const Line3D &a, const Line3D &b)
Get shortest possible segment from the first line to the second. More...

template<typename T >
int get_sign (const T &x)
Sign of a number. 1 if the number is higher or equal to 0 and -1 otherwise. More...

Sphere3Ds get_simplified_from_volume (Sphere3Ds in, double maximum_allowed_error_angstroms)
Get a set of balls that approximates the surface of the passed set. More...

double get_squared (double x)

template<int D>
double get_squared_distance (const VectorD< D > &v1, const VectorD< D > &v2)
Compute the squared distance between two vectors. More...

template<class Geometry >
double get_surface_area (const Geometry &)
Compute the surface area of any volumetric object. More...

FloatPair get_surface_area_and_volume (const algebra::Sphere3Ds &ss)
Get surface area & volume of the union of the balls bounded by the spheres. More...

Transformation3D get_transformation_3d (const Transformation2D &t2d)
Build a 3D transformation from a 2D one. More...

template<class Vector3DsOrXYZs0 , class Vector3DsOrXYZs1 >
IMP::algebra::Transformation3D get_transformation_aligning_first_to_second (const Vector3DsOrXYZs0 &source, const Vector3DsOrXYZs1 &target)
Compute the rigid transform bringing the first point set to the second. More...

Transformation2D get_transformation_aligning_pair (const Vector2Ds &set_from, const Vector2Ds &set_to)

Transformation3D get_transformation_from_first_to_second (const ReferenceFrame3D &a, const ReferenceFrame3D &b)

Transformation3D get_transformation_from_first_triangle_to_second (Triangle3D first_tri, Triangle3D second_tri)
Return a transformation between two triangles. More...

ReferenceFrame3D get_transformed (const ReferenceFrame3D &rf, const Transformation3D &tr)

BoundingBoxD< 3 > get_transformed (const BoundingBoxD< 3 > &bb, const Transformation3D &tr)
Return a bounding box containing the transformed box. More...

algebra::Line3D get_transformed (const algebra::Line3D &l, const Transformation3D &tr)

algebra::Triangle3D get_triangle_3d (const UnitSimplex3D &s)

template<class Storage , class Embedding >
const Storage::Value get_trilinearly_interpolated (const GridD< 3, Storage, typename Storage::Value, Embedding > &g, const Vector3D &v, const typename Storage::Value &outside=0)
Use trilinear interpolation to compute a smoothed value at v. More...

Rotation3Ds get_uniform_cover_rotations_3d (unsigned int num_points)
Cover the space of rotations evenly. More...

Vector3Ds get_uniform_surface_cover (const Sphere3Ds &in, double points_per_square_angstrom)

algebra::Rotation3Ds get_uniformly_sampled_rotations (double delta)
Generates a nondegenerate set of Euler angles with a delta resolution. More...

template<int D>
BoundingBoxD< D > get_union (BoundingBoxD< D > a, const BoundingBoxD< D > &b)
Return the union bounding box. More...

template<unsigned int D>
BoundingBoxD< D > get_unit_bounding_box_d ()

BoundingBoxD<-1 > get_unit_bounding_box_kd (unsigned int d)

template<unsigned int D>
SphereD< D > get_unit_sphere_d ()

SphereD<-1 > get_unit_sphere_kd (unsigned int d)

template<class VT >
VT get_unit_vector (VT vt)
Returns a unit vector pointing at the same direction as this vector. More...

template<int D>
VectorD< D > get_vector_geometry (const SphereD< D > &s)

template<class C >
const VectorD< C::DIMENSION > & get_vector_geometry (const C &g)

template<int D>
Vector< VectorD< D > > get_vertices (const UnitSimplexD< D > &s)
Return a list of the vertices (bases) of the unit simplex. More...

template<int D>
Vector< VectorD< D > > get_vertices (const BoundingBoxD< D > &bb)
Return a list of the 2^D bounding points for the bounding box. More...

template<int D>
double get_volume (const BoundingBoxD< D > &bb)
See BoundingBoxD. More...

template<class Geometry >
double get_volume (const Geometry &)
Compute the volume of any volumetric object. More...

template<class Vector3DsOrXYZs0 , class Vector3DsOrXYZs1 >
double get_weighted_rmsd (const Vector3DsOrXYZs0 &m1, const Vector3DsOrXYZs1 &m2, const Floats &weights)

template<class Vector3DsOrXYZs0 , class Vector3DsOrXYZs1 >
double get_weighted_rmsd_transforming_first (const Transformation3D &tr, const Vector3DsOrXYZs0 &m1, const Vector3DsOrXYZs1 &m2, const Floats &weights)

template<int D>
VectorD< D > get_zero_vector_d ()
Return a vector of zeros. More...

template<int D>
VectorD< D > get_zero_vector_kd (int Di)
Return a dynamically sized vector of zeros. More...

template<>
VectorD<-1 > get_zero_vector_kd (int D)
Return a dynamically sized vector of zeros. More...

template<int D>
VectorD< D > operator* (double s, VectorD< D > o)

void set_line_3d_geometry (Line3D &g, const Line3D &gi)

void set_segment_3d_geometry (Segment3D &g, const Segment3D &gi)

template<class C , class E >
void set_vector_geometry (C &g, const E &v)

## Variables

static const double PI = 3.1415926535897931
the constant pi More...

## Standard module functions

All IMP modules have a set of standard functions to help get information about the module and about files associated with the module.

std::string get_module_version ()
Return the version of this module, as a string. More...

std::string get_module_name ()

std::string get_data_path (std::string file_name)
Return the full path to one of this module's data files. More...

std::string get_example_path (std::string file_name)
Return the full path to one of this module's example files. More...

## Endian

IMP provides a variety of functionality to manage byte order in input and output data.

void reversed_read (void *dest, size_t size, size_t nitems, std::ifstream &f, bool reverse)
Reads from file in normal or reverse order. More...

void reversed_write (const void *src, size_t size, size_t nitems, std::ofstream &f, bool reverse=false)
Writes to a file in normal or reversed order. More...

bool get_is_big_endian ()
Returns 1 if machine is big endian else 0. More...

bool get_is_little_endian ()
Returns 1 if machine is little endian else 0. More...

## Simple geometric IO

These functions write geometry to text files, one line per geometric primitive. Each line has the form “x y z” for points or “x y z r” for spheres. We can easily add general dimension support if requested.. Lines beginning with "#" are treated as comments.

void write_pts (const Vector3Ds &vs, TextOutput out)
Write a set of 3D vectors to a file. More...

Read a set of 3D vectors from a file. More...

void write_spheres (const Sphere3Ds &vs, TextOutput out)
Write a set of 3D spheres to a file. More...

Read a set of 3D spheres from a file. More...

## Python Only

The following functions are only available in Python as the equivalent C++ functionality is provided via template functions or in other ways that don't directly map to Python.

typedef Grid3D< int,
SparseGridStorage3D< int,
BoundedGridStorage3D > >
SparseIntGrid3D

typedef Grid3D< int,
SparseGridStorage3D< int,
UnboundedGridStorage3D > >
SparseUnboundedIntGrid3D

typedef Grid3D< double,
DenseGridStorage3D< double > >
DenseDoubleGrid3D

typedef Grid3D< float,
DenseGridStorage3D< float > >
DenseFloatGrid3D

Transformation3D get_transformation_aligning_first_to_second (Vector3Ds a, Vector3Ds b)

## Euler Angles

There are many conventions for how to define Euler angles, based on choices of which of the x,y,z axis to use in what order and whether the rotation axis is in the body frame (and hence affected by previous rotations) or in in a fixed frame. See http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles for a general description.

• All Euler angles are specified in radians.
• Only x-y-z order is currently supported.
• To convert Euler angles in a different order, one can compose a Rotation3D from three rotations using get_rotation_about_axis function.
typedef IMP::Vector< FixedXYZFixedXYZs

Rotation3D get_rotation_from_fixed_xyz (double xr, double yr, double zr)
Initialize a rotation in x-y-z order from three angles. More...

Rotation3D get_rotation_from_fixed_zxz (double phi, double theta, double psi)
Initialize a rotation from Euler angles. More...

Rotation3D get_rotation_from_fixed_zyz (double Rot, double Tilt, double Psi)
Generate a rotation object from Euler Angles. More...

FixedXYZ get_fixed_xyz_from_rotation (const Rotation3D &r)
The inverse of rotation_from_fixed_xyz() More...

## Shortest segments

These methods return the shortest segment connecting two geometric objects. Such segments can be used to give the direction of the derivative of the distance between the two objects. The 0 point on the segment is in the first passed object and the 1 point is in the second.

Segment3D get_shortest_segment (const Segment3D &s, const Vector3D &p)

Segment3D get_shortest_segment (const Segment3D &sa, const Segment3D &sb)

## 3D Vectors

We provide a specialization of VectorD for 3-space and several additional functions on it.

Vector3D get_vector_product (const Vector3D &p1, const Vector3D &p2)
Return the vector product (cross product) of two vectors. More...

Vector3D get_orthogonal_vector (const Vector3D &v)
Return a vector that is perpendicular to the given vector. More...

Vector3D get_centroid (const Vector3Ds &ps)
Return the centroid of a set of vectors. More...

Return the radius of gyration of a set of points. More...

## Vector Generators

These functions generate vector objects. Some of the methods, those with random in their name, generate a single vector chosen uniformly from the specified domain. Others, the cover methods, generate a set of points distributed (somewhat) evenly over the domain.

template<int D>
VectorD< D > get_random_vector_in (const BoundingBoxD< D > &bb)
Generate a random vector in a box with uniform density. More...

template<int D>
VectorD< D > get_random_vector_on (const BoundingBoxD< D > &bb)
Generate a random vector on a box with uniform density. More...

template<int D>
VectorD< D > get_random_vector_in (const SphereD< D > &s)
Generate a random vector in a sphere with uniform density. More...

VectorD< 2 > get_random_vector_in (const SphereD< 2 > &s)

Vector3D get_random_vector_in (const Cylinder3D &c)
Generate a random vector in a cylinder with uniform density. More...

VectorD< 3 > get_random_vector_on_unit_sphere ()

template<int D>
VectorD< D > get_random_vector_on (const SphereD< D > &s)
Generate a random vector on a sphere with uniform density. More...

template<int D>
Vector< VectorD< D > > get_uniform_surface_cover (const SphereD< D > &s, unsigned int n)
Generate a set of vectors which covers a sphere uniformly. More...

Vector3Ds get_uniform_surface_cover (const Cylinder3D &cyl, int number_of_points)
Generate a set of 3d points that uniformly cover a cylinder. More...

template<int D>
Vector< VectorD< D > > get_uniform_upper_hemisphere_cover (const SphereD< D > &s, unsigned int n)
Generate a set of 3D points that uniformly cover a hemisphere. More...

template<int D>
VectorD< D > get_random_vector_on (const UnitSimplexD< D > &s)
Generate a random vector on a unit simplex with uniform density. More...

Vector3Ds get_grid_surface_cover (const Cylinder3D &cyl, int number_of_cycles, int number_of_points_on_cycle)
Generate a grid of 3d points on a cylinder surface. More...

Vector3Ds get_uniform_surface_cover (const SpherePatch3D &sph, unsigned int number_of_points)
Generate a set of 3d points that uniformly cover a patch of a sphere. More...

Vector3Ds get_uniform_surface_cover (const Cone3D &cone, unsigned int number_of_points)

template<int D>
Vector< VectorD< D > > get_grid_interior_cover_by_spacing (const BoundingBoxD< D > &bb, double s)

Vector3Ds get_random_chain (unsigned int n, double r, const Vector3D &start=Vector3D(0, 0, 0), const Sphere3Ds &obstacles=Sphere3Ds())
Generate a random chain with no collisions. More...

## Norms

We define a number of standard, $$L^p$$, norms on VectorD.

• $$L^1$$ is the Manhattan distance, the sum of the components
• $$L^2$$ is the standard Euclidean length
• $$L^{\inf}$$ is the maximum of the components
template<int D>
double get_l2_norm (const VectorD< D > &v)

template<int D>
double get_l1_norm (const VectorD< D > &v)

template<int D>
double get_linf_norm (const VectorD< D > &v)

## Typedef Documentation

 typedef BoundingBoxD<1> IMP::algebra::BoundingBox1D

Typedef for Python.

Definition at line 176 of file BoundingBoxD.h.

 typedef IMP::Vector< BoundingBox1D > IMP::algebra::BoundingBox1Ds

Pass or store a set of BoundingBox1D .

Definition at line 176 of file BoundingBoxD.h.

 typedef BoundingBoxD<2> IMP::algebra::BoundingBox2D

Typedef for Python.

Definition at line 176 of file BoundingBoxD.h.

 typedef IMP::Vector< BoundingBox2D > IMP::algebra::BoundingBox2Ds

Pass or store a set of BoundingBox2D .

Definition at line 176 of file BoundingBoxD.h.

 typedef BoundingBoxD<3> IMP::algebra::BoundingBox3D

Typedef for Python.

Definition at line 176 of file BoundingBoxD.h.

 typedef IMP::Vector< BoundingBox3D > IMP::algebra::BoundingBox3Ds

Pass or store a set of BoundingBox3D .

Definition at line 176 of file BoundingBoxD.h.

 typedef BoundingBoxD<4> IMP::algebra::BoundingBox4D

Typedef for Python.

Definition at line 176 of file BoundingBoxD.h.

 typedef IMP::Vector< BoundingBox4D > IMP::algebra::BoundingBox4Ds

Pass or store a set of BoundingBox4D .

Definition at line 176 of file BoundingBoxD.h.

 typedef BoundingBoxD<5> IMP::algebra::BoundingBox5D

Typedef for Python.

Definition at line 176 of file BoundingBoxD.h.

 typedef IMP::Vector< BoundingBox5D > IMP::algebra::BoundingBox5Ds

Pass or store a set of BoundingBox5D .

Definition at line 176 of file BoundingBoxD.h.

 typedef BoundingBoxD<6> IMP::algebra::BoundingBox6D

Typedef for Python.

Definition at line 176 of file BoundingBoxD.h.

 typedef IMP::Vector< BoundingBox6D > IMP::algebra::BoundingBox6Ds

Pass or store a set of BoundingBox6D .

Definition at line 176 of file BoundingBoxD.h.

 typedef BoundingBoxD<-1> IMP::algebra::BoundingBoxKD

Typedef for Python.

Definition at line 176 of file BoundingBoxD.h.

 typedef IMP::Vector< BoundingBoxKD > IMP::algebra::BoundingBoxKDs

Pass or store a set of BoundingBoxKD .

Definition at line 176 of file BoundingBoxD.h.

 typedef IMP::Vector< Cone3D > IMP::algebra::Cone3Ds

Pass or store a set of Cone3D .

Definition at line 64 of file Cone3D.h.

Pass or store a set of ConnollySurfacePoint .

Definition at line 46 of file algebra/connolly_surface.h.

 typedef IMP::Vector< Cylinder3D > IMP::algebra::Cylinder3Ds

Pass or store a set of Cylinder3D .

Definition at line 78 of file Cylinder3D.h.

 typedef Grid3D > IMP::algebra::DenseDoubleGrid3D

A grid of doubles over a region of space.

Definition at line 91 of file algebra/python_only.h.

 typedef Grid3D > IMP::algebra::DenseFloatGrid3D

A grid of floats over a region of space.

Definition at line 94 of file algebra/python_only.h.

 typedef IMP::Vector< Ellipsoid3D > IMP::algebra::Ellipsoid3Ds

Pass or store a set of Ellipsoid3D .

Definition at line 46 of file Ellipsoid3D.h.

 typedef IMP::Vector< FixedXYZ > IMP::algebra::FixedXYZs

Pass or store a set of FixedXYZ .

Definition at line 594 of file Rotation3D.h.

 typedef IMP::Vector< Gaussian3D > IMP::algebra::Gaussian3Ds

Pass or store a set of Gaussian3D .

Definition at line 43 of file Gaussian3D.h.

 typedef IMP::Vector< Line3D > IMP::algebra::Line3Ds

Pass or store a set of Line3D .

Definition at line 70 of file Line3D.h.

 typedef IMP::Vector< LinearFit2D > IMP::algebra::LinearFit2Ds

Pass or store a set of LinearFit2D .

Definition at line 52 of file LinearFit.h.

Pass or store a set of ParabolicFit2D .

Definition at line 54 of file ParabolicFit.h.

 typedef IMP::Vector< Plane3D > IMP::algebra::Plane3Ds

Pass or store a set of Plane3D .

Definition at line 78 of file Plane3D.h.

Pass or store a set of ReferenceFrame3D .

Definition at line 95 of file ReferenceFrame3D.h.

 typedef IMP::Vector< Reflection3D > IMP::algebra::Reflection3Ds

Pass or store a set of Reflection3D .

Definition at line 32 of file Reflection3D.h.

 typedef IMP::Vector< Rotation2D > IMP::algebra::Rotation2Ds

Pass or store a set of Rotation2D .

Definition at line 114 of file Rotation2D.h.

 typedef IMP::Vector< Rotation3D > IMP::algebra::Rotation3Ds

Pass or store a set of Rotation3D .

Definition at line 305 of file Rotation3D.h.

 typedef IMP::Vector< Segment3D > IMP::algebra::Segment3Ds

Pass or store a set of Segment3D .

Definition at line 46 of file Segment3D.h.

 typedef Grid3D > IMP::algebra::SparseIntGrid3D

A sparse grid of integers over a bounded region of space.

Definition at line 84 of file algebra/python_only.h.

 typedef Grid3D > IMP::algebra::SparseUnboundedIntGrid3D

A sparse grid of integers over all of space.

Definition at line 88 of file algebra/python_only.h.

 typedef SphereD<1> IMP::algebra::Sphere1D

Typedef for Python.

Definition at line 96 of file SphereD.h.

 typedef IMP::Vector< Sphere1D > IMP::algebra::Sphere1Ds

Pass or store a set of Sphere1D .

Definition at line 96 of file SphereD.h.

 typedef SphereD<2> IMP::algebra::Sphere2D

Typedef for Python.

Definition at line 96 of file SphereD.h.

 typedef IMP::Vector< Sphere2D > IMP::algebra::Sphere2Ds

Pass or store a set of Sphere2D .

Definition at line 96 of file SphereD.h.

 typedef SphereD<3> IMP::algebra::Sphere3D

Typedef for Python.

Definition at line 96 of file SphereD.h.

 typedef IMP::Vector< Sphere3D > IMP::algebra::Sphere3Ds

Pass or store a set of Sphere3D .

Definition at line 96 of file SphereD.h.

 typedef SphereD<4> IMP::algebra::Sphere4D

Typedef for Python.

Definition at line 96 of file SphereD.h.

 typedef IMP::Vector< Sphere4D > IMP::algebra::Sphere4Ds

Pass or store a set of Sphere4D .

Definition at line 96 of file SphereD.h.

 typedef SphereD<5> IMP::algebra::Sphere5D

Typedef for Python.

Definition at line 96 of file SphereD.h.

 typedef IMP::Vector< Sphere5D > IMP::algebra::Sphere5Ds

Pass or store a set of Sphere5D .

Definition at line 96 of file SphereD.h.

 typedef SphereD<6> IMP::algebra::Sphere6D

Typedef for Python.

Definition at line 96 of file SphereD.h.

 typedef IMP::Vector< Sphere6D > IMP::algebra::Sphere6Ds

Pass or store a set of Sphere6D .

Definition at line 96 of file SphereD.h.

 typedef SphereD<-1> IMP::algebra::SphereKD

Typedef for Python.

Definition at line 96 of file SphereD.h.

 typedef IMP::Vector< SphereKD > IMP::algebra::SphereKDs

Pass or store a set of SphereKD .

Definition at line 96 of file SphereD.h.

 typedef IMP::Vector< SpherePatch3D > IMP::algebra::SpherePatch3Ds

Pass or store a set of SpherePatch3D .

Definition at line 48 of file SpherePatch3D.h.

Pass or store a set of SphericalVector3D .

Definition at line 78 of file SphericalVector3D.h.

 typedef IMP::Vector< Torus3D > IMP::algebra::Torus3Ds

Pass or store a set of Torus3D .

Definition at line 61 of file Torus3D.h.

Pass or store a set of Transformation2D .

Definition at line 118 of file Transformation2D.h.

Pass or store a set of Transformation3D .

Definition at line 122 of file Transformation3D.h.

 typedef IMP::Vector< Triangle3D > IMP::algebra::Triangle3Ds

Pass or store a set of Triangle3D .

Definition at line 41 of file Triangle3D.h.

 typedef IMP::Vector< UnitSimplex1D > IMP::algebra::UnitSimplex1Ds

Pass or store a set of UnitSimplex1D .

Definition at line 103 of file UnitSimplexD.h.

 typedef IMP::Vector< UnitSimplex2D > IMP::algebra::UnitSimplex2Ds

Pass or store a set of UnitSimplex2D .

Definition at line 105 of file UnitSimplexD.h.

 typedef IMP::Vector< UnitSimplex3D > IMP::algebra::UnitSimplex3Ds

Pass or store a set of UnitSimplex3D .

Definition at line 107 of file UnitSimplexD.h.

 typedef IMP::Vector< UnitSimplex4D > IMP::algebra::UnitSimplex4Ds

Pass or store a set of UnitSimplex4D .

Definition at line 109 of file UnitSimplexD.h.

 typedef IMP::Vector< UnitSimplex5D > IMP::algebra::UnitSimplex5Ds

Pass or store a set of UnitSimplex5D .

Definition at line 111 of file UnitSimplexD.h.

 typedef IMP::Vector< UnitSimplex6D > IMP::algebra::UnitSimplex6Ds

Pass or store a set of UnitSimplex6D .

Definition at line 113 of file UnitSimplexD.h.

 typedef IMP::Vector< UnitSimplexKD > IMP::algebra::UnitSimplexKDs

Pass or store a set of UnitSimplexKD .

Definition at line 115 of file UnitSimplexD.h.

 typedef VectorD<1> IMP::algebra::Vector1D

1D vector typedef for swig

Definition at line 413 of file VectorD.h.

 typedef Vector > IMP::algebra::Vector1Ds

1D vectors typedef for swig

Definition at line 415 of file VectorD.h.

 typedef VectorD<2> IMP::algebra::Vector2D

2D vector typedef for swig

Definition at line 417 of file VectorD.h.

 typedef Vector > IMP::algebra::Vector2Ds

2D vectors typedef for swig

Definition at line 419 of file VectorD.h.

 typedef VectorD<3> IMP::algebra::Vector3D

3D vector typedef for swig

Examples:
grid.cpp.

Definition at line 421 of file VectorD.h.

 typedef Vector > IMP::algebra::Vector3Ds

3D vectors typedef for swig

Definition at line 423 of file VectorD.h.

 typedef VectorD<4> IMP::algebra::Vector4D

4D vector typedef for swig

Definition at line 425 of file VectorD.h.

 typedef Vector > IMP::algebra::Vector4Ds

4D vectors typedef for swig

Definition at line 427 of file VectorD.h.

 typedef VectorD<5> IMP::algebra::Vector5D

5D vector typedef for swig

Definition at line 429 of file VectorD.h.

 typedef Vector > IMP::algebra::Vector5Ds

5D vectors typedef for swig

Definition at line 431 of file VectorD.h.

 typedef VectorD<6> IMP::algebra::Vector6D

6D vector typedef for swig

Definition at line 433 of file VectorD.h.

 typedef Vector > IMP::algebra::Vector6Ds

6D vector typedef for swig

Definition at line 435 of file VectorD.h.

 typedef VectorD<-1> IMP::algebra::VectorKD

KD vector typedef for swig

Definition at line 437 of file VectorD.h.

A vector of reference-counting object pointers.

Definition at line 31 of file vector_metrics.h.

A vector of weak (non reference-counting) pointers to specified objects.

VectorKDMetric

Definition at line 31 of file vector_metrics.h.

 typedef Vector > IMP::algebra::VectorKDs

KD vectors typedef for swig

Definition at line 439 of file VectorD.h.

## Function Documentation

template<int D>
 int IMP::algebra::compare ( const VectorD< D > & a, const VectorD< D > & b )

lexicographic comparison of two vectors

Note that this is not very reliable and probably should not be used.

VectorD

Definition at line 179 of file VectorD.h.

 Rotation2D IMP::algebra::compose ( const Rotation2D & a, const Rotation2D & b )

Compose two rotations a and b.

For any vector v (a*b)*v = a*(b*v).

Definition at line 108 of file Rotation2D.h. Here is the call graph for this function:

 Transformation2D IMP::algebra::compose ( const Transformation2D & a, const Transformation2D & b )

Compose two transformations.

For any vector v (a*b)*v = a*(b*v).

Transformation2D

Definition at line 144 of file Transformation2D.h. Here is the call graph for this function:

 Transformation3D IMP::algebra::compose ( const Transformation3D & a, const Transformation3D & b )

Compose two transformations.

For any vector v (a*b)*v = a*(b*v).

Transformation3D

Definition at line 146 of file Transformation3D.h. Here is the call graph for this function:

 Rotation3D IMP::algebra::compose ( const Rotation3D & a, const Rotation3D & b )
Rotation3D

Definition at line 495 of file Rotation3D.h.

Get adjoint of inputs to compose from adjoint of output.

Compute the adjoint (reverse-mode sensitivity) of input transformations to compose from the adjoint of the output transformation.

Get adjoint of inputs to compose from adjoint of output.

Compute the adjoint (reverse-mode sensitivity) of input transformations to compose from the adjoint of the output transformation.

 void IMP::algebra::compose_adjoint ( const Rotation3D & A, const Rotation3D & B, Vector4D DC, Rotation3DAdjoint * DA, Rotation3DAdjoint * DB )

Get adjoint of inputs to compose from adjoint of output.

Compute the adjoint (reverse-mode sensitivity) of input rotations to compose from the adjoint of the output rotation.

Get adjoint of inputs to compose from adjoint of output.

Compute the adjoint (reverse-mode sensitivity) of input rotations to compose from the adjoint of the output rotation.

 Transformation3Ds IMP::algebra::get_alignments_from_first_to_second ( const PrincipalComponentAnalysisD< 3 > & pca1, const PrincipalComponentAnalysisD< 3 > & pca2 )

Get all alignments of the first principal component system to the second one.

 double IMP::algebra::get_angle ( const Line3D & a, const Line3D & b )

Get angle in radians between two lines around their closest points.

 bool IMP::algebra::get_are_almost_equal ( const double a, const double b, const double epsilon )

Compare two values for "almost equal" (intended for doubles)

epsilon is the tolerance allowed to consider the values as equal

Definition at line 107 of file algebra/utility.h.

 bool IMP::algebra::get_are_colinear ( const Vector3D & p1, const Vector3D & p2, const Vector3D & p3 )

Return true if the three points are co-linear.

template<class Geometry >
 double IMP::algebra::get_area ( const Geometry & )

Compute the area of any surface object.

 std::pair IMP::algebra::get_axis_and_angle ( const Rotation3D & rot )

Decompose a Rotation3D object into a rotation around an axis.

For all identity rotations, returns the axis [1,0,0] and the angle 0.0.

Note
http://en.wikipedia.org/wiki/Rotation_matrix
www.euclideanspace.com/maths/geometry/rotations/conversions/ angleToQuaternion/index.htm
Rotation3D
Returns
 double IMP::algebra::get_ball_radius_from_volume_3d ( double volume )

Return the radius of a sphere with a given volume.

Sphere3D

Definition at line 35 of file Sphere3D.h.

template<int D>
 VectorD IMP::algebra::get_basis_vector_d ( unsigned int coordinate )

Return the basis vector for the given coordinate.

Return the unit vector pointing in the direction of the requested coordinate. That is

get_basis_vector_d<3>(2)== Vector3D(0,0,1);
VectorD

Definition at line 222 of file VectorD.h.

template<int D>
 VectorD<-1 > IMP::algebra::get_basis_vector_kd ( int Di, unsigned int coordinate )

Return the basis vector for the given coordinate.

Return a dynamically sized basis vector.

Definition at line 236 of file VectorD.h.

template<>
 VectorD<-1> IMP::algebra::get_basis_vector_kd ( int D, unsigned int coordinate )

Return a dynamically sized basis vector.

Definition at line 244 of file VectorD.h.

template<class Geometry >
 BoundingBoxD<3> IMP::algebra::get_bounding_box ( const Geometry & )

Compute the bounding box of any geometric object.

 Vector3D IMP::algebra::get_centroid ( const Vector3Ds & ps )

Return the centroid of a set of vectors.

Vector3D

Definition at line 68 of file Vector3D.h.

 double IMP::algebra::get_closer_power_of_2 ( double x )

Closest power of 2 for a number, not necessarily higher.

Definition at line 90 of file algebra/utility.h.

 ConnollySurfacePoints IMP::algebra::get_connolly_surface ( const algebra::Sphere3Ds & spheres, double density, double probe_radius )

The algorithm is taken from Connolly's original MS program, which is freely distributable and Copyright 1983, Michael Connolly.

M.L. Connolly, "Solvent-accessible surfaces of proteins and nucleic acids", Science, 221, p709-713 (1983).

M.L. Connolly, "Analytical molecular surface calculation", J. Appl. Cryst. 16, p548-558 (1983).

template<typename T >
 T IMP::algebra::get_constrained ( const T x, const T x0, const T xF )

Constrain a value between two given limits.

Definition at line 65 of file algebra/utility.h.

 Eigen::Matrix3d IMP::algebra::get_covariance ( const Gaussian3D & g )

Return the covariance matrix from a given set of standard deviations in the passed reference frame.

template<unsigned int D>
 BoundingBoxD IMP::algebra::get_cube_d ( double radius )

Cube with radius of length radius.

BoundingBoxD

Definition at line 194 of file BoundingBoxD.h.

 BoundingBoxD<-1> IMP::algebra::get_cube_kd ( unsigned int d, double radius )

Cube with radius of length side.

BoundingBoxD

Definition at line 201 of file BoundingBoxD.h. Here is the call graph for this function:

 std::string IMP::algebra::get_data_path ( std::string file_name )

Return the full path to one of this module's data files.

To read the data file "data_library" that was placed in the data directory of this module, do something like

std::ifstream in(IMP::algebra::get_data_path("data_library"));

This will ensure that the code works both when IMP is installed or if used via the setup_environment.sh script.

Note
Each module has its own data directory, so be sure to use this function from the correct module.
 double IMP::algebra::get_distance ( const Segment3D & s, const Vector3D & p )

Get the distance between a segment and a point.

Segment3D
 double IMP::algebra::get_distance ( const Plane3D & pln, const Vector3D & p )

Return the distance between a plane and a point in 3D.

Plane3D

Definition at line 63 of file Plane3D.h. Here is the call graph for this function:

 double IMP::algebra::get_distance ( const Segment3D & a, const Segment3D & b )

Get the distance between two segments.

Segment3D
 double IMP::algebra::get_distance ( const Line3D & s, const Vector3D & p )

Get closest distance between a line and a point.

Examples:
grid.cpp.
 double IMP::algebra::get_distance ( const Line3D & a, const Line3D & b )

Get the closest distance between two lines.

template<int D>
 double IMP::algebra::get_distance ( const SphereD< D > & a, const SphereD< D > & b )

Return the distance between the two spheres if they are disjoint.

If they intersect, the distances are not meaningful.

SphereD

Definition at line 112 of file SphereD.h.

template<int D>
 double IMP::algebra::get_distance ( const VectorD< D > & v1, const VectorD< D > & v2 )

Compute the distance between two vectors.

VectorD

Definition at line 209 of file VectorD.h. Here is the call graph for this function:

 double IMP::algebra::get_distance ( const Rotation3D & r0, const Rotation3D & r1 )

Return a distance between the two rotations.

The distance runs between 0 and 1. More precisely, the distance returned is distance between the two quaternion vectors properly normalized, divided by sqrt(2).

A vector with distance d from the unit vector represents a rotation of

$$\theta= \cos^{-1}\left(1-\sqrt{2}d\right)$$

Rotation3D

Definition at line 370 of file Rotation3D.h. Here is the call graph for this function:

 IntPairs IMP::algebra::get_edges ( const BoundingBoxD< 3 > & )

Return the edges of the box as indices into the vertices list.

BoundingBoxD

Definition at line 307 of file BoundingBoxD.h.

template<int D>
 VectorD IMP::algebra::get_elementwise_product ( const algebra::VectorD< D > & a, const algebra::VectorD< D > & b )

Return the vector that is the elementwise product of the two.

VectorD

Definition at line 457 of file VectorD.h.

template<int D>
 VectorD IMP::algebra::get_elementwise_product ( const Ints & a, const algebra::VectorD< D > & b )

Return the vector that is the elementwise product of the two.

VectorD

Definition at line 469 of file VectorD.h.

template<int D>
 VectorD IMP::algebra::get_embedded_from_increasing ( const UnitSimplexD< D > & s, const VectorD< D > & p )

Convert point on simplex from increasing to embedded coordinates.

get_increasing_from_embedded

Definition at line 151 of file UnitSimplexD.h. Here is the call graph for this function:

 Sphere3D IMP::algebra::get_enclosing_sphere ( const Sphere3Ds & ss )

Return a sphere containing the listed spheres.

Sphere3D
Note
This method produces tighter bounding spheres if CGAL is used.
 Sphere3D IMP::algebra::get_enclosing_sphere ( const Vector3Ds & ss )

Return a sphere containing the listed vectors.

Sphere3D
Vector3D
Note
This method produces tighter bounding spheres if CGAL is used.
 std::string IMP::algebra::get_example_path ( std::string file_name )

Return the full path to one of this module's example files.

To read the example file "example_protein.pdb" that was placed in the examples directory of this module, do something like

std::ifstream in(IMP::algebra::get_example_path("example_protein.pdb"));

This will ensure that the code works both when IMP is installed or if used via the setup_environment.sh script.

Note
Each module has its own example directory, so be sure to use this function from the correct module.
 FixedXYZ IMP::algebra::get_fixed_xyz_from_rotation ( const Rotation3D & r )

The inverse of rotation_from_fixed_xyz()

rotation_from_fixed_xyz()
Rotation3D
FixesXYZ
 Gaussian3D IMP::algebra::get_gaussian_from_covariance ( const Eigen::Matrix3d & covariance, const Vector3D & center )

Return a Gaussian centered at the origin from a covariance matrix.

template<int D>
 Vector > IMP::algebra::get_grid_interior_cover_by_spacing ( const BoundingBoxD< D > & bb, double s )

Cover the interior of the bounding box by equal sized parallelograms of approximately full-width s, returning the list of centers of the cubes.

Definition at line 179 of file vector_generators.h. Here is the call graph for this function:

 Vector3Ds IMP::algebra::get_grid_surface_cover ( const Cylinder3D & cyl, int number_of_cycles, int number_of_points_on_cycle )

Generate a grid of 3d points on a cylinder surface.

Vector3D
Cylinder3D
 Rotation2D IMP::algebra::get_identity_rotation_2d ( )

Build an identity rotation in 2D.

Definition at line 90 of file Rotation2D.h.

 Rotation3D IMP::algebra::get_identity_rotation_3d ( )

Return a rotation that does not do anything.

Rotation3D

Definition at line 356 of file Rotation3D.h.

 Transformation2D IMP::algebra::get_identity_transformation_2d ( )

Return a transformation that does not do anything.

Transformation2D

Definition at line 123 of file Transformation2D.h. Here is the call graph for this function:

 Transformation3D IMP::algebra::get_identity_transformation_3d ( )

Return a transformation that does not do anything.

Transformation3D

Definition at line 126 of file Transformation3D.h. Here is the call graph for this function:

template<int D>
 VectorD IMP::algebra::get_increasing_from_embedded ( const UnitSimplexD< D > & s, const VectorD< D > & p )

Convert point on simplex from embedded to increasing coordinates.

Increasing coordinates are defined as the vector whose elements contain the cumulative sum of all embedded coordinates of lower indices.

Definition at line 137 of file UnitSimplexD.h. Here is the call graph for this function:

template<int D>
 bool IMP::algebra::get_interiors_intersect ( const SphereD< D > & a, const SphereD< D > & b )

Return true if the two balls bounded by the two spheres intersect.

SphereD

Definition at line 132 of file SphereD.h. Here is the call graph for this function:

template<int D>
 bool IMP::algebra::get_interiors_intersect ( const BoundingBoxD< D > & a, const BoundingBoxD< D > & b )

Return true if they intersect.

BoundingBoxD

Definition at line 209 of file BoundingBoxD.h. Here is the call graph for this function:

 Rotation3D IMP::algebra::get_interpolated ( const Rotation3D & a, const Rotation3D & b, double f )

Interpolate between two rotations.

It f ==0, return b, if f==1 return a.

Rotation3D

Definition at line 609 of file Rotation3D.h. Here is the call graph for this function:

template<int D>
 BoundingBoxD IMP::algebra::get_intersection ( const BoundingBoxD< D > & a, const BoundingBoxD< D > & b )

Return the intersecting bounding box.

BoundingBoxD

Definition at line 223 of file BoundingBoxD.h. Here is the call graph for this function:

 bool IMP::algebra::get_is_big_endian ( )

Returns 1 if machine is big endian else 0.

 bool IMP::algebra::get_is_little_endian ( )

Returns 1 if machine is little endian else 0.

 Eigen::MatrixXd IMP::algebra::get_jacobian_of_composed_wrt_first ( const Rotation3D & q, const Rotation3D & p, bool wrt_unnorm = false )

Get gradient of quaternion product with respect to first quaternion.

Given the rotation $$R(p)$$ followed by $$R(q)$$, where $$p$$ and $$q$$ are quaternions, the quaternion of the composed rotation $$R(s)=R(q) R(p)$$ can be expressed through the Hamilton product of the two quaternions $$s(q,p) = q p$$. This function returns the matrix $$J$$ with elements $$J_{ij}=\frac{\partial s_i}{\partial q_j}$$.

Parameters
 [in] q rotation corresponding to first quaternion [in] p rotation corresponding to second quaternion [in] wrt_unnorm Jacobian is computed wrt unnormalized quaternion. Rotation includes a normalization operation, and the columns are projected to the tangent space at $$q$$.
 Eigen::MatrixXd IMP::algebra::get_jacobian_of_composed_wrt_second ( const Rotation3D & q, const Rotation3D & p, bool wrt_unnorm = false )

Get Jacobian of quaternion product with respect to second quaternion.

Given the rotation $$R(p)$$ followed by $$R(q)$$, where $$p$$ and $$q$$ are quaternions, the quaternion of the composed rotation $$R(s)=R(q) R(p)$$ can be expressed through the Hamilton product of the two quaternions $$s(q,p) = q p$$. This function returns the matrix $$J$$ with elements $$J_{ij}=\frac{\partial s_i}{\partial p_j}$$.

Parameters
 [in] q rotation corresponding to first quaternion [in] p rotation corresponding to second quaternion [in] wrt_unnorm Jacobian is computed wrt unnormalized quaternion. Rotation includes a normalization operation, and the columns are projected to the tangent space at $$p$$.
 Triangle3D IMP::algebra::get_largest_triangle ( const Vector3Ds & points )

Return the largest triangle defined by 3 points from the input.

Triangle3D
template<int D, class Storage , class Value , class Embedding >
 Value IMP::algebra::get_linearly_interpolated ( const GridD< D, Storage, Value, Embedding > & g, const VectorD< D > & pt )

Get the value from the grid with linear interpolation.

Values outside the bounding box are snapped to the bounding box (effectively extending the boundary values out to infinity).

Examples:
grid.cpp.

Definition at line 23 of file grid_utility.h.

template<class VT >
 double IMP::algebra::get_magnitude_and_normalize_in_place ( VT & vt )

Returns the magnitude of vt and turns it to a unit vector in place.

Note
If the magnitude of this vector is smaller than 1e-12 (an arbitrarily selected small number), vt is turned into a unit vector pointing at a random direction.

Definition at line 260 of file VectorBaseD.h. Here is the call graph for this function:

template<int D>
 double IMP::algebra::get_maximum_length ( const BoundingBoxD< D > & a )

Return the maximum axis aligned extent.

BoundingBoxD

Definition at line 262 of file BoundingBoxD.h. Here is the call graph for this function:

 std::string IMP::algebra::get_module_version ( )

Return the version of this module, as a string.

Note
This function is only available in Python.

Definition at line 5 of file EMageFit/__init__.py.

 float IMP::algebra::get_next_larger_power_of_2 ( float x )

Closest power of 2 that can contain a number x.

Definition at line 72 of file algebra/utility.h.

 double IMP::algebra::get_next_larger_power_of_2 ( double x )

Closest power of 2 that can contain a number x.

Definition at line 81 of file algebra/utility.h.

template<int D>
 VectorD IMP::algebra::get_ones_vector_d ( double v = 1 )

Return a vector of ones (or another constant)

Definition at line 297 of file VectorD.h.

template<int D>
 VectorD<-1 > IMP::algebra::get_ones_vector_kd ( unsigned int Di, double v = 1 )

Return a vector of ones (or another constant)

Return a dynamically sized vector of zeros.

Di must equal D.

Definition at line 309 of file VectorD.h.

template<>
 VectorD<-1> IMP::algebra::get_ones_vector_kd ( unsigned int D, double v )

Return a vector of ones (or another constant)

Definition at line 317 of file VectorD.h.

 Vector3D IMP::algebra::get_orthogonal_vector ( const Vector3D & v )

Return a vector that is perpendicular to the given vector.

Note
This is occasionally referred to in the code as a "vertical" vector.
Vector3D

Definition at line 51 of file Vector3D.h.

template<int D>
 double IMP::algebra::get_power_distance ( const SphereD< D > & a, const SphereD< D > & b )

Return the power distance between the two spheres.

The power distance is the square of the distance between the centers minus the sum of the square of the radii.

SphereD

Definition at line 123 of file SphereD.h.

template<int D>
 PrincipalComponentAnalysisD IMP::algebra::get_principal_components ( const Vector< VectorD< D > > & ps )

Perform principal components analysis on a set of vectors.

PrincipalComponentAnalysis

Definition at line 108 of file eigen_analysis.h. Here is the call graph for this function:

 Vector3D IMP::algebra::get_projected ( const Line3D & l, const Vector3D & p )

Project a point onto the line.

This is equivalent to the point on the line closest to the provided point.

 algebra::Segment3D IMP::algebra::get_projected ( const Line3D & l, const algebra::Segment3D & s )

Project a segment onto a line.

template<int D>
 VectorD IMP::algebra::get_projected ( const UnitSimplexD< D > & s, const VectorD< D > & p )

Any negative weights are set to 0, and the unit l1-norm is enforced. The algorithm used to project to the simplex is described in arXiv:1309.1541. It finds a threshold below which all weights are set to 0 and above which all weights shifted by the threshold sum to 1.

Definition at line 170 of file UnitSimplexD.h. Here is the call graph for this function:

 double IMP::algebra::get_radius_of_gyration ( const Vector3Ds & ps )

Return the radius of gyration of a set of points.

Definition at line 77 of file Vector3D.h. Here is the call graph for this function:

 Vector3Ds IMP::algebra::get_random_chain ( unsigned int n, double r, const Vector3D & start = Vector3D(0, 0, 0), const Sphere3Ds & obstacles = Sphere3Ds() )

Generate a random chain with no collisions.

This function generates a random chain, starting at (0,0,0) with n particles each with radius r. Consecutive particles are approximately distance 2r apart and no pair of particles is closer than 2r.

If an obstacles parameter is provided then chain spheres also don't intersect the obstacle spheres.

Note
The current implementation is not very clever and can be made more clever if needed.
 Transformation3D IMP::algebra::get_random_local_transformation ( Vector3D origin, double max_translation = 5., double max_angle_in_rad = 0.26 )

Get a local transformation.

Note
randomly select an axis that passes through the input point and rotate around it
Parameters
 [in] origin the origin of the rotation [in] max_translation default value is 5 [in] max_angle_in_rad default value is 15 degree in radians
 Rotation2D IMP::algebra::get_random_rotation_2d ( )

Build an identity rotation in 2D.

Definition at line 93 of file Rotation2D.h.

 Rotation3D IMP::algebra::get_random_rotation_3d ( )

Pick a rotation at random from all possible rotations.

Rotation3D
 Rotation3D IMP::algebra::get_random_rotation_3d ( const Rotation3D & center, double distance )

Pick a rotation at random near the provided one.

This method generates a rotation that is within the provided distance of center.

Parameters
 [in] center The center of the rotational volume [in] distance See get_distance(const Rotation3D&,const Rotation3D&) for a full definition.
Note
The cost of this operation increases as distance goes to 0.
Rotation3D
template<int D>
 VectorD IMP::algebra::get_random_vector_in ( const BoundingBoxD< D > & bb )

Generate a random vector in a box with uniform density.

BoundingBoxD
VectorD

Definition at line 39 of file vector_generators.h. Here is the call graph for this function:

template<int D>
 VectorD IMP::algebra::get_random_vector_in ( const SphereD< D > & s )

Generate a random vector in a sphere with uniform density.

VectorD
SphereD

Definition at line 57 of file vector_generators.h. Here is the call graph for this function:

 VectorD<2> IMP::algebra::get_random_vector_in ( const SphereD< 2 > & s )

Generates a random vector in a circle with uniform density with respect to the area of the circle

Parameters
 s a 2D sphere (circle)
VectorD
SphereD
 Vector3D IMP::algebra::get_random_vector_in ( const Cylinder3D & c )

Generate a random vector in a cylinder with uniform density.

VectorD
Cylinder3D
template<int D>
 VectorD IMP::algebra::get_random_vector_on ( const BoundingBoxD< D > & bb )

Generate a random vector on a box with uniform density.

BoundingBoxD
VectorD

Definition at line 48 of file vector_generators.h.

template<int D>
 VectorD IMP::algebra::get_random_vector_on ( const SphereD< D > & s )

Generate a random vector on a sphere with uniform density.

VectorD
SphereD

Definition at line 100 of file vector_generators.h. Here is the call graph for this function:

template<int D>
 VectorD IMP::algebra::get_random_vector_on ( const UnitSimplexD< D > & s )

Generate a random vector on a unit simplex with uniform density.

VectorD
UnitSimplexD

Definition at line 145 of file vector_generators.h.

 VectorD<3> IMP::algebra::get_random_vector_on_unit_sphere ( )

returns a random vector on a sphere of radius 1 with uniform density and implementation optimized for the 3D + unit vector case

Definition at line 91 of file vector_generators.h.

 DenseGrid3D IMP::algebra::get_rasterized ( const Gaussian3Ds & gmm, const Floats & weights, double cell_width, const BoundingBox3D & bb )

Rasterize the Gaussians to a grid.

 DenseGrid3D IMP::algebra::get_rasterized_fast ( const Gaussian3Ds & gmm, const Floats & weights, double cell_width, const BoundingBox3D & bb, double factor = 2.5 )

Rasterize the Gaussians to a grid.

The result is an approximation, but is obtained significantly faster. Good for quickly checking a GMM.

 Vector3D IMP::algebra::get_reflected ( const Plane3D & pln, const Vector3D & p )

Return the point reflected about the plane.

Definition at line 68 of file Plane3D.h. Here is the call graph for this function:

 double IMP::algebra::get_relative_projection_on_segment ( const Segment3D & s, const algebra::Vector3D & p )

Return the 'relative' projection of a point p onto the line that contains s.

Formally, the projection of p onto the line through s is s+f*(s-s) f is in the range [0..1] if the projection of p is inside s.

Parameters
 s segment in 3D p point in 3D
Returns
the 'relative' projection of p onto the line containing s
template<class Vector3DsOrXYZs0 , class Vector3DsOrXYZs1 >
 double IMP::algebra::get_rmsd ( const Vector3DsOrXYZs0 & m1, const Vector3DsOrXYZs1 & m2 )

Definition at line 47 of file algebra/distance.h. Here is the call graph for this function:

template<class Vector3DsOrXYZs0 , class Vector3DsOrXYZs1 >
 double IMP::algebra::get_rmsd_transforming_first ( const Transformation3D & tr, const Vector3DsOrXYZs0 & m1, const Vector3DsOrXYZs1 & m2 )

Calculate the root mean square deviation between two sets of 3D points.

Note
the function assumes correspondence between the two sets of points and does not perform rigid alignment.

Definition at line 27 of file algebra/distance.h. Here is the call graph for this function:

 Rotation3D IMP::algebra::get_rotation_about_axis ( const Vector3D & axis, double angle )

Generate a Rotation3D object from a rotation around an axis.

Parameters
 [in] axis the rotation axis passes through (0,0,0) [in] angle the rotation angle in radians in the clockwise direction
Note
http://en.wikipedia.org/wiki/Rotation_matrix
www.euclideanspace.com/maths/geometry/rotations/conversions/ angleToQuaternion/index.htm
Rotation3D

Definition at line 421 of file Rotation3D.h. Here is the call graph for this function:

 Rotation3D IMP::algebra::get_rotation_about_normalized_axis ( const Vector3D & axis_norm, double angle )

Generate a Rotation3D object from a rotation around an axis that is assumed to be normalized

Parameters
 [in] axis_norm the normalized rotation axis passing through (0,0,0) [in] angle the rotation angle in radians in the clockwise direction
Note
http://en.wikipedia.org/wiki/Rotation_matrix
www.euclideanspace.com/maths/geometry/rotations/conversions/ angleToQuaternion/index.htm
Rotation3D

Definition at line 395 of file Rotation3D.h.

 Transformation2D IMP::algebra::get_rotation_about_point ( const Vector2D & point, const Rotation2D & rotation )

Generate a Transformation2D object from a rotation around a point.

Generate a Transformation2D to rotate about a point rather than the origin.

Parameters
 [in] point Center to rotate about [in] rotation The rotation to perform (defined taking the origin as reference, not the new point).
Transformation2D

Definition at line 135 of file Transformation2D.h. Here is the call graph for this function:

 Transformation3D IMP::algebra::get_rotation_about_point ( const Vector3D & point, const Rotation3D & rotation )

Generate a Transformation3D object from a rotation around a point.

Rotate about a point rather than the origin.

Parameters
 [in] point Center to rotate about [in] rotation The rotation to perform
Transformation3D

Definition at line 137 of file Transformation3D.h.

 Rotation3D IMP::algebra::get_rotation_from_fixed_xyz ( double xr, double yr, double zr )

Initialize a rotation in x-y-z order from three angles.

Parameters
 [in] xr Rotation around the X axis in radians [in] yr Rotation around the Y axis in radians [in] zr Rotation around the Z axis in radians
Note
The three rotations are represented in the original (fixed) coordinate frame.
Rotation3D
FixedXYZ
 Rotation3D IMP::algebra::get_rotation_from_fixed_zxz ( double phi, double theta, double psi )

Initialize a rotation from Euler angles.

Parameters
 [in] phi Rotation around the Z axis in radians [in] theta Rotation around the X axis in radians [in] psi Rotation around the Z axis in radians
Note
The first rotation is by an angle phi about the z-axis. The second rotation is by an angle theta in [0,pi] about the former x-axis , and the third rotation is by an angle psi about the former z-axis.
Rotation3D
 Rotation3D IMP::algebra::get_rotation_from_fixed_zyz ( double Rot, double Tilt, double Psi )

Generate a rotation object from Euler Angles.

Note
The first rotation is by an angle about the z-axis. The second rotation is by an angle about the new y-axis. The third rotation is by an angle about the new z-axis.
Parameters
 [in] Rot First Euler angle (radians) defining the rotation (Z axis) [in] Tilt Second Euler angle (radians) defining the rotation (Y axis) [in] Psi Third Euler angle (radians) defining the rotation (Z axis)
Rotation3D
 Rotation3D IMP::algebra::get_rotation_from_matrix ( double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22 )

Generate a Rotation3D object from a rotation matrix.

Rotation3D
 Rotation3D IMP::algebra::get_rotation_from_matrix ( Eigen::Matrix3d m )

Generate a Rotation3D object from a rotation matrix.

Rotation3D
 Rotation3D IMP::algebra::get_rotation_from_vector4d ( const VectorD< 4 > & v )

Compute a rotation from an unnormalized quaternion.

Rotation3D

Definition at line 488 of file Rotation3D.h.

 Rotation3D IMP::algebra::get_rotation_from_x_y_axes ( const Vector3D & x, const Vector3D & y )

Return the rotation which takes the native x and y axes to the given x and y axes. The two axes must be perpendicular unit vectors.

 Rotation3D IMP::algebra::get_rotation_taking_first_to_second ( const Vector3D & v1, const Vector3D & v2 )

Create a rotation from the first vector to the second one.

Rotation3D
 Rotation2D IMP::algebra::get_rotation_to_x_axis ( const Vector2D & v )

Build the rotation that transforms the vector X of the origin of coordinates into the given vector

Definition at line 100 of file Rotation2D.h.

template<typename T >
 int IMP::algebra::get_rounded ( const T & x )

Rounds a number to next integer.

The result is of type integer but the argument can be of any type. Some examples:

a = round(-0.7); // a = -1
a = round(-0.2); // a = 0
a = round(0.2); // a = 0
a = round(0.7); // a = 1

Definition at line 43 of file algebra/utility.h.

 algebra::Segment3D IMP::algebra::get_segment_connecting_first_to_second ( const Line3D & a, const Line3D & b )

Get shortest possible segment from the first line to the second.

Note
If the lines are parallel, this segment is not unique and is chosen so that the segment passes closest to the origin.
 Segment3D IMP::algebra::get_shortest_segment ( const Segment3D & s, const Vector3D & p )
 Segment3D IMP::algebra::get_shortest_segment ( const Segment3D & sa, const Segment3D & sb )
Segment3D
template<typename T >
 int IMP::algebra::get_sign ( const T & x )

Sign of a number. 1 if the number is higher or equal to 0 and -1 otherwise.

Definition at line 25 of file algebra/utility.h.

 Sphere3Ds IMP::algebra::get_simplified_from_volume ( Sphere3Ds in, double maximum_allowed_error_angstroms )

Get a set of balls that approximates the surface of the passed set.

Any point in the old surface will be within roughly maximum_allowed_error_angstroms of a point in the new surface and any point outside the old volume will be within roughly maximum_allowed_error_angstroms of a point outside the new volume.

Note
The name may change if someone thinks up a better one.
template<int D>
 double IMP::algebra::get_squared_distance ( const VectorD< D > & v1, const VectorD< D > & v2 )

Compute the squared distance between two vectors.

VectorD

Definition at line 201 of file VectorD.h.

template<class Geometry >
 double IMP::algebra::get_surface_area ( const Geometry & )

Compute the surface area of any volumetric object.

 FloatPair IMP::algebra::get_surface_area_and_volume ( const algebra::Sphere3Ds & ss )

Get surface area & volume of the union of the balls bounded by the spheres.

This method requires CGAL to work.

 Transformation3D IMP::algebra::get_transformation_3d ( const Transformation2D & t2d )

Build a 3D transformation from a 2D one.

Note
The 3D transformation is built with the 2D rotation becoming a rotation around the z axis.
template<class Vector3DsOrXYZs0 , class Vector3DsOrXYZs1 >
 IMP::algebra::Transformation3D IMP::algebra::get_transformation_aligning_first_to_second ( const Vector3DsOrXYZs0 & source, const Vector3DsOrXYZs1 & target )

Compute the rigid transform bringing the first point set to the second.

The points are assumed to be corresponding (that is, from is aligned to to etc.). The alignment computed is that which minimizes the sum of squared distances between corresponding points. This uses the Kabsch algorithm.

Returns
the

$\textit{argmin}_T \sum \left|T\left(f\left[i\right]\right)-t[i]\right|^2$

If the point sets lie in a 1 or 2 dimensional subspace, the alignment algorithm is unstable and not guaranteed to work. A warning is printed in this case.

Transformation3D
Vector3D

Definition at line 45 of file geometric_alignment.h. Here is the call graph for this function:

 Transformation3D IMP::algebra::get_transformation_aligning_first_to_second ( Vector3Ds a, Vector3Ds b )

Equivalent to

 Transformation2D IMP::algebra::get_transformation_aligning_pair ( const Vector2Ds & set_from, const Vector2Ds & set_to )

Builds the transformation required to obtain a set of points from the first one

Note
The function assumes that the relative distances between points are conserved.
 Transformation3D IMP::algebra::get_transformation_from_first_triangle_to_second ( Triangle3D first_tri, Triangle3D second_tri )

Return a transformation between two triangles.

 BoundingBoxD<3> IMP::algebra::get_transformed ( const BoundingBoxD< 3 > & bb, const Transformation3D & tr )

Return a bounding box containing the transformed box.

Definition at line 197 of file Transformation3D.h. Here is the call graph for this function:

template<class Storage , class Embedding >
 const Storage::Value IMP::algebra::get_trilinearly_interpolated ( const GridD< 3, Storage, typename Storage::Value, Embedding > & g, const Vector3D & v, const typename Storage::Value & outside = 0 )

Use trilinear interpolation to compute a smoothed value at v.

The voxel values are assumed to be at the center of the voxel and the passed outside value is used for voxels outside the grid. The type Voxel must support get_linearly_interpolated().

get_linearly_interpolated()
GridD

Definition at line 36 of file grid_utility.h. Here is the call graph for this function:

 Rotation3Ds IMP::algebra::get_uniform_cover_rotations_3d ( unsigned int num_points )

Cover the space of rotations evenly.

If you care about the distance between samples instead of the number of samples, the "surface area" of the set of rotations is pi^2. If you allocate each sample a volume of 4/3 pi d^3 (to space them d apart), Then you want 3/4 pi/d^3 points.

Creates at least num_points rotations.

template<int D>
 Vector > IMP::algebra::get_uniform_surface_cover ( const SphereD< D > & s, unsigned int n )

Generate a set of vectors which covers a sphere uniformly.

The function is currently pretty slow, especially in non-optimized builds. Complain if this bugs you. We might be able to do better, at least in 3D.

Creates at least the requested number of points.

Note
This predicates will produce guaranteed correct results if IMP.cgal is available (the results will be unreliable if it is not).
VectorD
SphereD

Definition at line 116 of file vector_generators.h.

 Vector3Ds IMP::algebra::get_uniform_surface_cover ( const Cylinder3D & cyl, int number_of_points )

Generate a set of 3d points that uniformly cover a cylinder.

VectorD
Cylinder3D
 Vector3Ds IMP::algebra::get_uniform_surface_cover ( const SpherePatch3D & sph, unsigned int number_of_points )

Generate a set of 3d points that uniformly cover a patch of a sphere.

Note
the implementation can be improved
SpherePatch3D
VectorD
 Vector3Ds IMP::algebra::get_uniform_surface_cover ( const Cone3D & cone, unsigned int number_of_points )
VectorD
Cone3D
 Vector3Ds IMP::algebra::get_uniform_surface_cover ( const Sphere3Ds & in, double points_per_square_angstrom )

Return a cover of the surface of the volume defined by a union of balls bounded by the spheres.

This is effectively a sampling of the solvent exposed surface of a set of spheres. The density of points has approximately the passed value.

This method is much faster than get_connolly_surface().

template<int D>
 Vector > IMP::algebra::get_uniform_upper_hemisphere_cover ( const SphereD< D > & s, unsigned int n )

Generate a set of 3D points that uniformly cover a hemisphere.

The points all lie on the upper hemisphere, eg, all their z coordinates are greater than those of the center of the sphere.

Definition at line 134 of file vector_generators.h.

 algebra::Rotation3Ds IMP::algebra::get_uniformly_sampled_rotations ( double delta )

Generates a nondegenerate set of Euler angles with a delta resolution.

Parameters
 [in] delta sample every delta angles in radians.
template<int D>
 BoundingBoxD IMP::algebra::get_union ( BoundingBoxD< D > a, const BoundingBoxD< D > & b )

Return the union bounding box.

This is the same as doing a+b.

BoundingBoxD

Definition at line 254 of file BoundingBoxD.h.

template<unsigned int D>
 BoundingBoxD IMP::algebra::get_unit_bounding_box_d ( )

BoundingBoxD

Definition at line 181 of file BoundingBoxD.h.

 BoundingBoxD<-1> IMP::algebra::get_unit_bounding_box_kd ( unsigned int d )

BoundingBoxD

Definition at line 187 of file BoundingBoxD.h. Here is the call graph for this function:

template<class VT >
 VT IMP::algebra::get_unit_vector ( VT vt )

Returns a unit vector pointing at the same direction as this vector.

Note
If the magnitude of this vector is smaller than 1e-12 (an arbitrarily selected small number), returns a unit vector pointing at a random direction.

Definition at line 229 of file VectorBaseD.h.

template<class C >
 const VectorD& IMP::algebra::get_vector_geometry ( const C & g )

Definition at line 444 of file VectorD.h.

 Vector3D IMP::algebra::get_vector_product ( const Vector3D & p1, const Vector3D & p2 )

Return the vector product (cross product) of two vectors.

Vector3D

Definition at line 31 of file Vector3D.h.

template<int D>
 Vector > IMP::algebra::get_vertices ( const UnitSimplexD< D > & s )

Return a list of the vertices (bases) of the unit simplex.

Definition at line 119 of file UnitSimplexD.h. Here is the call graph for this function:

template<int D>
 Vector > IMP::algebra::get_vertices ( const BoundingBoxD< D > & bb )

Return a list of the 2^D bounding points for the bounding box.

BoundingBoxD

Definition at line 274 of file BoundingBoxD.h. Here is the call graph for this function:

template<int D>
 double IMP::algebra::get_volume ( const BoundingBoxD< D > & bb )

See BoundingBoxD.

Definition at line 163 of file BoundingBoxD.h. Here is the call graph for this function:

template<class Geometry >
 double IMP::algebra::get_volume ( const Geometry & )

Compute the volume of any volumetric object.

template<class Vector3DsOrXYZs0 , class Vector3DsOrXYZs1 >
 double IMP::algebra::get_weighted_rmsd ( const Vector3DsOrXYZs0 & m1, const Vector3DsOrXYZs1 & m2, const Floats & weights )

See get_weighted_rmsd_transforming_first().

Definition at line 83 of file algebra/distance.h. Here is the call graph for this function:

template<int D>
 VectorD IMP::algebra::get_zero_vector_d ( )

Return a vector of zeros.

Definition at line 265 of file VectorD.h.

template<int D>
 VectorD<-1 > IMP::algebra::get_zero_vector_kd ( int Di )

Return a dynamically sized vector of zeros.

Definition at line 276 of file VectorD.h.

template<>
 VectorD<-1> IMP::algebra::get_zero_vector_kd ( int D )

Return a dynamically sized vector of zeros.

Definition at line 284 of file VectorD.h.

template<int D>
 VectorD IMP::algebra::operator* ( double s, VectorD< D > o )
VectorD

Definition at line 193 of file VectorD.h.

 Vector3Ds IMP::algebra::read_pts ( TextInput input )

Read a set of 3D vectors from a file.

write_pts
VectorD
 Sphere3Ds IMP::algebra::read_spheres ( TextInput input )

Read a set of 3D spheres from a file.

write_pts
SphereD
 void IMP::algebra::reversed_read ( void * dest, size_t size, size_t nitems, std::ifstream & f, bool reverse )

Reads from file in normal or reverse order.

If the reverse parameter is true, the data will be read in reverse order.

 void IMP::algebra::reversed_write ( const void * src, size_t size, size_t nitems, std::ofstream & f, bool reverse = false )

Writes to a file in normal or reversed order.

This function is the same as fwrite from C, but at the end there is a flag saying if data should be written in reverse order or not.

If the reverse parameter is true, the data will be written in reverse order.

template<class C , class E >
 void IMP::algebra::set_vector_geometry ( C & g, const E & v )

Definition at line 449 of file VectorD.h.

 void IMP::algebra::write_pts ( const Vector3Ds & vs, TextOutput out )

Write a set of 3D vectors to a file.

VectorD
 void IMP::algebra::write_spheres ( const Sphere3Ds & vs, TextOutput out )

Write a set of 3D spheres to a file.