Jump to content
  • Advertisement


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


Distance algorithms and procedural textures

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

Hello, this question may seem quite childish, but keep in mind I''m 15 :-) I need to get the distance between two vectors in a 3D space, how would I go about doing that? I know the 2D formula but don''t know how to apply it in 3D. Also, I''ve been doing a bit of research into procedural texturing lately, and have a wealth of information on ''how to go about theorizing about thinking about actually someday possibly pondering'' implementing them into a program (hehe most articles on the net are like this ;-) but nothing really useful. Does anyone have or know of any samples programs (with code of course) that show off how to use them? Thanks for any help!

Share this post

Link to post
Share on other sites
The distance between any two points in space is the square root of the sum of the difference in the components squared. (components is the wrong word...)

in 2d space:

sqrt ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))

in 3d space:

sqrt ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1))


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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!