Commit 1c3c8f1a2e2528feca17d88c277952666a4093f8
1 parent
005d8644
int to unsigned int
Showing
1 changed file
with
33 additions
and
0 deletions
Show diff stats
stim/visualization/fiber.h
... | ... | @@ -274,6 +274,39 @@ public: |
274 | 274 | T radius(int idx){ |
275 | 275 | return r[idx]; |
276 | 276 | } |
277 | + /// get index of a node on a fiber | |
278 | + // by matching the node on fiber to already set vertices (both strings) | |
279 | + // used in obj file conversion | |
280 | + int | |
281 | + getIndexes(std::string* input, std::string searched, int sizeV) | |
282 | + { | |
283 | + int result = 0; | |
284 | + for (int i = 0; i < sizeV; i++) | |
285 | + { | |
286 | + if (input[i] == searched) | |
287 | + { | |
288 | + result = i + 1; | |
289 | + } | |
290 | + } | |
291 | + return result; | |
292 | + } | |
293 | + // strObj returns a string of fiber indices corresponding to vectors of positions in the fiber including intermediate nodes | |
294 | + std::string | |
295 | + strObj(std::string* strArray, int sizeV) | |
296 | + { | |
297 | + std::stringstream ss; | |
298 | + std::stringstream oss; | |
299 | + for(unsigned int i = 0; i < N; i++) | |
300 | + { | |
301 | + ss.str(std::string()); | |
302 | + for(unsigned int d = 0; d < 3; d++) | |
303 | + { | |
304 | + ss<<c[i][d]; | |
305 | + } | |
306 | + oss<<getIndexes(strArray, ss.str(), sizeV)<<" "; | |
307 | + } | |
308 | + return oss.str(); | |
309 | + } | |
277 | 310 | |
278 | 311 | /// Return the point on the fiber closest to q |
279 | 312 | /// @param q is the query point used to locate the nearest point on the fiber centerline | ... | ... |