Hello!
I was wondering what is the logic inside these two function in order to rebuild them from scratch to optimize some calculations. Is it even possible to do with VEX? I am guessing that the function is very optimized and might not be as straight forward to recreate as I wished.
Thanks!
Inside nearpoint() & nearpoints()
691 3 0- Cicuta
- Member
- 61 posts
- Joined: Nov. 2019
- Offline
- tamte
- Member
- 8622 posts
- Joined: July 2007
- Offline
- juejuezi
- Member
- 28 posts
- Joined: July 2022
- Offline
- juejuezi
- Member
- 28 posts
- Joined: July 2022
- Offline
The function of nearpoints is roughly implemented through HDK(c++). You can find “buildPointGrid” and “buildPointTree” in GU_NeighbourList, and I guess that the optimization methods are grid and kdtree.
template <VEX_Precision PREC> static void mynearpoints_Evaluate(int argc, void* argv[], void* data) { UT_Array<VEXint<PREC>>* result = (UT_Array<VEXint<PREC>> *)argv[0]; const char* surfaceAddress = static_cast<const char*>(argv[1]); VEXint<PREC>* input_pt = (VEXint<PREC>*)argv[2]; VEXfloat<PREC>* input_maxdist = (VEXfloat<PREC>*)argv[3]; GU_SopQuery quary; GU_ConstDetailHandle handle = quary.getDetail(surfaceAddress); const GU_Detail* gdp = handle.gdp(); GU_NeighbourList neil; GU_NeighbourListParms neilp; neilp.setRadius(*input_maxdist); neilp.setOverrideRadius(true); neilp.setMode(GU_NeighbourListParms::InteractionMode::NONUNIFORM); neil.build(gdp, neilp); UT_Array<GA_Offset> ptlist; neil.getNeighbours(*input_pt, gdp, ptlist); for (GA_Index pt:ptlist) result[0].append(pt); }
-
- Quick Links