Fraxinus  16.5.0-fx-rc4
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxVector3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #ifndef CXVECTOR3D_H_
34 #define CXVECTOR3D_H_
35 
36 #include "cxResourceExport.h"
37 #include "cxPrecompiledHeader.h"
38 
39 
40 #include "cxMathBase.h"
41 class QString;
42 
43 namespace cx
44 {
45 
52 cxResource_EXPORT bool similar(double a, double b, double tol = 1.0E-6);
53 
63 typedef Eigen::Vector3d Vector3D;
64 typedef boost::shared_ptr<Vector3D> Vector3DPtr;
65 
66 cxResource_EXPORT Vector3D multiply_elems(const Vector3D& a, const Vector3D& b);
67 cxResource_EXPORT Vector3D divide_elems(const Vector3D& a, const Vector3D& b);
68 cxResource_EXPORT Vector3D cross(const Vector3D& a, const Vector3D& b);
69 cxResource_EXPORT double dot(const Vector3D& a, const Vector3D& b);
70 cxResource_EXPORT bool similar(const Vector3D& a, const Vector3D& b, double tol = 1.0E-6);
71 cxResource_EXPORT Vector3D unitVector(double thetaXY, double thetaZ = 0.0);
72 cxResource_EXPORT double getThetaXY(Vector3D v);
73 cxResource_EXPORT double getThetaZ(Vector3D v);
74 
75 cxResource_EXPORT Vector3D round(const Vector3D& a);
76 cxResource_EXPORT Vector3D ceil(const Vector3D& a);
77 
78 cxResource_EXPORT bool similar(const Eigen::Array3i& a, const Eigen::Array3i& b);
79 
80 cxResource_EXPORT QString prettyFormat(Vector3D val, int decimals=1, int fieldWidth=3);
81 
82 cxResource_EXPORT Eigen::Vector2d fromString(const QString& text);
83 
88 } // namespace cx
89 // --------------------------------------------------------
90 
91 #endif /*CXVECTOR3D_H_*/
Vector3D ceil(const Vector3D &a)
Definition: cxVector3D.cpp:105
Vector3D divide_elems(const Vector3D &a, const Vector3D &b)
perform element-wise division of a and b.
Definition: cxVector3D.cpp:57
Eigen::Vector2d fromString(const QString &text)
Definition: cxVector3D.cpp:127
Vector3D unitVector(double thetaXY, double thetaZ)
compute a unit vector given angles xy in the xy plane and z meaning the elevation from the xy plane...
Definition: cxVector3D.cpp:77
QString prettyFormat(Vector3D val, int decimals, int fieldWidth)
Definition: cxVector3D.cpp:119
boost::shared_ptr< Vector3D > Vector3DPtr
Definition: cxVector3D.h:64
double getThetaXY(Vector3D k)
get thetaXY, meaning the angle of v projected onto the xy plane
Definition: cxVector3D.cpp:86
bool similar(const DoubleBoundingBox3D &a, const DoubleBoundingBox3D &b, double tol)
Vector3D cross(const Vector3D &a, const Vector3D &b)
compute cross product of a and b.
Definition: cxVector3D.cpp:62
double getThetaZ(Vector3D k)
get thetaZ, z meaning the elevation from the xy plane
Definition: cxVector3D.cpp:91
double dot(const Vector3D &a, const Vector3D &b)
compute inner product (or dot product) of a and b.
Definition: cxVector3D.cpp:67
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:63
Vector3D multiply_elems(const Vector3D &a, const Vector3D &b)
perform element-wise multiplication of a and b.
Definition: cxVector3D.cpp:52
Vector3D round(const Vector3D &a)
Definition: cxVector3D.cpp:96