Skip to content

Commit

Permalink
minor cleanusp and fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Perminder <[email protected]>
  • Loading branch information
perminder-17 committed Nov 6, 2024
1 parent 762e943 commit febd8e7
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 111 deletions.
15 changes: 10 additions & 5 deletions avogadro/core/cube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,23 @@ std::vector<float>::const_iterator Cube::getRowIter(size_t j, size_t k) const
bool Cube::setLimits(const Vector3& min_, const Vector3& max_,
const Vector3i& points)
{
// We can calculate all necessary properties and initialise our data
// Calculate the maximum dimension
int maxPoints = std::max({points.x(), points.y(), points.z()});
Vector3i equalPoints(maxPoints, maxPoints, maxPoints);

// Recalculate spacing based on equal points
Vector3 delta = max_ - min_;
m_spacing =
Vector3(delta.x() / (points.x() - 1), delta.y() / (points.y() - 1),
delta.z() / (points.z() - 1));
m_spacing = Vector3(delta.x() / (equalPoints.x() - 1),
delta.y() / (equalPoints.y() - 1),
delta.z() / (equalPoints.z() - 1));
m_min = min_;
m_max = max_;
m_points = points;
m_points = equalPoints;
m_data.resize(m_points.x() * m_points.y() * m_points.z());
return true;
}


bool Cube::setLimits(const Vector3& min_, const Vector3& max_, float spacing_)
{
Vector3 delta = max_ - min_;
Expand Down
Loading

0 comments on commit febd8e7

Please sign in to comment.