15 return {
x - v.
x,
y - v.
y,
z - v.
z};
18 return {
y * v.
z -
z * v.
y,
z * v.
x -
x * v.
z,
x * v.
y -
y * v.
x};
21 return x * v.
x +
y * v.
y +
z * v.
z;
24 return std::sqrt(
x*
x +
y*
y +
z*
z);
30 return std::abs(d1.
cross(d2).
dot(v)) < 1e-6;
41 return std::abs(d1.
dot(v)) < 1e-6;
52 Vector3D P1(line1.fitParameters[0], line1.fitParameters[1], line1.fitParameters[2]);
53 Vector3D d1(line1.fitParameters[3], line1.fitParameters[4], line1.fitParameters[5]);
55 Vector3D P2(line2.fitParameters[0], line2.fitParameters[1], line2.fitParameters[2]);
56 Vector3D d2(line2.fitParameters[3], line2.fitParameters[4], line2.fitParameters[5]);
62 std::cout <<
"The lines are coplanar." << std::endl;
64 std::cout <<
"The lines are not coplanar." << std::endl;
70 std::cout <<
"The lines are coincident." << std::endl;
72 std::cout <<
"The lines are parallel." << std::endl;
75 std::cout <<
"The lines are skewed." << std::endl;
80 std::cout <<
"Shortest distance between the lines: " << distance << std::endl;
bool areCoplanar(const Vector3D &d1, const Vector3D &d2, const Vector3D &v)
Definition: Line3DCompare.h:29
void compareLines(const FitLine3D &line1, const FitLine3D &line2)
Definition: Line3DCompare.h:50
bool areParallel(const Vector3D &d1, const Vector3D &d2)
Definition: Line3DCompare.h:34
bool areCoincident(const Vector3D &d1, const Vector3D &v)
Definition: Line3DCompare.h:40
double shortestDistance(const Vector3D &d1, const Vector3D &d2, const Vector3D &v)
Definition: Line3DCompare.h:45
Definition: Line3DCompare.h:6
Vector3D()
Definition: Line3DCompare.h:10
Vector3D cross(const Vector3D &v) const
Definition: Line3DCompare.h:17
double magnitude() const
Definition: Line3DCompare.h:23
double x
Definition: Line3DCompare.h:7
double z
Definition: Line3DCompare.h:7
Vector3D(double x, double y, double z)
Definition: Line3DCompare.h:11
double dot(const Vector3D &v) const
Definition: Line3DCompare.h:20
Vector3D operator-(const Vector3D &v) const
Definition: Line3DCompare.h:14
double y
Definition: Line3DCompare.h:7