Continues migration with DDS, Common
This commit is contained in:
1 parent
9b15cee841
commit
fa48db111e
668 files changed
+111841
-2
No files matched your search
+48
@@ -0,0 +1,48 @@
|
||||
|
||||
|
||||
|
||||
#include "qpoint3d.h"
|
||||
#include <QDataStream>
|
||||
|
||||
using namespace LtsUtils;
|
||||
|
||||
|
||||
double QPoint3D::distanceToLine(const QPoint3D &point, const QPoint3D &direction) const
|
||||
{
|
||||
if (direction.isNull())
|
||||
return (*this - point).length();
|
||||
QPoint3D p = point + dotProduct(*this - point, direction) * direction;
|
||||
return (*this - p).length();
|
||||
}
|
||||
|
||||
double QPoint3D::distanceToPlane(const QPoint3D &plane, const QPoint3D &normal) const
|
||||
{
|
||||
return dotProduct(*this - plane, normal);
|
||||
}
|
||||
|
||||
double QPoint3D::distanceToPlane(const QPoint3D &plane1, const QPoint3D &plane2, const QPoint3D &plane3) const
|
||||
{
|
||||
QPoint3D n = normal(plane2 - plane1, plane3 - plane1);
|
||||
return dotProduct(*this - plane1, n);
|
||||
}
|
||||
|
||||
double QPoint3D::distanceToPoint(const QPoint3D &point) const
|
||||
{
|
||||
return (*this - point).length();
|
||||
}
|
||||
|
||||
|
||||
QDataStream &operator<<(QDataStream &s, const QPoint3D &p)
|
||||
{
|
||||
s << p.x() << p.y() << p.z();
|
||||
return s;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &s, QPoint3D &p)
|
||||
{
|
||||
double x, y, z;
|
||||
s >> x; p.rx() = x;
|
||||
s >> y; p.ry() = y;
|
||||
s >> z; p.rz() = z;
|
||||
return s;
|
||||
}
|
||||
Reference in new issue
Block a user