Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

it

C++ pointer problem

This topic is 6282 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''m building a bounding box hierarchy for collision detection using a BBox class to build a hierarch for a diamond shaped object. The diamond first creates the first bounding box and then calls on its sort and split functions,to sort its triangles and split up evenly to make two new boxes. I send the split box function two poniter address which it should change into the min and max extends of my new bounding box (Which are stored as vectors), but I getting the following error when I try to compile diamond.cpp: "cannot convert parameter 1 from ''class CVector** '' to class CVector * '' " This is the code in the diamond class giving me an error //create box to completly enclose diamond box[0] box[0]=BBox(numTriangles,triangles,vertices,initPos); //create new vectors to store min and max extends of child boxes CVector newMin=CVector(0,0,0); CVector newMax=CVector(0,0,0); //create pointers to the above vectors CVector *newMinR; newMinR=&newMin; CVector *newMaxR; newMaxR=&newMax; //sort the triangles stored in box[0] box[0].XSortTriangles(); //send the address of the two vectors split box //this should change them to the correct value box[0].splitBox(&newMinR,&newMaxR); THE LAST LINE HERE GIVES THE AFFORMENTIONED ERROR. Anyone know what I''m doing wrong?? the function Split box accepts two pointers as arguments?? void BBox::splitBox(CVector *newMinR,CVector *newMaxR)

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
newMinR is already a pointers, so you don''t need the address of operator.

It should be just

box[0].splitBox(newMinR,newMaxR);

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!