sibarrick Posted July 9, 2005 Share Posted July 9, 2005 Ok so I'm trying to dig a little further into HDK and hit a problem with dealing with edges. I think it's quite fundamental to working with the HDK, and will come up a lot, and I need some pointers. I basically want to be able to define a bunch of edges based on certain criteria and then remove them from the gdp. I think the way to do this is to build an edgegroup and then use edgeCollapse to get rid of them. Seems simple enough, assuming that is the correct way to do it. So my problem is this. I try to make a new empty edgegroup using GB_EdgeGroup edgeGroup(gdp,"tmpedge"); But the gdp that GB_EdgeGroup wants is a GB_Detail address and the normal gdp is a GU_Detail pointer. So the fundamental question is how do you convert between the two, and indeed should I be even trying too? Is this the right way to go about this? And as a side, why is it designed this way anyhow? [is this too many questions? I guess if you know C++ really well this stuff is trivial so apologies for trying to learn C++ and HDK at once. ] Quote Link to comment Share on other sites More sharing options...
George Posted July 11, 2005 Share Posted July 11, 2005 Hi, I think you're on the right track. In Object-Oriented speak: GU_Detail is-a GEO_Detail is-a GB_Detail. In human-speak: you can use a GU_Detail (or GEO_Detail) anyplace a GB_Detail is required (but not generally the other way around). It is designed this way because each level adds complexity, and some algorithms don't need to worry about the complexity available in higher levels. So they try to use the smallest requirements possible to get their job done. Also, as to edgeCollapse(), you may want to consider GU_Detail::deleteEdges(), I believe that's what's used by the Dissolve SOP if that is more of the effect you want. Take care, George. Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 11, 2005 Author Share Posted July 11, 2005 I understand the concept of inheritance. However regardless of whether I use deleteEdges or collapseEdges I still need to make a GB_EdgeGroup, and that's the bit that isn't working. GB_EdgeGroup requires a GB_Detail gdp and the gdp I have is a GU_Detail which is inherited from GEO_Detail which is inherited from GB_Detail. So I still don't know how to turn a GU_Detail gdp into a GB_Detail gdp, or even whether I should. I tried casting the gdp as a GB_Detail but the compiler didn't like it, so what am I missing? Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 11, 2005 Share Posted July 11, 2005 I tried casting the gdp as a GB_Detail but the compiler didn't like it, so what am I missing? 19409[/snapback] Hey Simon, I don't know the specifics of this case, but I think what George is saying is that a GU_Detail* (gdp) already *is* a GB_Detail*. just pass it gdp without anything fancy and it should accept it. As a side note though, I'm fairly certain that this polymorphic feature of the language only applies to pointers and references (not concrete instances). But in your case it's asking for a pointer, right?... so I think you should be ok.... Cheers! Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 11, 2005 Author Share Posted July 11, 2005 Problem is that's the first thing I tried and the compiler wouldn't have it. So I think I'm still missing something. GB_EdgeGroup Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 11, 2005 Share Posted July 11, 2005 GB_EdgeGroup::GB_EdgeGroup ( const GB_Detail & gdp, const char * name, int hidden = 1, unsigned short type = GBEDGEGROUP ) 19421[/snapback] Ah, I see. It wants a reference to a const GB_Detail, meaning, "Give me a reference to the actual thing (not its address), but don't worry, 'cause I promise I won't change anything inside it"... yup, compilers talk dont'ya'know So try calling it like this then: edgeGroup(*gdp,"tmpedge"); Note the use of *gdp instead of plain gdp -- you need to "dereference" gdp (don't you just love whacky c++-speak? ) I think that should do it... give it a try. Cheers! Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 11, 2005 Author Share Posted July 11, 2005 That was the conclusion I just came to, too. Another penny drops..... I think understanding that simple piece of syntax will help a lot, that methodology seems to get used a lot. Quote Link to comment Share on other sites More sharing options...
George Posted July 12, 2005 Share Posted July 12, 2005 Ah! My bad! Sorry I didn't notice the lack of "*" in the first example. Glad you got it going though. George. 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.