Question. I see that "magnitude" is based on the distance formula for 2 points of a line, which is:
d= Square root of ( (x2-x1)^2+(y2-y1)^2)
When you square the results of the subtraction, wouldn't it automatically make any negative number positive anyway? Is this automatically incorporated into "magnitude" or is it necessary to specify the absolute value?
Comments
Magnitude, in this case, is the distance between two points - a line segment.
It is used like this:
DistanceBetweenActors = magnitude(abs(Actor1.X-Actor2.X),abs(Actor1.Y-Actor2.Y))
Magnitude is a distance, and as such, always needs to be positive. That's why the abs() methods are in there as well.
That formula will give you the distance, in pixels, between the two actors. It will increase as the distance increases.
Joe
d= Square root of ( (x2-x1)^2+(y2-y1)^2)
When you square the results of the subtraction, wouldn't it automatically make any negative number positive anyway? Is this automatically incorporated into "magnitude" or is it necessary to specify the absolute value?
-Caleb