#pragma once #include "Rectangle.h" #include class Grid { public: Grid(const Rectangle& bounds) : mBounds(bounds) { mValues = std::vector(mNumX*mNumY, 0.0); } Rectangle GetBounds() const { return mBounds; } double GetXSpacing() const { return mBounds.GetWidth()/double(mNumX); } double GetYSpacing() const { return mBounds.GetHeight()/double(mNumY); } std::vector GetValues() const { return mValues; } void ResetBounds(const Rectangle& bounds) { mBounds = bounds; mValues = std::vector(mNumX*mNumY, 0.0); } void SetValues(const std::vector& indices, double value) { for (auto index : indices) { mValues[index] = value; } } private: Rectangle mBounds; std::vector mValues; unsigned mNumX{5}; unsigned mNumY{5}; };