resonanz Posted September 17, 2011 Share Posted September 17, 2011 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! Quote Link to comment Share on other sites More sharing options...
symek Posted September 18, 2011 Share Posted September 18, 2011 (edited) 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 September 18, 2011 by SYmek Quote Link to comment Share on other sites More sharing options...
resonanz Posted September 18, 2011 Author Share Posted September 18, 2011 (edited) Thank you very much SYmek! I thought it would be much more complicated. Hopefully all my journeys into HDK-Land will end up being that hassle-free! Thanks again! Edited September 18, 2011 by resonanz 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.