CustusX  2023.01.05-dev+develop.0da12
An IGT application
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) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXVECTOR3D_H_
13 #define CXVECTOR3D_H_
14 
15 #include "cxResourceExport.h"
16 #include "cxPrecompiledHeader.h"
17 
18 
19 #include "cxMathBase.h"
20 class QString;
21 
22 namespace cx
23 {
24 
31 cxResource_EXPORT bool similar(double a, double b, double tol = 1.0E-6);
32 
42 typedef Eigen::Vector3d Vector3D;
43 typedef boost::shared_ptr<Vector3D> Vector3DPtr;
44 
45 cxResource_EXPORT Vector3D multiply_elems(const Vector3D& a, const Vector3D& b);
46 cxResource_EXPORT Vector3D divide_elems(const Vector3D& a, const Vector3D& b);
47 cxResource_EXPORT Vector3D cross(const Vector3D& a, const Vector3D& b);
48 cxResource_EXPORT double dot(const Vector3D& a, const Vector3D& b);
49 cxResource_EXPORT bool similar(const Vector3D& a, const Vector3D& b, double tol = 1.0E-6);
50 cxResource_EXPORT Vector3D unitVector(double thetaXY, double thetaZ = 0.0);
51 cxResource_EXPORT double getThetaXY(Vector3D v);
52 cxResource_EXPORT double getThetaZ(Vector3D v);
53 
54 cxResource_EXPORT Vector3D round(const Vector3D& a);
55 cxResource_EXPORT Vector3D ceil(const Vector3D& a);
56 
57 cxResource_EXPORT bool similar(const Eigen::Array3i& a, const Eigen::Array3i& b);
58 
59 cxResource_EXPORT QString prettyFormat(Vector3D val, int decimals=1, int fieldWidth=3);
60 
61 cxResource_EXPORT Eigen::Vector2d fromString(const QString& text);
62 
67 } // namespace cx
68 // --------------------------------------------------------
69 
70 #endif /*CXVECTOR3D_H_*/
Vector3D ceil(const Vector3D &a)
Definition: cxVector3D.cpp:84
Vector3D divide_elems(const Vector3D &a, const Vector3D &b)
perform element-wise division of a and b.
Definition: cxVector3D.cpp:36
Eigen::Vector2d fromString(const QString &text)
Definition: cxVector3D.cpp:106
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:56
QString prettyFormat(Vector3D val, int decimals, int fieldWidth)
Definition: cxVector3D.cpp:98
boost::shared_ptr< Vector3D > Vector3DPtr
Definition: cxVector3D.h:43
double getThetaXY(Vector3D k)
get thetaXY, meaning the angle of v projected onto the xy plane
Definition: cxVector3D.cpp:65
Vector3D cross(const Vector3D &a, const Vector3D &b)
compute cross product of a and b.
Definition: cxVector3D.cpp:41
double getThetaZ(Vector3D k)
get thetaZ, z meaning the elevation from the xy plane
Definition: cxVector3D.cpp:70
double dot(const Vector3D &a, const Vector3D &b)
compute inner product (or dot product) of a and b.
Definition: cxVector3D.cpp:46
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
Vector3D multiply_elems(const Vector3D &a, const Vector3D &b)
perform element-wise multiplication of a and b.
Definition: cxVector3D.cpp:31
bool similar(const CameraInfo &lhs, const CameraInfo &rhs, double tol)
Vector3D round(const Vector3D &a)
Definition: cxVector3D.cpp:75
Namespace for all CustusX production code.