ote Posted February 1, 2012 Share Posted February 1, 2012 (edited) Hi, I am discovering Houdini and the hdk for a couple of weeks for now, so I'm quite new . I'm having problems to have access to the edges of my input geometry. I know how to get every point (FOR_ALL_OPT_GROUP_POINTS) but I haven't found a way to do the same with edges. With the help of some reading from the forum, I've tried to use getEdgeList() from class GQ_Detail, but it only works if the polygon is closed and it is not always the case for me. Basically, my input geometry is a set of points which may or not contain some edges/segments connecting two points. I need to be able to find the index in the gdp->points() (or the coordinates) of the two points at each end of every edge/segment. How can I do that? Edited February 1, 2012 by ote Quote Link to comment Share on other sites More sharing options...
edward Posted February 2, 2012 Share Posted February 2, 2012 If you only care a about segments with two points, then perhaps GEO_PointRefArray (derived from GB_PointRefArray): http://www.sidefx.com/docs/hdk11.1/_g_e_o___point_ref_8h_source.html http://www.sidefx.com/docs/hdk11.1/_g_b___point_ref_8h_source.html GEO_PointRefArray pointrefs(gdp); size_t n = pointrefs.entries(); for (size_t pt_i = 0; pt_i < n; ++pt_i) { const GB_PointRef *ref = pointrefs(pt_i); if (!ref) continue; const GEO_Point *adj_pt = ref->vtx->getBasePt(); size_t pt_j = adj_pt->getNum(); // We now have an edge for points (pt_i,pt_j) // NOTE: You will need to check for duplicates (pt_j, pt_i). // A boost::unordered_map perhaps? } Quote Link to comment Share on other sites More sharing options...
ote Posted March 22, 2012 Author Share Posted March 22, 2012 I was on something else and only try today your solution, but it doesn't work. I tested that on a box and try printf("%d-%d", pt_i, pt_j) and get 0-0 1-1, ... 7-7 instead of 0-1, 1-2. Besides, I would like to have all the edge from every point, like for the point 0 of the cube 0-1, 0-3 and 0-4. Do you know how I could get that ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.