Copyright (C) 2006 Smithsonian Astrophysical Observatory
This file is part of dvm3
dvm3 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
dvm3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
v1 * v2 = [v1(0)*v2(0), v1(1)*v2(1), v1(2)*v2(2)]
The dvm3 package consists of a collection of sub-packages:
The dvm3_Vector and dvm3_Matrix classes are simple classes to handle common numerical operations on 3-vectors and 3-matrices of doubles. The classes provide two forms of access to components:
The dvm3_RotMat
class (a derived class of dvm3_Matrix) adds some methods useful for manipulating proper rotation matrices. By proper, it is meant that the application of the rotation matrix will not change the parity of the coordinates: right-handed coordinates are transformed into right-handed coordinates.
These are intended as small components which can be inexpensively created on the stack; their constructors and destructor do not make use of dynamic allocation. The dvm3_Vector and dvm3_Matrix default constructors do not initialize the memory. The dvm3_RotMat default constructor initializes the matrix to a unit matrix (i.e., zero rotation).
Many of the operations are facilitated by the helper classes vm_VMath<T,N>, vm_V3Math<T>, and vm_M3math<T>. These classes contain a number of static member functions which operate on C-style arrays. Further documentation for these can be found under the documentation for vm_math.
Note that dvm3_Vector inherits from a struct, dvm3_VPOD which encapulates an array of 3 doubles, while dvm3_Matrix inherits from a struct dvm3_MPOD, encapulating a (1-dimensional) array of 9 doubles. These are both POD's ("Plain Ol' Data") as defined in ISO Standard C++. This ensures that dvm3_VPOD and dvm3_MPOD both have the semantics of C structs; this allows them to be copied or assigned as structs. Thus, for example, memcpy() may be called with impunity on the POD subobjects.
The inheritence from the PODS is protected; this implementation detail is exposed purely for efficiency considerations; users shall not assume that this implementation detail will remain fixed for all time. DO NOT rely on the fact that there is a POD struct under the hood or the details of the data member names within dvm3_VPOD and dvm3_MPOD.
The resultant library is available as -ldvm3; the library include file is available as <dvm3/dvm3.h>. Separate include files are provided for <dvm3/dvm3_vector.h> <dvm3/dvm3_matrix.h>, and <dvm3/dvm3_rotmat.h>.