From 77d870e732883e621f418e59501a2627ec2be7cf Mon Sep 17 00:00:00 2001 From: Perminder Date: Sat, 16 Nov 2024 16:35:24 +0530 Subject: [PATCH] fixes Signed-off-by: Perminder --- avogadro/core/cube.h | 22 +++++++++++++++------- avogadro/core/mesh.h | 8 ++++++++ avogadro/qtgui/meshgenerator.cpp | 6 ++++++ avogadro/qtgui/meshgenerator.h | 7 +++++++ 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/avogadro/core/cube.h b/avogadro/core/cube.h index 43775c345c..562d316fc5 100644 --- a/avogadro/core/cube.h +++ b/avogadro/core/cube.h @@ -24,7 +24,10 @@ class Mutex; /** * @class Cube cube.h * @brief Provide a data structure for regularly spaced 3D grids. + * @author Marcus D. Hanwell + * @author Perminder Singh */ + class AVOGADROCORE_EXPORT Cube { public: @@ -275,13 +278,18 @@ class AVOGADROCORE_EXPORT Cube */ float getData(int i, int j, int k) const; - /** - * Get the positions of the eight corners of a cube defined by the indices (i, j, k). - * @param i x index - * @param j y index - * @param k z index - * @return Array of positions at the eight corners. - */ +/** + * Retrieves the positions of the eight corners of a cube at grid indices (i, j, k). + * + * The indices (i, j, k) are converted to real-space positions (xpos, ypos, zpos), mapping grid indices to physical coordinates. + * The method returns a cube that spans one step in each of the x, y, and z directions, with step sizes defined by `m_spacing`. + * + * @param i X-index. + * @param j Y-index. + * @param k Z-index. + * @return A `std::array` of eight `(x, y, z)` coordinates representing the cube's corners. + */ + std::array, 8> getPosCube(int i, int j, int k) const; protected: diff --git a/avogadro/core/mesh.h b/avogadro/core/mesh.h index 082006f283..596252aa6a 100644 --- a/avogadro/core/mesh.h +++ b/avogadro/core/mesh.h @@ -142,6 +142,14 @@ class AVOGADROCORE_EXPORT Mesh */ const Core::Array& normals() const; + /** + * @return The number of normals. + */ + unsigned int numNormals() const + { + return static_cast(m_normals.size()); + } + /** * @return Pointer to the first normal of the specified triangle. */ diff --git a/avogadro/qtgui/meshgenerator.cpp b/avogadro/qtgui/meshgenerator.cpp index 3b39c233af..3bdce50599 100644 --- a/avogadro/qtgui/meshgenerator.cpp +++ b/avogadro/qtgui/meshgenerator.cpp @@ -593,6 +593,12 @@ unsigned char MeshGenerator::calcCaseEdge(bool const& prevEdge, bool const& curr return 3; } +unsigned long MeshGenerator::duplicate(const Vector3i&, const Vector3f&) +{ + // FIXME Not implemented yet. + return 0; +} + void MeshGenerator::calcTrimValues(int& xl, int& xr, int const& j, int const& k) const { diff --git a/avogadro/qtgui/meshgenerator.h b/avogadro/qtgui/meshgenerator.h index 09935268f4..95a9a70a3a 100644 --- a/avogadro/qtgui/meshgenerator.h +++ b/avogadro/qtgui/meshgenerator.h @@ -26,6 +26,7 @@ namespace QtGui { * @class MeshGenerator meshgenerator.h * @brief Class that can generate Mesh objects from Cube objects. * @author Marcus D. Hanwell + * @author Perminder Singh * * This class implements a method of generating an isosurface Mesh from * volumetric data using the marching cubes algorithm. In the case of the @@ -107,6 +108,12 @@ class AVOGADROQTGUI_EXPORT MeshGenerator : public QThread int zstart; }; + /** + * Handles duplicate vertices (Not implemented). Placeholder for future functionality. + */ + unsigned long duplicate(const Vector3i& c, const Vector3f& pos); + + /** * @name Flying Edges * Methods to implement the "flying edges" method for isosurface mesh generation.