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