Adds succesfull lts/proxies migration & testsuite
This commit is contained in:
59 files changed
+754
-273
No files matched your search
@@ -4,31 +4,8 @@
|
||||
|
||||
#include <QtCore/QDataStream>
|
||||
|
||||
using namespace LtsUtils;
|
||||
|
||||
double QPoint3D::distanceToLine(const QPoint3D& point, const QPoint3D& direction) const
|
||||
namespace LtsUtils
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -47,3 +24,5 @@ QDataStream& operator>>(QDataStream& s, QPoint3D& p)
|
||||
p.rz() = z;
|
||||
return s;
|
||||
}
|
||||
|
||||
} // namespace LtsUtils
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qpoint.h>
|
||||
#include <QtCore/qdatastream.h>
|
||||
#include <cmath>
|
||||
#include <sstream>
|
||||
|
||||
@@ -17,8 +18,8 @@ class QPoint3D
|
||||
public:
|
||||
enum class Axis { X, Y, Z };
|
||||
|
||||
Q_DECL_CONSTEXPR QPoint3D() = default;
|
||||
Q_DECL_CONSTEXPR QPoint3D(double xpos, double ypos, double zpos);
|
||||
constexpr QPoint3D() = default;
|
||||
constexpr QPoint3D(double xpos, double ypos, double zpos);
|
||||
|
||||
template <typename T> explicit QPoint3D(const T& data) : xp(data.offsetX()), yp(data.offsetY()), zp(data.offsetZ())
|
||||
{
|
||||
@@ -26,18 +27,18 @@ class QPoint3D
|
||||
|
||||
inline bool isNull() const;
|
||||
|
||||
Q_DECL_CONSTEXPR inline double x() const;
|
||||
Q_DECL_CONSTEXPR inline double y() const;
|
||||
Q_DECL_CONSTEXPR inline double z() const;
|
||||
Q_DECL_RELAXED_CONSTEXPR inline void setX(double xpos);
|
||||
Q_DECL_RELAXED_CONSTEXPR inline void setY(double ypos);
|
||||
Q_DECL_RELAXED_CONSTEXPR inline void setZ(double zpos);
|
||||
constexpr inline double x() const;
|
||||
constexpr inline double y() const;
|
||||
constexpr inline double z() const;
|
||||
constexpr inline void setX(double xpos);
|
||||
constexpr inline void setY(double ypos);
|
||||
constexpr inline void setZ(double zpos);
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline double& rx();
|
||||
Q_DECL_RELAXED_CONSTEXPR inline double& ry();
|
||||
Q_DECL_RELAXED_CONSTEXPR inline double& rz();
|
||||
constexpr inline double& rx();
|
||||
constexpr inline double& ry();
|
||||
constexpr inline double& rz();
|
||||
|
||||
Q_DECL_CONSTEXPR inline QPointF toPointF() const;
|
||||
constexpr inline QPointF toPointF() const;
|
||||
|
||||
static QPoint3D fromQPointF(const QPointF& p)
|
||||
{
|
||||
@@ -115,40 +116,56 @@ class QPoint3D
|
||||
return p;
|
||||
}
|
||||
|
||||
inline double distanceToLine(const QPoint3D& point, const QPoint3D& direction) const;
|
||||
inline double distanceToPlane(const QPoint3D& plane, const QPoint3D& normal) const;
|
||||
inline double distanceToPlane(const QPoint3D& plane1, const QPoint3D& plane2, const QPoint3D& plane3) const;
|
||||
inline double distanceToPoint(const QPoint3D& point) const;
|
||||
inline double 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();
|
||||
}
|
||||
inline double distanceToPlane(const QPoint3D& plane, const QPoint3D& normal) const
|
||||
{
|
||||
return dotProduct(*this - plane, normal);
|
||||
}
|
||||
inline double distanceToPlane(const QPoint3D& plane1, const QPoint3D& plane2, const QPoint3D& plane3) const
|
||||
{
|
||||
QPoint3D n = normal(plane2 - plane1, plane3 - plane1);
|
||||
return dotProduct(*this - plane1, n);
|
||||
}
|
||||
inline double distanceToPoint(const QPoint3D& point) const
|
||||
{
|
||||
return (*this - point).length();
|
||||
}
|
||||
|
||||
friend Q_DECL_CONSTEXPR inline bool operator==(const QPoint3D& p1, const QPoint3D& p2);
|
||||
friend Q_DECL_CONSTEXPR inline bool operator!=(const QPoint3D& p1, const QPoint3D& p2);
|
||||
friend constexpr inline bool operator==(const QPoint3D& p1, const QPoint3D& p2);
|
||||
friend constexpr inline bool operator!=(const QPoint3D& p1, const QPoint3D& p2);
|
||||
|
||||
friend Q_DECL_CONSTEXPR inline QPoint3D operator+(const QPoint3D& p1, const QPoint3D& p2)
|
||||
friend constexpr inline QPoint3D operator+(const QPoint3D& p1, const QPoint3D& p2)
|
||||
{
|
||||
return QPoint3D(p1.xp + p2.xp, p1.yp + p2.yp, p1.zp + p2.zp);
|
||||
}
|
||||
|
||||
friend Q_DECL_CONSTEXPR inline QPoint3D operator-(const QPoint3D& p1, const QPoint3D& p2)
|
||||
friend constexpr inline QPoint3D operator-(const QPoint3D& p1, const QPoint3D& p2)
|
||||
{
|
||||
return QPoint3D(p1.xp - p2.xp, p1.yp - p2.yp, p1.zp - p2.zp);
|
||||
}
|
||||
|
||||
friend Q_DECL_CONSTEXPR inline QPoint3D operator*(const QPoint3D& p1, double factor)
|
||||
friend constexpr inline QPoint3D operator*(const QPoint3D& p1, double factor)
|
||||
{
|
||||
return QPoint3D(p1.xp * factor, p1.yp * factor, p1.zp * factor);
|
||||
}
|
||||
|
||||
friend Q_DECL_CONSTEXPR inline QPoint3D operator*(double factor, const QPoint3D& p1)
|
||||
friend constexpr inline QPoint3D operator*(double factor, const QPoint3D& p1)
|
||||
{
|
||||
return QPoint3D(p1.xp * factor, p1.yp * factor, p1.zp * factor);
|
||||
}
|
||||
|
||||
friend Q_DECL_CONSTEXPR inline QPoint3D operator/(const QPoint3D& p1, double factor)
|
||||
friend constexpr inline QPoint3D operator/(const QPoint3D& p1, double factor)
|
||||
{
|
||||
return QPoint3D(p1.xp / factor, p1.yp / factor, p1.zp / factor);
|
||||
}
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QPoint3D& operator+=(const QPoint3D& o)
|
||||
constexpr inline QPoint3D& operator+=(const QPoint3D& o)
|
||||
{
|
||||
xp += o.xp;
|
||||
yp += o.yp;
|
||||
@@ -156,7 +173,7 @@ class QPoint3D
|
||||
return *this;
|
||||
}
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QPoint3D& operator-=(const QPoint3D& o)
|
||||
constexpr inline QPoint3D& operator-=(const QPoint3D& o)
|
||||
{
|
||||
xp -= o.xp;
|
||||
yp -= o.yp;
|
||||
@@ -164,7 +181,7 @@ class QPoint3D
|
||||
return *this;
|
||||
}
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QPoint3D& operator*=(double factor)
|
||||
constexpr inline QPoint3D& operator*=(double factor)
|
||||
{
|
||||
xp *= factor;
|
||||
yp *= factor;
|
||||
@@ -172,7 +189,7 @@ class QPoint3D
|
||||
return *this;
|
||||
}
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QPoint3D& operator/=(double divisor)
|
||||
constexpr inline QPoint3D& operator/=(double divisor)
|
||||
{
|
||||
xp /= divisor;
|
||||
yp /= divisor;
|
||||
@@ -180,12 +197,12 @@ class QPoint3D
|
||||
return *this;
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR static inline double dotProduct(const QPoint3D& v1, const QPoint3D& v2)
|
||||
constexpr static inline double dotProduct(const QPoint3D& v1, const QPoint3D& v2)
|
||||
{
|
||||
return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp;
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR static inline QPoint3D crossProduct(const QPoint3D& v1, const QPoint3D& v2)
|
||||
constexpr static inline QPoint3D crossProduct(const QPoint3D& v1, const QPoint3D& v2)
|
||||
{
|
||||
return QPoint3D(v1.yp * v2.zp - v1.zp * v2.yp, v1.zp * v2.xp - v1.xp * v2.zp, v1.xp * v2.yp - v1.yp * v2.xp);
|
||||
}
|
||||
@@ -200,7 +217,10 @@ class QPoint3D
|
||||
return crossProduct((v2 - v1), (v3 - v1)).normalized();
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR friend inline bool qFuzzyCompare(const QPoint3D& v1, const QPoint3D& v2);
|
||||
friend inline bool qFuzzyCompare(const QPoint3D& v1, const QPoint3D& v2)
|
||||
{
|
||||
return ::qFuzzyCompare(v1.xp, v2.xp) && ::qFuzzyCompare(v1.yp, v2.yp) && ::qFuzzyCompare(v1.zp, v2.zp);
|
||||
}
|
||||
|
||||
private:
|
||||
double xp = 0;
|
||||
@@ -208,81 +228,76 @@ class QPoint3D
|
||||
double zp = 0;
|
||||
};
|
||||
|
||||
LTSUTILSCORE_EXPORT QDataStream& operator<<(QDataStream& s, const QPoint3D& p);
|
||||
LTSUTILSCORE_EXPORT QDataStream& operator>>(QDataStream& s, QPoint3D& p);
|
||||
// QDataStream& operator<<(QDataStream& s, const QPoint3D& p);
|
||||
// QDataStream& operator>>(QDataStream& s, QPoint3D& p);
|
||||
|
||||
Q_DECL_CONSTEXPR inline QPoint3D::QPoint3D(double xpos, double ypos, double zpos) : xp(xpos), yp(ypos), zp(zpos) {}
|
||||
constexpr inline QPoint3D::QPoint3D(double xpos, double ypos, double zpos) : xp(xpos), yp(ypos), zp(zpos) {}
|
||||
|
||||
inline bool QPoint3D::isNull() const
|
||||
{
|
||||
return qIsNull(xp) && qIsNull(yp) && qIsNull(zp);
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR inline double QPoint3D::x() const
|
||||
constexpr inline double QPoint3D::x() const
|
||||
{
|
||||
return xp;
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR inline double QPoint3D::y() const
|
||||
constexpr inline double QPoint3D::y() const
|
||||
{
|
||||
return yp;
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR inline double QPoint3D::z() const
|
||||
constexpr inline double QPoint3D::z() const
|
||||
{
|
||||
return zp;
|
||||
}
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline void QPoint3D::setX(double xpos)
|
||||
constexpr inline void QPoint3D::setX(double xpos)
|
||||
{
|
||||
xp = xpos;
|
||||
}
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline void QPoint3D::setY(double ypos)
|
||||
constexpr inline void QPoint3D::setY(double ypos)
|
||||
{
|
||||
yp = ypos;
|
||||
}
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline void QPoint3D::setZ(double zpos)
|
||||
constexpr inline void QPoint3D::setZ(double zpos)
|
||||
{
|
||||
zp = zpos;
|
||||
}
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline double& QPoint3D::rx()
|
||||
constexpr inline double& QPoint3D::rx()
|
||||
{
|
||||
return xp;
|
||||
}
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline double& QPoint3D::ry()
|
||||
constexpr inline double& QPoint3D::ry()
|
||||
{
|
||||
return yp;
|
||||
}
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline double& QPoint3D::rz()
|
||||
constexpr inline double& QPoint3D::rz()
|
||||
{
|
||||
return zp;
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR inline QPointF QPoint3D::toPointF() const
|
||||
constexpr inline QPointF QPoint3D::toPointF() const
|
||||
{
|
||||
return QPointF(xp, yp);
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR inline bool operator==(const QPoint3D& p1, const QPoint3D& p2)
|
||||
constexpr inline bool operator==(const QPoint3D& p1, const QPoint3D& p2)
|
||||
{
|
||||
return p1.xp == p2.xp && p1.yp == p2.yp && p1.zp == p2.zp;
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR inline bool operator!=(const QPoint3D& p1, const QPoint3D& p2)
|
||||
constexpr inline bool operator!=(const QPoint3D& p1, const QPoint3D& p2)
|
||||
{
|
||||
return p1.xp != p2.xp || p1.yp != p2.yp || p1.zp != p2.zp;
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR inline bool qFuzzyCompare(const QPoint3D& v1, const QPoint3D& v2)
|
||||
{
|
||||
return ::qFuzzyCompare(v1.xp, v2.xp) && ::qFuzzyCompare(v1.yp, v2.yp) && ::qFuzzyCompare(v1.zp, v2.zp);
|
||||
}
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& stream, const QPoint3D& pos)
|
||||
{
|
||||
stream << "(" << pos.x() << "," << pos.y() << "," << pos.z() << ")";
|
||||
@@ -291,4 +306,4 @@ inline std::ostream& operator<<(std::ostream& stream, const QPoint3D& pos)
|
||||
|
||||
} // namespace LtsUtils
|
||||
|
||||
Q_DECLARE_TYPEINFO(LtsUtils::QPoint3D, Q_MOVABLE_TYPE);
|
||||
// Q_DECLARE_METATYPE(LtsUtils::QPoint3D)
|
||||
Reference in new issue
Block a user