14 #include <vtkSmartPointer.h> 26 bool similar(
double a,
double b,
double tol)
28 return fabs(b - a) < tol;
33 return a.array() * b.array();
38 return a.array() / b.array();
53 return (b - a).length() < tol;
59 e[0] = cos(thetaXY) * cos(thetaZ);
60 e[1] = sin(thetaXY) * cos(thetaZ);
67 return atan2(k[1], k[0]);
72 return atan2(k[2], sqrt(k[0] * k[0] + k[1] * k[1]));
78 for (
int i = 0; i < 3; ++i)
79 retval[i] = (
int) (a[i] + 0.5);
87 for (
int i = 0; i < 3; ++i)
93 bool similar(
const Eigen::Array3i& a,
const Eigen::Array3i& b)
95 return (b - a).abs().maxCoeff() < 10E-6;;
100 return QString(
"%1 %2 %3")
101 .arg(val[0], fieldWidth,
'f', decimals)
102 .arg(val[1], fieldWidth,
'f', decimals)
103 .arg(val[2], fieldWidth,
'f', decimals);
110 return Eigen::Vector2d(0, 0);
111 return Eigen::Vector2d((
double*) &(*raw.begin()));
Vector3D ceil(const Vector3D &a)
Vector3D divide_elems(const Vector3D &a, const Vector3D &b)
perform element-wise division of a and b.
Eigen::Vector2d fromString(const QString &text)
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...
QString prettyFormat(Vector3D val, int decimals, int fieldWidth)
double getThetaXY(Vector3D k)
get thetaXY, meaning the angle of v projected onto the xy plane
Vector3D cross(const Vector3D &a, const Vector3D &b)
compute cross product of a and b.
double getThetaZ(Vector3D k)
get thetaZ, z meaning the elevation from the xy plane
double dot(const Vector3D &a, const Vector3D &b)
compute inner product (or dot product) of a and b.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Vector3D multiply_elems(const Vector3D &a, const Vector3D &b)
perform element-wise multiplication of a and b.
bool similar(const CameraInfo &lhs, const CameraInfo &rhs, double tol)
std::vector< double > convertQString2DoubleVector(const QString &input, bool *ok)
Vector3D round(const Vector3D &a)
Namespace for all CustusX production code.