MCPcopy Create free account
hub / github.com/Kitware/VTK / GetFloatArray

Function GetFloatArray

IO/Geometry/vtkGLTFUtils.cxx:121–144  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

119
120//------------------------------------------------------------------------------
121bool GetFloatArray(const nlohmann::json& root, const std::string& key, std::vector<float>& value)
122{
123 auto it = root.find(key);
124 if (it == root.end() || !it.value().is_array())
125 {
126 return false;
127 }
128 value.reserve(it.value().size());
129 for (const auto& floatValue : it.value())
130 {
131 if (floatValue.empty() && !floatValue.is_number())
132 {
133 value.clear();
134 return false;
135 }
136 value.push_back(floatValue);
137 }
138 if (value.empty())
139 {
140 value.clear();
141 return false;
142 }
143 return true;
144}
145
146//------------------------------------------------------------------------------
147bool GetDoubleArray(const nlohmann::json& root, const std::string& key, std::vector<double>& value)

Callers 2

LoadMeshMethod · 0.70
LoadNodeMethod · 0.70

Calls 8

findMethod · 0.45
endMethod · 0.45
valueMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected