Jump to content

Find Minimum Distance


Recommended Posts

Hi all!

I am trying to find the minimum distance between a buch of lines. Digging through the HDK Docs I found GU_Primitive::minimum(). As far as i undertand the function it needs a GU_Primitive & as input but I have a GEO_Primitive *. The problem is that i have no idea how I can convert the GEO_Primitive * to the GU_Primitive &. I am not an experienced programmer and have some troubles to understand the logic of pointers and references, particularly in this example. I would be very thankful if somebody could tell me what I am doing wrong.

The Code is as follow:

GEO_Primitive *prim1, *prim2;
GU_Primitive *guprim1, guprim2*;
float dist, u1, v1, u2, v2;

prim1 = gdp->primitives()(0);
prim2 = gdp->primitives()(1);

guprim1 = dynamic_cast<GU_Primitive *> (prim1);
guprim2 = dynamic_cast<GU_Primitive *> (prim2);

guprim1->minimum(guprim2, 1.0, &u1, &v1, &u2, &v2, 1);

Thanks in advance!

Link to comment
Share on other sites

Pointers? Well, I wouldn't be listen myself on your place, but, as a hopeless help, I could say it's enough to dereference a pointer. Function itself makes a reference from the object. So:

guprim1->minimum(*guprim2, 1.0, &u1, &v1, &u2, &v2, 1);

should work fine.

hth,

skk.

Edited by SYmek
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...