Skip to content

Instantly share code, notes, and snippets.

View FaZeRs's full-sized avatar

Nauris Linde FaZeRs

View GitHub Profile
#include <opencv2/opencv.hpp>
#include <uc/logger.h>
#include <uc/command_line.h>
#include <uc/timer.h>
#include <uc/math_common.h>
#include <uc/dimensions.h>
#include <uc/math_geometric.h>
#include "draw_utils.h"
#include <QMimeData>
#include <QIcon>
#include "structure_model.h"
#include "helpers.h"
StructureModel::StructureModel(const QStringList& headers, const std::vector<std::shared_ptr<Room>>& rooms, QObject* parent) :
QAbstractItemModel(parent), rooms_(rooms) {
QVector<QVariant> root_data;
for (const QString& header : headers) root_data << header;
bool Helpers::isPointOnLine(QPointF lineStart, QPointF lineEnd, QPointF point) {
// qreal AB = sqrt((lineEnd.x() - lineStart.x()) * (lineEnd.x() - lineStart.x()) +
// (lineEnd.y() - lineStart.y()) * (lineEnd.y() - lineStart.y()) + (z2 - z1) * (z2 - z1));
// qreal AP = sqrt((point.x() - lineStart.x()) * (point.x() - lineStart.x()) +
// (point.y() - lineStart.y()) * (point.y() - lineStart.y()) + (z - z1) * (z - z1));
// qreal PB = sqrt((lineEnd.x() - point.x()) * (lineEnd.x() - point.x()) + (lineEnd.y() - point.y()) * (lineEnd.y() -
// point.y()) +
// (z2 - z) * (z2 - z));
// if (AB == AP + PB) {
// return true;
void PuzzleWindow::paint()
{
QFont font;
QPen pen;
QDir dir = QDir(home->projectDir.filePath("planojums/"));
QJsonObject puzzle = {};
if (dir.exists()) {
QFile dataFile(dir.filePath("data.json"));
void PuzzleWindow::paint()
{
QFont font;
QPen pen;
QDir dir = QDir(home->projectDir.filePath("planojums/"));
QJsonObject puzzle = {};
if (dir.exists()) {
QFile dataFile(dir.filePath("data.json"));