Path: blob/master/thirdparty/jolt_physics/Jolt/Math/DynMatrix.h
9913 views
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)1// SPDX-FileCopyrightText: 2022 Jorrit Rouwe2// SPDX-License-Identifier: MIT34#pragma once56JPH_NAMESPACE_BEGIN78/// Dynamic resizable matrix class9class [[nodiscard]] DynMatrix10{11public:12/// Constructor13DynMatrix(const DynMatrix &) = default;14DynMatrix(uint inRows, uint inCols) : mRows(inRows), mCols(inCols) { mElements.resize(inRows * inCols); }1516/// Access an element17float operator () (uint inRow, uint inCol) const { JPH_ASSERT(inRow < mRows && inCol < mCols); return mElements[inRow * mCols + inCol]; }18float & operator () (uint inRow, uint inCol) { JPH_ASSERT(inRow < mRows && inCol < mCols); return mElements[inRow * mCols + inCol]; }1920/// Get dimensions21uint GetCols() const { return mCols; }22uint GetRows() const { return mRows; }2324private:25uint mRows;26uint mCols;27Array<float> mElements;28};2930JPH_NAMESPACE_END313233