Jump to content

Accessing to the edges?


ote

Recommended Posts

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 by ote
Link to comment
Share on other sites

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?
}

Link to comment
Share on other sites

  • 1 month later...

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 ?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...