Jump to content

Hdk Basics


Recommended Posts

  • Replies 84
  • Created
  • Last Reply

Top Posters In This Topic

Thanks, George, it works.

But I can't understand why I get two different results in this case

holder_gdp->normal();
gdp->merge(*holder_gdp);

and

gdp->merge(*holder_gdp);
gdp->normal();

In the first case I give an incorrect result. But in second I see what I want to see.

Any ideas? :blink:

Link to comment
Share on other sites

Well in the first case you're computing the normals on the geometry that doesn't include anything in gdp, so the normals in gdp will be set to a default (I think (0, 0, 0)) -- which will result is ugly blackness. In the second case you're computing the normals on the entire gdp.

George.

Link to comment
Share on other sites

I need to find a group of the polygons for which the current point is the common (or to find the neighbour points). Whether there is a ready function or it is necessary to create my own algorithm? The first that occurs - search of all polygons and check of concurrence of the points with current point. But it's a slow way.

And if to look at the structure of geo-detail it is possible to see, that between a point and a primitive there is a link (suspect, that is not bidirectional link), that is primitive contains indexes on points which enter into it. But not vice versa. Right? Whereas to be?

Link to comment
Share on other sites

I need to find a group of the polygons for which the current point is the common (or to find the neighbour points). Whether there is a ready function or it is necessary to create my own algorithm? The first that occurs - search of all polygons and check of concurrence of the points with current point. But it's a slow way.

And if to look at the structure of geo-detail it is possible to see, that between a point and a primitive there is a link (suspect, that is not bidirectional link), that is primitive contains indexes on points which enter into it. But not vice versa. Right? Whereas to be?

19414[/snapback]

try

GU_PrimGroupClosure.h

and

GEO_Closure.h

Link to comment
Share on other sites

Let me know if you have any luck with them I can't get findPolysUsingEdge to return anything other than an empty list.

19435[/snapback]

That's odd. findPolysUsingEdge() needs a valid GB_PointRefArray (or a GEO_PointRefArray) in order to figure out the connections. (Of course the polys must be fused also). Are you specifying a particular group when building the point-ref array? or maybe not specifying a gdp?

George.

Link to comment
Share on other sites

That's odd.  findPolysUsingEdge() needs a valid GB_PointRefArray (or a GEO_PointRefArray) in order to figure out the connections.  (Of course the polys must be fused also).  Are you specifying a particular group when building the point-ref array?  or maybe not specifying a gdp?

George.

19439[/snapback]

Ah maybe that's the problem I thought all you needed to supply was the two points pt0 and pt1 which represent the edge and then primlist got returned by the function. If prefarr was empty I thought it would consider everything. So are you saying the prefarr needs to be filled with a group of points to consider when looking for the polys, even if you are searrching the whole gdp? That was the next thing I was going to try.

I'm specifying a gdp when initialising my GEO_Closure object, I assume that's correct, since it worked for the edgeDelete method.

Link to comment
Share on other sites

Let me know if you have any luck with them I can't get findPolysUsingEdge to return anything other than an empty list.

I use findPolysUsingPoint() but I have a same problem.

Constructor of GB_PointRefArray expects the GEO_Detail and GB_Group.

So, what is it GB_Group? And how to initialize it?

My brain boils :blink:

Link to comment
Share on other sites

I got this working in the end.

It's a bit of a hack at the moment as I'm still figuring it out, but maybe it will help a little

const GEO_Point            *pt0,*pt1;
const GB_PointGroup        *pointGroup = parsePointGroups("*",gdp);
GB_PointRefArray           prefarr(gdp,pointGroup);
UT_IntArray                primlist(2);
GEO_Closure                connectedPrims(*gdp);

connectedPrims.findPolysUsingEdge(*pt0, *pt1, primlist, prefarr);

obviously you need to set pt0 and pt1 but then primlist comes back with useful things in it.

Still looking at this though so I sure there are far better ways to do this. :blink:

Link to comment
Share on other sites

That's looking great -- very close! The first thing is to get rid of the pointGroup, if you supply the gdp to the prefarr with a NULL for the GB_Group, then you get everything anyway. The reason GB_PointRefArray takes a GB_Group and not a GB_PointGroup is because it can accept either a primitive group or a point group. If one or the other is supplied, only those are considered in the ref array -- if NULL is supplied, then it uses the entire geometry. Building a point-ref array is pretty expensive, so the groups give you a way to only build for a subsection of the geometry that you're interested in. A lot of GB/GEO/GU methods behave in a similar way.

The other thing to note is that GEO_Closure gives you two options for findPolysUsingEdge(), one gives you back an integer list of prim ids, the other gives you a primitive group. If you don't need a group (to pass to other parts of the code), it's probably quicker to use an int array. Creating and destroying groups can be wasteful.

Hope that helps.

George.

Link to comment
Share on other sites

That's looking great -- very close!  The first thing is to get rid of the pointGroup, if you supply the gdp to the prefarr with a NULL for the GB_Group, then you get everything anyway. 

19455[/snapback]

When you say a NULL do you mean, like this, where you don't specify it or that you give it a null pointer.

GB_PointRefArray           prefarr(gdp);

I tried it this way and it didn't work, which was why I ended up trying to create a point group, didn't try giving it a null pointer cos I thought that was *bad* . I think ultimately I'll need one anyway since the user will probably need to supply a group to work on.

Link to comment
Share on other sites

When you say a NULL do you mean, like this, where you don't specify it or that you give it a null pointer.

GB_PointRefArray           prefarr(gdp);

As far as I know, a null pointer is simply the value 0 (zero). So I'm thinking he means something like this:

prefarr(gdp,0);

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...