mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-13 00:07:24 +00:00
save matrix in single row on mlp
This commit is contained in:
parent
6666f4cc0e
commit
c6dbfc8f7e
@ -227,19 +227,16 @@ std::vector<MeshModel*> loadMLP(
|
||||
QDomNode tr = mesh.firstChildElement("MLMatrix44");
|
||||
|
||||
if (!tr.isNull()) {
|
||||
vcg::Matrix44f trm;
|
||||
if (tr.childNodes().size() == 1) {
|
||||
if (!binary) {
|
||||
auto * const v = md.mm()->cm.Tr.V();
|
||||
auto const rows = tr.firstChild().nodeValue().split("\n", QString::SkipEmptyParts);
|
||||
auto i = 0u;
|
||||
for (auto const & row: rows) {
|
||||
{
|
||||
auto const values = row.split(" ", QString::SkipEmptyParts);
|
||||
for (auto const & value: values) {
|
||||
if (i >= 16u) break;
|
||||
v[i++] = value.toFloat();
|
||||
}
|
||||
Scalarm* v = md.mm()->cm.Tr.V();
|
||||
const QStringList rows = tr.firstChild().nodeValue().split("\n", Qt::SkipEmptyParts);
|
||||
unsigned int i = 0;
|
||||
for (const QString& row: rows) {
|
||||
const QStringList values = row.split(" ", Qt::SkipEmptyParts);
|
||||
for (const QString& value: values) {
|
||||
if (i >= 16u) break;
|
||||
v[i++] = value.toFloat();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,10 +7,6 @@
|
||||
#include <wrap/io_trimesh/alnParser.h>
|
||||
#include <common/mlexception.h>
|
||||
|
||||
#include <algorithm> // std::copy
|
||||
#include <iterator> // std::ostream_iterator
|
||||
#include <sstream> // std::ostringstream
|
||||
|
||||
namespace mlp {
|
||||
|
||||
QDomElement matrix44mToXML(const Matrix44m &m, bool binary, QDomDocument &doc)
|
||||
@ -22,11 +18,11 @@ QDomElement matrix44mToXML(const Matrix44m &m, bool binary, QDomDocument &doc)
|
||||
QDomText nd = doc.createTextNode(QString(value));
|
||||
}
|
||||
else {
|
||||
std::ostringstream matrix;
|
||||
std::copy(m.V(), m.V() + 16u,
|
||||
std::ostream_iterator<Matrix44m::ScalarType>(matrix, " "));
|
||||
//std::experimental::make_ostream_joiner(matrix, ", ")); // with <experimental/iterator>
|
||||
nd = doc.createTextNode(QString(matrix.str().c_str()));
|
||||
QString row[4];
|
||||
for (int i = 0; i < 4; ++i)
|
||||
row[i] = QString("%1 %2 %3 %4 ").arg(m[i][0]).arg(m[i][1]).arg(m[i][2]).arg(m[i][3]);
|
||||
|
||||
nd = doc.createTextNode("\n" + row[0] + row[1] + row[2] + row[3] + "\n");
|
||||
}
|
||||
matrixElem.appendChild(nd);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user