\(B=\dfrac{a^3+c^3+3ac\left(a+c\right)-b^3-3ac\left(a+c\right)+3abc}{\left(a+b\right)^2+\left(b+c\right)^2+\left(c-a\right)^2}\)
\(=\dfrac{\left(a+c\right)^3-b^3-3ac\left(a+c-b\right)}{\left(a+b\right)^2+\left(b+c\right)^2+\left(c-a\right)^2}\)
\(=\dfrac{\left(a+c-b\right)\left[\left(a+c\right)^2+b\left(a+c\right)+b^2\right]-3ac\left(a+c-b\right)}{\left(a+b\right)^2+\left(b+c\right)^2+\left(c-a\right)^2}\)
\(=\dfrac{\left(a+c-b\right)\left(a^2+b^2+c^2+ab+bc-ac\right)}{\left(a+b\right)^2+\left(b+c\right)^2+\left(c-a\right)^2}\)
\(=\dfrac{-2\left(2a^2+2b^2+2c^2+2ab+2bc-2ca\right)}{\left(a+b\right)^2+\left(b+c\right)^2+\left(c-a\right)^2}\)
\(=\dfrac{-2\left[\left(a+b\right)^2+\left(b+c\right)^2+\left(c-a\right)^2\right]}{\left(a+b\right)^2+\left(b+c\right)^2+\left(c-a\right)^2}=-2\)