35 #include <vtkSmartPointer.h>
47 bool similar(
double a,
double b,
double tol)
49 return fabs(b - a) < tol;
54 return a.array() * b.array();
59 return a.array() / b.array();
74 return (b - a).length() < tol;
80 e[0] = cos(thetaXY) * cos(thetaZ);
81 e[1] = sin(thetaXY) * cos(thetaZ);
88 return atan2(k[1], k[0]);
93 return atan2(k[2], sqrt(k[0] * k[0] + k[1] * k[1]));
99 for (
int i = 0; i < 3; ++i)
100 retval[i] = (
int) (a[i] + 0.5);
108 for (
int i = 0; i < 3; ++i)
114 bool similar(
const Eigen::Array3i& a,
const Eigen::Array3i& b)
116 return (b - a).abs().maxCoeff() < 10E-6;;
121 return QString(
"%1 %2 %3")
122 .arg(val[0], fieldWidth,
'f', decimals)
123 .arg(val[1], fieldWidth,
'f', decimals)
124 .arg(val[2], fieldWidth,
'f', decimals);
131 return Eigen::Vector2d(0, 0);
132 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
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.
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.
std::vector< double > convertQString2DoubleVector(const QString &input, bool *ok)
Vector3D round(const Vector3D &a)