# HG changeset patch # User Sebastien Jodogne # Date 1518099755 -3600 # Node ID 441cfe8e74408419206d35cfbd984eb2c0b61000 # Parent 7cd08a8ea7d07f23f3ce81f81726d6b83e4691d9 fill matrix diff -r 7cd08a8ea7d0 -r 441cfe8e7440 Framework/Toolbox/GeometryToolbox.cpp --- a/Framework/Toolbox/GeometryToolbox.cpp Fri Feb 02 10:02:27 2018 +0100 +++ b/Framework/Toolbox/GeometryToolbox.cpp Thu Feb 08 15:22:35 2018 +0100 @@ -482,5 +482,51 @@ } } } + + + void FillMatrix(Matrix& target, + size_t rows, + size_t columns, + const double values[]) + { + target.resize(rows, columns); + + size_t index = 0; + + for (size_t y = 0; y < rows; y++) + { + for (size_t x = 0; x < columns; x++, index++) + { + target(y, x) = values[index]; + } + } + } + + + void FillVector(Vector& target, + size_t size, + const double values[]) + { + target.resize(size); + + for (size_t i = 0; i < size; i++) + { + target[i] = values[i]; + } + } + + + void Convert(Matrix& target, + const Vector& source) + { + const size_t n = source.size(); + + target.resize(n, 1); + + for (size_t i = 0; i < n; i++) + { + target(i, 0) = source[i]; + } + } } } diff -r 7cd08a8ea7d0 -r 441cfe8e7440 Framework/Toolbox/GeometryToolbox.h --- a/Framework/Toolbox/GeometryToolbox.h Fri Feb 02 10:02:27 2018 +0100 +++ b/Framework/Toolbox/GeometryToolbox.h Thu Feb 08 15:22:35 2018 +0100 @@ -136,6 +136,18 @@ const Vector& edgeFrom, const Vector& edgeTo); + void FillMatrix(Matrix& target, + size_t rows, + size_t columns, + const double values[]); + + void FillVector(Vector& target, + size_t size, + const double values[]); + + void Convert(Matrix& target, + const Vector& source); + inline float ComputeBilinearInterpolationInternal(float x, float y, float f00, // source(x, y)