Hello everyone!
Inspired by this topic (http://forums.odforce.net/topic/12691-closest-point-on-the-primitive/ [forums.odforce.net]) I've been trying to implement HDK function similar to VEX xyzdist using GU_RayIntersect class and its minumumPoint() method. Unfortunately, it always gives me zero values for uv. Tried it with different objects, no luck. Does anyone know how to make it right?
OP_ERROR
SOP_xyzdist::cookMySop(OP_Context &context)
{
if (lockInputs(context) >= UT_ERROR_ABORT)
return error();
duplicateSource(0, context);
UT_Vector3 pos(0,0,0); // just for testing
GA_PrimitiveGroup* grp = 0; // Searching the whole geometry, I suppose
GU_MinInfo mininfo(0, 100000, 1);
GU_RayIntersect near(gdp, grp, 1);
near.minimumPoint(pos, mininfo);
float u = mininfo.u1;
float v = mininfo.v1;
std::cout << u << “ ” << v << std::endl;
unlockInputs();
return error();
}
VEX xyzdist function in HDK
1682 0 0- Dmitry Shurov
- Member
- 3 posts
- Joined: 1月 2014
- Offline
-
- Quick Links