You seem to have paraphrased the formula incorrectly. In vector algebra, there are several types of multiplication and they use different symbols. The original article uses the dot product (·) which is not equivalent to the generic multiplication symbol *. It also uses bold face to signify vectors as opposed to scalar quantities, i.e. r² is not the same as r². In fact, as you rightfully noted, you cannot really 'square' a vector.
The formula as it was originally written is:
p · p = r²
If two vectors point in the same direction, as p and p obviously do, their dot product equals the square of their absolute values or 'lengths'. By definition, any point at a distance r from the origin lies on the sphere with radius r centered at the origin. Ergo, if the square of a vector's length equals the square of this sphere's radius (p · p = r²), then the point lies on a sphere with radius r. The article mentions the sphere's radius is r²; this is incorrect.
p*p
. One can not just use operators with vectors without mentioning, what his operator mean. It is much better to write it in "shader style" -dot(p, p)
, or in "math style" -p^T * p
(whereT
is transposition and*
is matrix multiplication). \$\endgroup\$ – Ivan Kuckir Jan 30 '13 at 10:13