60 lines
1.2 KiB
C++
Executable File
60 lines
1.2 KiB
C++
Executable File
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "qpoint3d.h"
|
|
|
|
#include <LtsUtilsCore/ltsutilscore_export.h>
|
|
|
|
#include <QVector>
|
|
#include <QPointF>
|
|
|
|
|
|
namespace LtsUtils
|
|
{
|
|
|
|
class LTSUTILSCORE_EXPORT QPlane3D
|
|
{
|
|
|
|
public:
|
|
QPlane3D(const QPoint3D &pos, const QPoint3D &vec1, const QPoint3D &vec2);
|
|
|
|
QPoint3D intersection(const QPoint3D &point, const QPoint3D &direction) const;
|
|
bool intersects(const QPoint3D &direction) const;
|
|
bool isParallel(const QPoint3D &direction) const;
|
|
bool inPlane(const QPoint3D &point) const;
|
|
double distanceTo(const QPoint3D &point) const;
|
|
|
|
const QPoint3D &pos() const { return m_pos; }
|
|
const QPoint3D &vec1() const { return m_vec1; }
|
|
const QPoint3D &vec2() const { return m_vec2; }
|
|
const QPoint3D &normal() const { return m_normal; }
|
|
double planeC() const { return m_planeC; }
|
|
|
|
protected:
|
|
QPoint3D m_pos;
|
|
QPoint3D m_vec1;
|
|
QPoint3D m_vec2;
|
|
QPoint3D m_normal;
|
|
double m_planeC;
|
|
|
|
};
|
|
|
|
|
|
class LTSUTILSCORE_EXPORT QPolygon3D : public QPlane3D
|
|
{
|
|
|
|
public:
|
|
QPolygon3D(const QVector<QPoint3D> &vertices);
|
|
|
|
bool contains(const QPoint3D &point) const { return m_vertices.contains(point); }
|
|
bool containsPoint(const QPoint3D &point) const;
|
|
|
|
private:
|
|
QVector<QPoint3D> m_vertices;
|
|
|
|
};
|
|
|
|
}
|