//########################################################################## //# # //# 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 # //# the Free Software Foundation; version 2 of the License. # //# # //# 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 //local #include "qVoxFallDialog.h" //qCC_db #include #include #include #include #include #include class qVoxFallTransform { public: ccGLMatrix matrix; ccGLMatrix inverse; qVoxFallTransform(double dip, double azimuth) { float zRot = azimuth * 3.14159 / 180; float xRot = (90 - dip) * 3.14159 / 180; ccGLMatrix zRotMatrix; const Vector3Tpl zX(std::cos(zRot), std::sin(zRot), 0); const Vector3Tpl zY(-std::sin(zRot), std::cos(zRot), 0); const Vector3Tpl zZ(0, 0, 1); const Vector3Tpl zTr(0, 0, 0); zRotMatrix = ccGLMatrix(zX, zY, zZ, zTr); ccGLMatrix xRotMatrix; const Vector3Tpl xX(1, 0, 0); const Vector3Tpl xY(0, std::cos(xRot), -std::sin(xRot)); const Vector3Tpl xZ(0, std::sin(xRot), std::cos(xRot)); const Vector3Tpl xTr(0, 0, 0); xRotMatrix = ccGLMatrix(xX, xY, xZ, xTr); matrix = zRotMatrix * xRotMatrix; inverse = matrix.inverse(); } static ccBox* CreateVoxelMesh(CCVector3 V, float voxelSize, int voxelIdx); }; class qVoxFallTools { public: static std::vector 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