Files

85 lines
2.8 KiB
C++
Raw Permalink Normal View History

2024-09-21 15:00:32 +03:00
//##########################################################################
//# #
//# CLOUDCOMPARE PLUGIN: qVoxFall #
//# #
//# This program is free software; you can redistribute it and/or modify #
//# it under the terms of the GNU General Public License as published by #
2025-03-24 19:54:54 +02:00
//# the Free Software Foundation; version 3 of the License. #
2024-09-21 15:00:32 +03:00
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
//# COPYRIGHT: THE UNIVERSITY OF NEWCASTLE #
//# #
//##########################################################################
#ifndef Q_VOXFALL_TOOLS_HEADER
#define Q_VOXFALL_TOOLS_HEADER
//CCCoreLib
#include <GenericProgressCallback.h>
//local
#include "qVoxFallDialog.h"
//qCC_db
#include <ccMesh.h>
#include <ccPointCloud.h>
#include <ccScalarField.h>
#include <ccBox.h>
2024-09-29 10:27:39 +02:00
#include <ccGLMatrix.h>
2024-09-21 15:00:32 +03:00
#include <unordered_map>
class qVoxFallTransform
{
public:
2024-09-30 21:59:34 +02:00
ccGLMatrix matrix;
ccGLMatrix inverse;
2025-03-21 16:41:45 +02:00
qVoxFallTransform(double dip, double azimuth)
2024-09-21 15:00:32 +03:00
{
2025-03-21 16:41:45 +02:00
float zRot = azimuth * 3.14159 / 180;
float xRot = (90 - dip) * 3.14159 / 180;
ccGLMatrix zRotMatrix;
const Vector3Tpl<float> zX(std::cos(zRot), std::sin(zRot), 0);
const Vector3Tpl<float> zY(-std::sin(zRot), std::cos(zRot), 0);
const Vector3Tpl<float> zZ(0, 0, 1);
const Vector3Tpl<float> zTr(0, 0, 0);
zRotMatrix = ccGLMatrix(zX, zY, zZ, zTr);
ccGLMatrix xRotMatrix;
const Vector3Tpl<float> xX(1, 0, 0);
const Vector3Tpl<float> xY(0, std::cos(xRot), -std::sin(xRot));
const Vector3Tpl<float> xZ(0, std::sin(xRot), std::cos(xRot));
const Vector3Tpl<float> xTr(0, 0, 0);
xRotMatrix = ccGLMatrix(xX, xY, xZ, xTr);
matrix = zRotMatrix * xRotMatrix;
inverse = matrix.inverse();
2024-09-21 15:00:32 +03:00
}
static ccBox* CreateVoxelMesh(CCVector3 V, float voxelSize, int voxelIdx);
};
class qVoxFallTools
{
public:
static std::vector<Tuple3i> FindAdjacents(Tuple3i V, CCVector3 steps, bool facetsOnly);
static int Grid2Index(Tuple3i n, CCVector3 steps);
static Tuple3i Index2Grid(unsigned index, CCVector3 steps);
};
#endif //Q_VOXFALL_PROCESS_HEADER