Advertisement

'?' About finding distances(betw. 2 points)

Started by April 06, 2002 07:47 PM
1 comment, last by SimDemon 22 years, 7 months ago
Well, I know that to find the distance it''s something like: sqrt((x2 - x2) + (y2 - y1) + (z2 - z1)); how would I put parenthesis in C++ code so that it calculates correctly. Second, what would I need this for in a game? If thispost = 0 Then GoBack() Else Read() End If
I'll have a link to the TriFaze website as soon as possible. It's still currently being designed, by myself of course! =) I'll update the URL and my signature as soon as possible.Feel free to send me a message on Yahoo! or AOL IM™. =)
sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1))

As for the use, you''ll know when you need it.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Advertisement
If at any time u have probs with the parantheses, use the divide and conquer rule. solve the easier ones(the ones within the brackets) , save them in variables and then use those variables.

Caution: Use this only if u fnd it difficult assigning the parantheses to statement, else ur computer might start scolding u...

This is IndianaJones.
This is Jones - IndianaJones

This topic is closed to new replies.

Advertisement