Detailed Description
template<int D>
class IMP::algebra::VectorD< D >
A Cartesian vector in D-dimensions.
Store a vector of Cartesian coordinates. It supports all expected mathematical operators, including using * for the dot product.
- See also:
- Vector3D
-
Vector2D
- Note:
- This class is a geometric primitive. Also, this class is not not initialized by its default constructor.
Examples: XYZR Decorator, range restriction, symmetry, decay, grid space, cube, XYZ Decorator, filter close pairs, restraint cache, randomize rigid body, custom filter, markers, cg pdb, rigid collisions, simplex, dock with crosslinks, six particles optimization, rigid brownian dynamics, geometry, simulation, tasks, kmeans, interactive with containers, ms connectivity restraint, multiscale, rigid body excluded volume, analyze convergence, setup, rigid body and excluded volume restraint, interactive, nup84 cg, nup84 rb, domino approach, optimize balls, connectivity restraint, basic geometry, incremental mc, restrain in sphere
List of all members.
Public Types |
|
typedef const double * | CoordinateConstIterator |
|
typedef double * | CoordinateIterator |
Public Member Functions |
| | VectorD (const Floats &f) |
| template<class It > |
| | VectorD (It b, It e) |
| | VectorD (double x) |
| | Initialize the 1-vector from its value.
|
| | VectorD (double x, double y) |
| | Initialize a 2-vector from separate x,y values.
|
| | VectorD (double x, double y, double z) |
| | Initialize a 3-vector from separate x,y,z values.
|
| | VectorD (double x0, double x1, double x2, double x3) |
| | Initialize a 4-vector from separate w,x,y,z values.
|
| | VectorD () |
| | Default constructor.
|
|
CoordinateIterator | coordinates_begin () |
|
CoordinateConstIterator | coordinates_begin () const |
|
CoordinateIterator | coordinates_end () |
|
CoordinateConstIterator | coordinates_end () const |
|
Floats | get_coordinates () const |
|
unsigned int | get_dimension () const |
|
double | get_magnitude () const |
|
double | get_scalar_product (const VectorD< D > &o) const |
|
double | get_squared_magnitude () const |
|
VectorD | get_unit_vector () const |
| double | operator[] (unsigned int i) const |
| double & | operator[] (unsigned int i) |
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, base::TextOutput out) |
| | Write a set of 3D vectors to a file.
|
| Vector3Ds | read_pts (base::TextInput input) |
| | Read a set of 3D vectors from a file.
|
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.
|
| template<int D> |
| VectorD< D > | get_random_vector_on (const BoundingBoxD< D > &bb) |
| | Generate a random vector on a box with uniform density.
|
| 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.
|
Constructor & Destructor Documentation
template<int D>
template<class It >
The distance between b and e must be equal to D.
Initialize the 1-vector from its value.
Initialize a 2-vector from separate x,y values.
Initialize a 3-vector from separate x,y,z values.
Initialize a 4-vector from separate w,x,y,z values.
Member Function Documentation
Return the ith Cartesian coordinate. In 3D use [0] to get the x coordinate etc.
Return the ith Cartesian coordinate. In 3D use [0] to get the x coordinate etc.
Friends And Related Function Documentation
lexicographic comparison of two vectors
Note that this is not very reliable and probably should not be used.
template<int D>
| VectorD< D > get_basis_vector_d |
( |
unsigned int |
coordinate | ) |
|
|
related |
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);
template<int D>
| double get_distance |
( |
const VectorD< D > & |
v1, |
|
|
const VectorD< D > & |
v2 |
|
) |
| |
|
related |
compute the distance between two vectors
Return the vector that is the elementwise product of the two.
Return the vector that is the elementwise product of the two.
Generate a random vector in a box with uniform density.
Generate a random vector on a box with uniform density.
template<int D>
| double get_squared_distance |
( |
const VectorD< D > & |
v1, |
|
|
const VectorD< D > & |
v2 |
|
) |
| |
|
related |
compute the squared distance between two vectors
Generate a set of 3d points that uniformly cover a patch of a sphere.
- Note:
- the implementation can be improved
Read a set of 3D vectors from a file.
- See also:
- write_pts
Write a set of 3D vectors to a file.
- See also:
- read_pts
The documentation for this class was generated from the following files: