Jump to content
  • Advertisement

Archived

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

Jederas

Cube Root?

This topic is 5756 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

Is this something that is included in the standard off the shelf MSVC++ math.h file? If so, what's the function called? Most of the ones I don't recognize are so cryptic they might as well be in arabic or something. If not, how would I actually accomplish this? It couldn't be pretty. Reason I ask is because I'm starting to get into height mapping, and I'm working on getting to where I can make one texture cover the entire area and not be too distorted. I suppose the pow function could take care of it, using 0.33 as the power. Anyone know how reliable would this approach be? [edited by - Jederas on September 12, 2002 6:30:40 AM]

Share this post


Link to post
Share on other sites
Advertisement

  
#include <math.h>

double cube_root(double x){
return exp(1.0/3 * log(x));
// -OR-

return pow(x,1.0/3);
}



Both versions should be perfectly reliable.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!