Jump to content

Edge Groups


Recommended Posts

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. :rolleyes: ]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 :P

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? :P)

I think that should do it... give it a try.

Cheers!

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