NX二次开发 PK射线 PK_BODY_pick_topols
//向实体射线采集对象要开错误检查PK_SetErrorCheckToggleState(true);
//near_plane = false 指点起始点位置, near_plane = true 和UF射线一样效果
//如果使用true要向反方向偏移一点在做射线,不然有时候第一个面没射到
//picked为返回内容
//PK_BODY_pick_topols_r_f(&picked);//要卸载内存
bool PKPK_BodyRayPickObject(const PK_BODY_t pkBody,
const double point[3],
const double direction[3],
const int max_faces,
const bool near_plane,
PK_BODY_pick_topols_r_t& picked)
{
if (0 == pkBody)
return false;
std::vector<PK_BODY_t> pkBodys;
pkBodys.clear();
pkBodys.push_back(pkBody);
return PKPK_BodyRayPickObject(pkBodys,
point,
direction,
max_faces,
near_plane,
picked);
}
bool PKPK_BodyRayPickObject(const std::vector<PK_BODY_t> pkBodys,
const double point[3],
const double dir[3],
const int max_faces,
const bool near_plane,
PK_BODY_pick_topols_r_t& picked)
{
int num = (int)pkBodys.size();
double mtx_3d[9] = { 0.0 };
picked.n_vertices = 0;
picked.e_v