# Square-wise distance

I had a hard time finding a good title for this. Feel free to edit it if you find something more appropiate.

What I'm trying to do is finding a function such that, given a point $C$ (center), gives the square-wise distance from any point to $C$.

Now, for a simple definition of square-wise dist, imagine a square of a fixed size centered at $C$ and aligned to the $x$ and $y$ axis. I want each point of this square to be at the same square-wise distance from $C$, so it's the same as euclidean distance but changing circle by square.

How would I go into computing that? I can't wrap my head around it...

• Hint: Consider each of the x-coordinate and the y-coordinate of the said two points. Commented Aug 11, 2014 at 8:44
• en.wikipedia.org/wiki/Uniform_norm Commented Aug 11, 2014 at 8:46
• @TheGreatSeo: It's taxicab geometry at a 45 degree angle. Commented Aug 11, 2014 at 9:00
• @user2357112 It seems to be. I confused. Commented Aug 11, 2014 at 9:00
• I'll have a look into that link. I didn't know this had a name! PD: Btw this is all related to a shader I'm writing, so when I get back home I'll edit my question and post a graphical representation of both euclidean distance and this distance with colors, I think that might also help to clearify my question for other readers. Commented Aug 11, 2014 at 11:51

If $C = (x_c, y_c)$, and $P = (x,y)$, then: $$d(P,C) = \sup\{|x_c - x|, |y_c - y|\}$$ does the job.
$$|(x-a)-(y-b)|+|(x-a)+(y-b)|=A$$ represents a square whose edge length is $A$ with the center $(a,b)$.