MCPcopy Create free account
hub / github.com/assimp/assimp / parseTransformMatrix

Function parseTransformMatrix

code/AssetLib/3MF/XmlSerializer.cpp:116–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116aiMatrix4x4 parseTransformMatrix(const std::string& matrixStr) {
117 // split the string
118 std::vector<float> numbers;
119 std::string currentNumber;
120 for (char c : matrixStr) {
121 if (c == ' ') {
122 if (!currentNumber.empty()) {
123 float f = std::stof(currentNumber);
124 numbers.push_back(f);
125 currentNumber.clear();
126 }
127 } else {
128 currentNumber.push_back(c);
129 }
130 }
131 if (!currentNumber.empty()) {
132 const float f = std::stof(currentNumber);
133 numbers.push_back(f);
134 }
135
136 aiMatrix4x4 transformMatrix;
137 transformMatrix.a1 = numbers[0];
138 transformMatrix.b1 = numbers[1];
139 transformMatrix.c1 = numbers[2];
140 transformMatrix.d1 = 0;
141
142 transformMatrix.a2 = numbers[3];
143 transformMatrix.b2 = numbers[4];
144 transformMatrix.c2 = numbers[5];
145 transformMatrix.d2 = 0;
146
147 transformMatrix.a3 = numbers[6];
148 transformMatrix.b3 = numbers[7];
149 transformMatrix.c3 = numbers[8];
150 transformMatrix.d3 = 0;
151
152 transformMatrix.a4 = numbers[9];
153 transformMatrix.b4 = numbers[10];
154 transformMatrix.c4 = numbers[11];
155 transformMatrix.d4 = 1;
156
157 return transformMatrix;
158}
159
160bool parseColor(const std::string &color, aiColor4D &diffuse) {
161 if (color.empty()) {

Callers 2

ImportXmlMethod · 0.85
ReadObjectMethod · 0.85

Calls 3

emptyMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected